dtoolkit.util._decorator.deprecated_kwargs#

dtoolkit.util._decorator.deprecated_kwargs(*arguments: list[str], message: str = "The keyword argument '{argument}' of '{func_name}' is deprecated.")[source]#

Used as a decorator when deprecating function keyword argument names.

Parameters:
argumentslist of str

The list of deprecated keyword arguments.

messagestr

The message of DeprecationWarning. It should be a string or a string template. If a string template defaults input func_name and argument.

Raises:
DeprecationWarning

If one of arguments is input into the function.

Examples

>>> from dtoolkit.util._decorator import deprecated_kwargs
>>> @deprecated_kwargs('x', 'y')
... def plus(a, b, x=0, y=0):
...     return a + b
>>> plus(1, 2, x=1, y=2)
3