Skip to content

Commit d402884

Browse files
committed
Show original autodoc signatures
Alternative to pallets#1403
1 parent 7a999cd commit d402884

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

docs/conf.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,24 @@
269269
pygments_style = 'tango'
270270
html_theme = 'default'
271271
html_theme_options = {}
272+
273+
274+
# unwrap decorators
275+
def unwrap_decorators():
276+
import sphinx.util.inspect as inspect
277+
import functools
278+
279+
old_getargspec = inspect.getargspec
280+
def getargspec(x):
281+
return old_getargspec(getattr(x, '_original_function', x))
282+
inspect.getargspec = getargspec
283+
284+
old_update_wrapper = functools.update_wrapper
285+
def update_wrapper(wrapper, wrapped, *a, **kw):
286+
rv = old_update_wrapper(wrapper, wrapped, *a, **kw)
287+
rv._original_function = wrapped
288+
return rv
289+
functools.update_wrapper = update_wrapper
290+
291+
unwrap_decorators()
292+
del unwrap_decorators

0 commit comments

Comments
 (0)