deprecated_keyword_argument()¶
- audeer.deprecated_keyword_argument(*, deprecated_argument, removal_version, new_argument=None, mapping=None, remove_from_kwargs=True)[source]¶
Mark keyword argument as deprecated.
Provide a decorator to mark keyword arguments as deprecated.
You have to specify the version, for which the deprecated argument will be removed. The content assigned to
deprecated_argument
is passed on to thenew_argument
.- Parameters
deprecated_argument (
str
) – keyword argument to be marked as deprecatedremoval_version (
str
) – version the code will be removednew_argument (
Optional
[str
]) – keyword argument that should be used insteadmapping (
Optional
[Callable
]) – if the keyword argument is not only renamed, but expects also different input values, you can map to the new ones with this callableremove_from_kwargs (
bool
) – ifTrue
,deprecated_argument
will be removed fromkwargs
inside the decorated object
- Return type
Examples
>>> @deprecated_keyword_argument( ... deprecated_argument="foo", ... new_argument="bar", ... removal_version="2.0.0", ... ) ... def function_with_new_argument(*, bar): ... pass