python-sphinx – 是否有可能在sphinx.ext.napoleon中有一个参数
发布时间:2020-12-20 13:20:17 所属栏目:Python 来源:网络整理
导读:我正在使用sphinx autodoc扩展和sphinx.ext.napoleon.我正在关注numpydoc风格指南,因为我认为它比谷歌更具可读性.但是,我注意到以下无法解决的问题. 我有以下问题.是否可以在参数部分(或返回等)中允许列表?我希望有类似的东西: 更新我根据Steve Piercy的回
我正在使用sphinx autodoc扩展和sphinx.ext.napoleon.我正在关注numpydoc风格指南,因为我认为它比谷歌更具可读性.但是,我注意到以下无法解决的问题.
我有以下问题.是否可以在参数部分(或返回等)中允许列表?我希望有类似的东西: 更新我根据Steve Piercy的回答删除了一些初步问题.这是python文件: class Test: def f(param_1,param_2): r""" This is a test docstring. Parameters ---------- param_1 : pandas data frame This would be really cool to allow the following list and make it more readable: * **index:** Array-like,integer valued representing days. Has to be sorted and increasing. * **dtype:** float64. Value of temperature. * **columns:** location description,e.g. 'San Diego' param_2 : int nice number! """ pass 不幸的是,这仍然存在这样的问题:“这将是…”的字体太大而不是像param_2一样放在param_1旁边: 如果我删除子弹列表,我会得到一个正确的输出.将上面的代码更改为: class Test: def f(param_1,param_2): r""" This is a test docstring. Parameters ---------- param_1 : pandas data frame This would be really cool to allow the following list and make it more readable: **index:** Array-like,integer valued representing days. Has to be sorted and increasing. **dtype:** float64. Value of temperature. **columns:** location description,e.g. 'San Diego' param_2 : int nice number! """ pass 这导致以下正确的输出: 生成文档的.rst文件很简单: .. automethod:: test.Test.f 如果我使用numpydoc而不是sphinx.ext.napleon,我似乎得到了正确的输出: 至少“pandas data frame”和“This ….”的字体是相同的.然而,我更喜欢拿破仑风格,一切都较小,一开始没有灰线. 最后还要在子弹点之前删除空白行没有帮助.它变得更糟: 解决方法
看起来你没有关注
example NumPy Style Python Docstrings.
>参数名称中不能有空格.> Python类型应该是有效的(我不确定“pandas数据框”>参数2上方不应有空行 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |