我试图使用Sphinx中的autodoc打印特定模块中每个函数的docstring,但不包括模块的docstring。有可能吗?
原因是我使用模块docstring来指定命令行选项(带有可爱的docopt)。
发布于 2013-08-03 08:44:01
向conf.py添加以下内容
def remove_module_docstring(app, what, name, obj, options, lines):
if what == "module" and name == "yourmodule":
del lines[:]
def setup(app):
app.connect("autodoc-process-docstring", remove_module_docstring)此代码通过为yourmodule事件提供一个处理程序来删除自动文档-进程-docstring模块中的模块docstring。
https://stackoverflow.com/questions/17927741
复制相似问题