Module pedantic.decorators.fn_deco_deprecated
Functions
def deprecated(func: Callable[..., ~ReturnType]) ‑> Callable[..., ~ReturnType]
-
Expand source code
def deprecated(func: F) -> F: """ Use this decorator to mark a function as deprecated. It will raise a warning when the function is called. Example: >>> @deprecated ... def my_function(a, b, c): ... pass >>> my_function(5, 4, 3) """ @wraps(func) def wrapper(*args: Any, **kwargs: Any) -> ReturnType: _raise_warning(msg=f'Call to deprecated function {func.__qualname__}.', category=DeprecationWarning) return func(*args, **kwargs) return wrapper
Use this decorator to mark a function as deprecated. It will raise a warning when the function is called.
Example:
>>> @deprecated ... def my_function(a, b, c): ... pass >>> my_function(5, 4, 3)