scverse_misc.deprecated

Contents

scverse_misc.deprecated#

scverse_misc.deprecated(msg, *, category=<class 'FutureWarning'>, stacklevel=1)#

Decorator to indicate that a class, function, or overload is deprecated.

Wraps warnings.deprecated() and additionally modifies the docstring to include a deprecation notice.

Parameters:
  • msg (Deprecation) – The deprecation message.

  • category (type[Warning] (default: <class 'FutureWarning'>)) – The category of the warning that will be emitted at runtime.

  • stacklevel (int (default: 1)) – The stack level of the warning.

Return type:

Callable[[TypeVar(F, bound= Callable[..., object])], TypeVar(F, bound= Callable[..., object])]

Examples

>>> @deprecated(Deprecation("0.2", "Use bar() instead."))
... def foo(baz):
...     pass