簡體   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