-
-
Save saimn/f9f30bab65a19fc1fa5dc2492b148559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [7]: @deprecated_renamed_argument(['x', 'y', 'z'], ['a', 'b', 'c'], '1.2') | |
...: def test(a, b, c): | |
...: """Test func""" | |
...: return a, b, c | |
...: | |
...: | |
In [8]: test? | |
Signature: test(a, b, c) | |
Docstring: | |
Test func | |
.. versionchanged:: . | |
``b`` replaces the deprecated ``y`` argument. | |
.. versionchanged:: 1 | |
``a`` replaces the deprecated ``x`` argument. | |
.. versionchanged:: 2 | |
``c`` replaces the deprecated ``z`` argument. | |
File: ~/dev/astropy/<ipython-input-7-be7dccec6dfa> | |
Type: function | |
In [17]: @deprecated_renamed_argument(['x', 'y', 'z'], 'test', '1.2', arg_in_kwargs=True) | |
...: def test(a, b, c): | |
...: """Test func""" | |
...: return a, b, c | |
...: | |
In [18]: test(x=1, y=2, z=3) | |
WARNING: AstropyDeprecationWarning: "x" was deprecated in version 1 and will be removed in a future version. Use argument "t" instead. [astropy.utils.decorators] | |
WARNING: AstropyDeprecationWarning: "y" was deprecated in version . and will be removed in a future version. Use argument "e" instead. [astropy.utils.decorators] | |
WARNING: AstropyDeprecationWarning: "z" was deprecated in version 2 and will be removed in a future version. Use argument "s" instead. [astropy.utils.decorators] | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-18-36d99f04d144> in <module>() | |
----> 1 test(x=1, y=2, z=3) | |
/home/simon/dev/astropy/astropy/utils/decorators.py in wrapper(*args, **kwargs) | |
515 # one with the name of the new argument to the function | |
516 kwargs[new_name[i]] = value | |
--> 517 return function(*args, **kwargs) | |
518 | |
519 return wrapper | |
TypeError: test() got an unexpected keyword argument 'e' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment