MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / warn_deprecated

Function warn_deprecated

tools/Polygraphy/polygraphy/mod/exporter.py:212–224  ·  view source on GitHub ↗
(name, use_instead, remove_in, module_name=None, always_show_warning=False)

Source from the content-addressed store, hash-verified

210
211
212def warn_deprecated(name, use_instead, remove_in, module_name=None, always_show_warning=False):
213
214 if version(polygraphy.__version__) >= version(remove_in):
215 G_LOGGER.internal_error(f"{name} should have been removed in version: {remove_in}")
216
217 full_obj_name = f"{module_name}.{name}" if module_name else name
218 msg = f"{full_obj_name} is deprecated and will be removed in Polygraphy {remove_in}."
219 if use_instead is not None:
220 msg += f" Use {use_instead} instead."
221
222 warnings.warn(msg, DeprecationWarning, stacklevel=3)
223 if always_show_warning:
224 G_LOGGER.warning(msg)
225
226
227def deprecate(remove_in, use_instead, module_name=None, name=None):

Callers 4

__getattr__Method · 0.85
__setattr__Method · 0.85
__init__Method · 0.85
wrappedFunction · 0.85

Calls 3

versionFunction · 0.90
internal_errorMethod · 0.80
warningMethod · 0.45

Tested by

no test coverage detected