argopy.utils.deprecated#
- deprecated(reason: str | None = None, version: str | None = None, ignore_caller: List = [])[source]#
Deprecation warning decorator
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.
- Parameters:
Examples
The @deprecated can be used with a ‘reason’ and a ‘version’
@deprecated("please, use another function", version='0.2') def old_function(x, y): pass
or without:
@deprecated def old_function(x, y): pass
The @deprecated can also be ignored from specific callers.
@deprecated("please, use another function", version='0.2', ignore_caller='postprocessing') def old_function(x, y): pass
References
This decorator is largely inspired by https://stackoverflow.com/a/40301488