首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >斯芬克斯-带有拿破仑的自动文档(Google样式):关于块引号和缩进的警告和错误

斯芬克斯-带有拿破仑的自动文档(Google样式):关于块引号和缩进的警告和错误
EN

Stack Overflow用户
提问于 2022-03-06 22:13:32
回答 1查看 632关注 0票数 1

我正在使用Sphinx4.4.0和拿破仑扩展()。我有两个问题

  • ARNING: Block quote ends without a blank line; unexpected unindent.
  • ERROR: Unexpected indentation.

我在网上找到了一些关于它的东西,但不能符合这两个我的代码。我的问题是我甚至不理解这些信息。我看不出问题出在哪里。

这是代码:

代码语言:javascript
运行
复制
def read_and_validate_csv(basename, specs_and_rules):
    """Read a CSV file with respect to specifications about format and
    rules about valid values.

    Hints: Do not use objects of type type (e.g. str instead of "str") when
    specificing the column type.

        specs_and_rules = {
            'TEMPLATES': {
                 'T1l': ('Int16', [-9, ' '])
                 },
             'ColumnA': 'str',
             'ColumnB': ('str', 'no answer'),
             'ColumnC': None,
             'ColumnD': (
                 'Int16',
                 -9, {
                     'len': [1, 2, (4-8)],
                     'val': [0, 1, (3-9)]
                 }
             }

    Returns:
        (pandas.DataFrame): Result.

    """

这是最初的信息:

代码语言:javascript
运行
复制
.../bandas.py:docstring of buhtzology.bandas.read_and_validate_csv:11: WARNING: Block quote ends without a blank line; unexpected unindent.
.../bandas.py:docstring of buhtzology.bandas.read_and_validate_csv:15: ERROR: Unexpected indentation.
.../bandas.py:docstring of buhtzology.bandas.read_and_validate_csv:17: ERROR: Unexpected indentation.
.../bandas.py:docstring of buhtzology.bandas.read_and_validate_csv:19: WARNING: Block quote ends without a blank line; unexpected unindent.
.../bandas.py:docstring of buhtzology.bandas.read_and_validate_csv:20: WARNING: Block quote ends without a blank line; unexpected unindent.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-07 09:08:11

reStructuredText不是标记,单独缩进也不足以划分代码块。reStructuredText称之为文字块。虽然使用::是一种选择,但您可能希望通过使用指令显式指定语言(覆盖默认值)。

我还注意到,代码块中有无效的语法--缺少)和缩进中的额外空格--这可能导致这些错误。

尝尝这个。

代码语言:javascript
运行
复制
def read_and_validate_csv(basename, specs_and_rules):
    """Read a CSV file with respect to specifications about format and
    rules about valid values.

    Hints: Do not use objects of type type (e.g. str instead of "str") when
    specificing the column type.

    ..  code-block:: python

        specs_and_rules = {
            'TEMPLATES': {
                 'T1l': ('Int16', [-9, ' '])
                 },
            'ColumnA': 'str',
            'ColumnB': ('str', 'no answer'),
            'ColumnC': None,
            'ColumnD': (
                'Int16',
                -9, {
                    'len': [1, 2, (4-8)],
                    'val': [0, 1, (3-9)]
                }
            )
        }

    Returns:
        (pandas.DataFrame): Result.

    """
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71374618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档