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.
This commit is contained in:
parent
cab083eb57
commit
ee2ae2a9d3
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue