summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-10-03 20:02:20 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-10-03 20:02:22 -0700
commitee2ae2a9d309132ad7ad2a354f4e3926377634d9 (patch)
tree3c7457c6f7a6baf52a3e2e987578c36c880e528c
parentcab083eb5791615fadbc0c98ad77a70d64b77d0d (diff)
downloadretrying-ee2ae2a9d309132ad7ad2a354f4e3926377634d9.tar.gz
Ensure we wrap the decorated functions
To avoid losing the original functions docs, name and other attributes ensure that this correctly uses six.wraps (which uses functools.wraps internally) to wrap the decorated function.
-rw-r--r--retrying.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/retrying.py b/retrying.py
index 9f0a2a0..7a00a8d 100644
--- a/retrying.py
+++ b/retrying.py
@@ -55,6 +55,8 @@ def retry(*dargs, **dkw):
# support both @retry and @retry() as valid syntax
if len(dargs) == 1 and callable(dargs[0]):
def wrap_simple(f):
+
+ @six.wraps(f)
def wrapped_f(*args, **kw):
return Retrying().call(f, *args, **kw)
@@ -64,6 +66,8 @@ def retry(*dargs, **dkw):
else:
def wrap(f):
+
+ @six.wraps(f)
def wrapped_f(*args, **kw):
return Retrying(*dargs, **dkw).call(f, *args, **kw)