neuralib.util.deprecation

neuralib.util.deprecation.deprecated_class(*, new=None, remarks=None, removal_version=None)[source]

Mark deprecated class

Parameters:
  • new (str | None) – The renamed new usage

  • remarks (str | None) – Further remarks to be shown

  • removal_version (str | None) – Optional version or date when the function is planned to be removed

neuralib.util.deprecation.deprecated_func(*, new=None, remarks=None, removal_version=None)[source]

Mark deprecated functions.

Parameters:
  • new (str | None) – The renamed new usage

  • remarks (str | None) – The reason why the function is deprecated

  • removal_version (str | None) – Optional version or date when the function is planned to be removed

neuralib.util.deprecation.deprecated_aliases(**aliases)[source]

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

This decorator allows you to support old argument names while transitioning to new ones. It will raise a DeprecationWarning if the old argument name is used and will automatically map the value to the new argument name.

Parameters:

aliases (str) – mapping of old argument names to new argument names.

Returns:

Decorated function with support for deprecated argument names.

Raises:
  • RuntimeError – If a new argument name does not exist in the function’s signature.

  • ValueError – If both old and new argument names are provided simultaneously.