我想出了一个猴子补丁
functools.wraps。因此,我只是将其添加到了
conf.py项目文档的sphinx
source文件夹中的脚本中:
# Monkey-patch functools.wrapsimport functoolsdef no_op_wraps(func): """Replaces functools.wraps in order to undo wrapping. Can be used to preserve the decorated function's signature in the documentation generated by Sphinx. """ def wrapper(decorator): return func return wrapperfunctools.wraps = no_op_wraps
因此,当通过构建html页面时
makehtml,
functools.wraps此装饰器
no_op_wraps将替换它,该装饰器仅返回原始函数就什么也不做。



