【发布时间】:2021-02-24 00:54:53
【问题描述】:
我正在尝试记录一个具有一些类级成员变量的 Python 类,但我无法使用 reST/Sphinx 对其进行适当记录。
代码是这样的:
class OSM:
"""Some blah and examples"""
url = 'http://overpass-api.de/api/interpreter' # URL of the Overpass API
sleep_time = 10 # pause between successive queries when assembling OSM dataset
但是我得到了这个输出(参见绿色圆圈区域,我想在其中有一些描述两个变量的文本,如上所述)。
我为模糊道歉,但部分示例有些敏感
【问题讨论】:
-
您需要在文档字符串中记录它们,而不是使用代码 cmets。见sphinx-doc.org/en/master/usage/extensions/autodoc.html
标签: python-sphinx restructuredtext docstring autodoc sphinx-napoleon