繁体   English   中英

如何在结合sphinx docstring的numpy docstring中正确添加嵌套列表

[英]how to correctly add nested list in numpy docstring in combination with sphinx docstring

我想知道如何实现以下目标。 我将numpy docstring样式与sphinx autodoc结合使用以生成自动文档。 但是,我正在努力在输出中具有嵌套列表:

Attributes
----------
attribute 1: pandas data frame
    * `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'
attribute 2: `int`
    nice and sunny days in California

此文档字符串的输出已完成。 它无法识别属性1的列表。

另一方面,函数描述跨越多行:

def generate_temp(self, n, freq, very_long_variable_name,
                  type_temp=None, method=None):

同样在这里,狮身人面像无法识别完整的功能,因此与第一行独立对待第二行。

我的格式有什么问题?

在拿破仑中使用NumPy文档字符串时 ,您需要在冒号的两侧都有一个空格。 尝试这个:

Attributes
----------
attribute 1 : pandas data frame
    * `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'
attribute 2 : `int`
    nice and sunny days in California

我不知道这是否行得通,因为示例NumPy字符串表明仅支持段落。 它没有提及列表。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM