reStructuredText 字段列表的正确缩进是什么?

问题描述 投票:0回答:0

我有一个包含三个字段的字段列表的文档字符串:

        """``DataCatalog`` stores instances of ``AbstractDataSet``.

        Args:
            data_sets: A dictionary of data set names and data set instances.
            feed_dict: A feed dict with data to be added in memory.
            catalog: A dictionary whose keys are the data set names and
                the values are dictionaries with the constructor arguments
                for classes implementing ``AbstractDataSet``. The data set
                class to be loaded is specified with the key ``type`` and their
                fully qualified class name. All ``kedro.io`` data set can be
                specified by their class name only, i.e. their module name
                can be omitted.

然而,Sphinx 和

flake8-rst-docstrings
抱怨在第三个参数的换行处有“意外缩进”。

我设法修复它的方法是......在所有字段中添加换行:

        """``DataCatalog`` stores instances of ``AbstractDataSet``
        implementations to provide ``load`` and ``save`` capabilities from
        anywhere in the program. To use a ``DataCatalog``, you need to
        instantiate it with a dictionary of data sets. Then it will act as a
        single point of reference for your calls, relaying load and save
        functions to the underlying data sets.

        Args:
            data_sets: A dictionary of data set names and data set instances.
                INDENT.
            feed_dict: A feed dict with data to be added in memory.
                INDENT.
            catalog: A dictionary whose keys are the data set names and
                the values are dictionaries with the constructor arguments
                for classes implementing ``AbstractDataSet``. The data set
                class to be loaded is specified with the key ``type`` and their
                fully qualified class name. All ``kedro.io`` data set can be
                specified by their class name only, i.e. their module name
                can be omitted.

但显然我不想那样做。编写此文档字符串的正确方法是什么?

python documentation sphinx restructuredtext docstring
© www.soinside.com 2019 - 2024. All rights reserved.