pvlib._deprecation.renamed_kwarg_warning#

pvlib._deprecation.renamed_kwarg_warning(since, old_param_name, new_param_name, removal='')[source]#

Decorator to mark a possible keyword argument as deprecated and replaced with other name.

Raises a warning when the deprecated argument is used, and replaces the call with the new argument name. Does not modify the function signature.

Warning

Ensure removal date with a fail_on_pvlib_version decorator in the test suite.

Note

Not compatible with positional-only arguments.

Note

Documentation for the function may updated to reflect the new parameter name; it is suggested to add a .. versionchanged:: directive.

Parameters:
  • since (str) – The release at which this API became deprecated.

  • old_param_name (str) – The name of the deprecated parameter.

  • new_param_name (str) – The name of the new parameter.

  • removal (str, optional) – The expected removal version, in order to compose the Warning message.

Examples

>>> @renamed_kwarg_warning("1.4.0", "old_name", "new_name", "1.6.0")
>>> def some_function(new_name=None):
>>>     pass
>>> some_function(old_name=1)
Parameter 'old_name' has been renamed since 1.4.0. and
will be removed in 1.6.0. Please use 'new_name' instead.
>>> @renamed_kwarg_warning("1.4.0", "old_name", "new_name")
>>> def some_function(new_name=None):
>>>     pass
>>> some_function(old_name=1)
Parameter 'old_name' has been renamed since 1.4.0. and
will be removed soon. Please use 'new_name' instead.