stouputils.decorators.deprecated module#
- deprecated(
- func: Callable[..., T],
- *,
- message: str = '',
- version: str = '',
- error_log: LogLevels = LogLevels.WARNING,
- deprecated(
- func: None = None,
- *,
- message: str = '',
- version: str = '',
- error_log: LogLevels = LogLevels.WARNING,
Decorator that marks a function as deprecated.
- Parameters:
func (Callable[..., T] | None) – Function to mark as deprecated
message (str) – Additional message to display with the deprecation warning
version (str) – Version since when the function is deprecated (e.g. “v1.2.0”)
error_log (LogLevels) –
Log level for the deprecation warning
LogLevels.NONE- NoneLogLevels.WARNING- Show as warningLogLevels.WARNING_TRACEBACK- Show as warning with tracebackLogLevels.ERROR_TRACEBACK- Show as error with tracebackLogLevels.RAISE_EXCEPTION- Raise exception
Examples
>>> @deprecated ... def old_function(): ... pass
>>> @deprecated(message="Use 'new_function()' instead", error_log=LogLevels.WARNING) ... def another_old_function(): ... pass