From d40288496c18d86d16f8aad144e8cf57c46dd3bf Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 6 Jun 2015 04:05:23 +0200 Subject: [PATCH] Show original autodoc signatures Alternative to #1403 --- docs/conf.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 922f2f7e..285c8981 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -269,3 +269,24 @@ except ImportError, e: pygments_style = 'tango' html_theme = 'default' html_theme_options = {} + + +# unwrap decorators +def unwrap_decorators(): + import sphinx.util.inspect as inspect + import functools + + old_getargspec = inspect.getargspec + def getargspec(x): + return old_getargspec(getattr(x, '_original_function', x)) + inspect.getargspec = getargspec + + old_update_wrapper = functools.update_wrapper + def update_wrapper(wrapper, wrapped, *a, **kw): + rv = old_update_wrapper(wrapper, wrapped, *a, **kw) + rv._original_function = wrapped + return rv + functools.update_wrapper = update_wrapper + +unwrap_decorators() +del unwrap_decorators