我试图使用Sphinx来记录我的Python类.我这样做是使用autodoc:
.. autoclass:: Bus
:members:
Run Code Online (Sandbox Code Playgroud)
虽然它正确地获取我的方法的文档字符串,那些装饰:
@checkStale
def open(self):
"""
Some docs.
"""
# Code
Run Code Online (Sandbox Code Playgroud)
与@checkStale存在
def checkStale(f):
@wraps(f)
def newf(self, *args, **kwargs):
if self._stale:
raise Exception
return f(self, *args, **kwargs)
return newf
Run Code Online (Sandbox Code Playgroud)
有一个不正确的原型,如open(*args, **kwargs).
我怎样才能解决这个问题?我的印象是使用@wraps会修复这种事情.