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:
>>> @deprecated(as_of=deprecated.ICEHOUSE)
... def a(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()')
... def b(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=+1)
... def c(): pass
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=None)
... def d(): pass
>>> @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.
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.
Raises: | DeprecatedConfig if the system is configured for fatal deprecations. |
---|