{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / _util / _rename_parameter

function

scipy._lib._util:_rename_parameter

source: /scipy/_lib/_util.py :901

Signature

def   _rename_parameter ( old_name new_name dep_version = None )

Summary

Generate decorator for backward-compatible keyword renaming.

Extended Summary

Apply the decorator generated by _rename_parameter to functions with a recently renamed parameter to maintain backward-compatibility.

After decoration, the function behaves as follows: If only the new parameter is passed into the function, behave as usual. If only the old parameter is passed into the function (as a keyword), raise a DeprecationWarning if dep_version is provided, and behave as usual otherwise. If both old and new parameters are passed into the function, raise a DeprecationWarning if dep_version is provided, and raise the appropriate TypeError (function got multiple values for argument).

Parameters

old_name : str

Old name of parameter

new_name : str

New name of parameter

dep_version : str, optional

Version of SciPy in which old parameter was deprecated in the format 'X.Y.Z'. If supplied, the deprecation message will indicate that support for the old parameter will be removed in version 'X.Y+2.Z'

Notes

Untested with functions that accept *args. Probably won't work as written.

Aliases

  • scipy.stats._morestats._rename_parameter