From ee2ae2a9d309132ad7ad2a354f4e3926377634d9 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 3 Oct 2014 20:02:20 -0700 Subject: [PATCH] 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. --- retrying.py | 4 ++++ 1 file changed, 4 insertions(+) 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)