Helpers for comparing version strings.
A decorator to mark callables as deprecated.
This decorator logs a deprecation message when the callable it decorates is used. The message will include the release where the callable was deprecated, the release where it may be removed and possibly an optional replacement. It also logs a message when a deprecated exception is being caught in a try-except block, but not when subclasses of that exception are being caught.
Examples:
Specifying the required deprecated release
>>> @deprecated(as_of=deprecated.ICEHOUSE)
... def a(): pass
Specifying a replacement:
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()')
... def b(): pass
Specifying the release where the functionality may be removed:
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=+1)
... def c(): pass
Specifying the deprecated functionality will not be removed:
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=None)
... def d(): pass
Specifying a replacement, deprecated functionality will not be removed:
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()',
... remove_in=None)
... def e(): pass
Warning
The hook used to detect when a deprecated exception is being caught does not work under Python 3. Deprecated exceptions are still logged if they are thrown.
Warn about the deprecation of a feature.
what – name of the thing being deprecated.
as_of – the release deprecating the callable.
in_favor_of – the replacement for the callable (optional)
remove_in – an integer specifying how many releases to wait before removing (default: 2)
logger – the logging object to use for reporting (optional).
Register configuration options used by this library.
Call this function when a deprecated feature is used.
If the system is configured for fatal deprecations then the message
is logged at the ‘critical’ level and DeprecatedConfig
will
be raised.
Otherwise, the message will be logged (once) at the ‘warn’ level.
DeprecatedConfig
if the system is configured for
fatal deprecations.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.