deprecation#

Helper functions for code deprecation.

Module Contents#

Functions#

deprecated_arg_alias(→ Callable)

Decorator for deprecated function and method arguments.

_rename_kwargs(→ None)

Helper function for deprecating function arguments.

deprecated_arg_alias(depr_version: str, **aliases: str) Callable[source]#

Decorator for deprecated function and method arguments.

From https://stackoverflow.com/a/49802489.

Use as follows:

@deprecated_arg_alias("0.x.0", old_arg="new_arg")
def myfunc(new_arg):
    ...
Parameters:
  • depr_version – The quantify-scheduler version in which the parameter names will be removed.

  • aliases – Parameter name aliases provided as old="new".

Returns:

The same function or method, that raises a FutureWarning if a deprecated argument is passed, or a TypeError if both the new and the deprecated arguments are passed.

_rename_kwargs(func_name: str, depr_version: str, kwargs: dict[str, Any], aliases: dict[str, str]) None[source]#

Helper function for deprecating function arguments.