2017-09-19 16 views
0

私は以下のことをどのように達成できるのでしょうか?私はnumpyのdocstringスタイルとsphinx autodocを組み合わせて自動化されたドキュメントを生成しています。しかし、私は出力にネストされたリストを有することをstruggelingだ:numpy docstringにネストされたリストをスフィンクスdocstringと組み合わせて正しく追加する方法

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 

このドキュメント文字列の出力がオフに完了です。スフィンクスは完全な機能を認識し、独立してから二行目扱いしません。また、ここで

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

:これは、関数の記述が複数行にまたがる別のもののために属性1

ためのリストを認識しません最初。

フォーマットに問題がありますか?

+0

'sphinx.ext.napoleon'(http://www.sphinx-doc.org/en/stable/ext/napoleon.html)を使用していますか? – mzjn

+0

@mzjnはい、それは正しい、私はナポレオンを使用しています。 – math

答えて

1

NumPy docstrings in Napoleonでは、コロンの両側にスペースが必要です。これを試してみてください:

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 

それが動作するかどうexample NumPy stringsは段落のみがサポートされていることを示しているように私は、知りません。リストについては何も言及していません。

+0

あなたの答えに感謝します。残念ながら、これは問題を解決しません。私は本当にそのような場合にリストを含めることが可能かどうか疑問に思っています – math

+0

少なくとも結腸の両側にスペースを入れましたか?また、私は[ソースコード](https://bitbucket.org/RobRuana/sphinx-contrib/src/a311ef7908cb1cca880dcc32aae89a297ab21e0c/napoleon/sphinxcontrib/napoleon/docstring.py?at=default&fileviewer=file-view-default#docstring)を見ました。 py-28)、箇条書きリストがサポートされているようです。私は最初の項目の2行目のインデントに問題があると思います。これは私がちょうど編集で修正したものです。 –

関連する問題