summaryrefslogtreecommitdiff
path: root/deprecation.py
diff options
context:
space:
mode:
Diffstat (limited to 'deprecation.py')
-rw-r--r--deprecation.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/deprecation.py b/deprecation.py
index db0829a..4b2c3f4 100644
--- a/deprecation.py
+++ b/deprecation.py
@@ -71,7 +71,7 @@ def class_moved(new_class, old_name=None, message=None):
old_name, new_class.__module__, new_class.__name__)
return class_renamed(old_name, new_class, message)
-def deprecated(reason=None, stacklevel=2):
+def deprecated(reason=None, stacklevel=2, name=None, doc=None):
"""Decorator that raises a DeprecationWarning to print a message
when the decorated function is called.
"""
@@ -83,10 +83,10 @@ def deprecated(reason=None, stacklevel=2):
warn(message, DeprecationWarning, stacklevel=stacklevel)
return func(*args, **kwargs)
try:
- wrapped.__name__ = func.__name__
+ wrapped.__name__ = name or func.__name__
except TypeError: # readonly attribute in 2.3
pass
- wrapped.__doc__ = func.__doc__
+ wrapped.__doc__ = doc or func.__doc__
return wrapped
return deprecated_decorator