diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2009-10-25 10:11:23 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2009-10-25 10:11:23 +0000 |
commit | 8dc57cd463d7ed28b1ec7bdd87a6e2f930f54dda (patch) | |
tree | 7931a6c1306b98ac5aadf733aba580371df22a12 /numpy/lib/utils.py | |
parent | 11de890bdf5d91179cd9f75062e27a89a5f9fffb (diff) | |
download | numpy-8dc57cd463d7ed28b1ec7bdd87a6e2f930f54dda.tar.gz |
Add backward compatible `deprecate_with_doc`.
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index a967dfb6a..e030abf4f 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -7,8 +7,9 @@ from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype from numpy.core import product, ndarray __all__ = ['issubclass_', 'get_numpy_include', 'issubsctype', - 'issubdtype', 'deprecate', 'get_numarray_include', - 'get_include', 'info', 'source', 'who', 'lookfor', + 'issubdtype', 'deprecate', 'deprecate_with_doc', + 'get_numarray_include', 'get_include', + 'info', 'source', 'who', 'lookfor', 'byte_bounds', 'may_share_memory', 'safe_eval'] def get_include(): @@ -198,10 +199,18 @@ def deprecate(*args, **kwargs): fn = args[0] args = args[1:] + # backward compatibility -- can be removed + # after next release + if 'newname' in kwargs: + kwargs['new_name'] = kwargs.pop('newname') + if 'oldname' in kwargs: + kwargs['old_name'] = kwargs.pop('oldname') + return _Deprecate(*args, **kwargs)(fn) else: return _Deprecate(*args, **kwargs) +deprecate_with_doc = lambda msg: _Deprecate(message=msg) get_numpy_include = deprecate(get_include, 'get_numpy_include', 'get_include') |