neuralib.util.deprecation

deprecated_class

Mark deprecated class

deprecated_func

Mark deprecated functions.

deprecated_aliases

Mark deprecated argument names and map them to new argument names in a function

Deprecation

This module provides decorators for marking classes and functions as deprecated. It also offers a decorator to support deprecated argument names in functions by automatically mapping them to their new names and issuing a warning.

Functions and Decorators

Class Example:

@deprecated_class(new="NewClass")
class OldClass:
    pass

Function Example:

@deprecated_func(new="new_function")
def old_function():
    pass

Aliases Example:

@deprecated_aliases(old_arg="new_arg")
def some_function(new_arg):
    pass

# then you can use old args but deprecate warning
some_function(old_arg=...)