sphinx/tests/roots/test-ext-autodoc/target/decorator.py
Takeshi KOMIYA 6d05b1aeb3 Fix #8105: autodoc: the signature of decorated class is incorrect
In #7651, autodoc stops to undecorate the functions on getting the
signature from the callables.  But some kinds of decorators conceals
the correct signature because they pass through their arguments via
`(*args, **kwargs)`.

This restarts to undecorate the functions again as before #7651.
2020-11-05 01:57:40 +09:00

54 lines
766 B
Python

from functools import wraps
def deco1(func):
"""docstring for deco1"""
@wraps(func)
def wrapper():
return func()
return wrapper
def deco2(condition, message):
"""docstring for deco2"""
def decorator(func):
def wrapper():
return func()
return wrapper
return decorator
@deco1
def foo(name=None, age=None):
pass
class Bar:
@deco1
def meth(self, name=None, age=None):
pass
class Baz:
@deco1
def __init__(self, name=None, age=None):
pass
class Qux:
@deco1
def __new__(self, name=None, age=None):
pass
class _Metaclass(type):
@deco1
def __call__(self, name=None, age=None):
pass
class Quux(metaclass=_Metaclass):
pass