Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

IndentationError on line continuations for numpydoc #437

Closed
@anntzer

Description

@anntzer

as of pydocstyle 5.0.1:

class T:

    def foo(self, x):
        """
        Does foo.

        Parameters
        ----------
        x : {'some', 'value', 'and', 'more', 'values', \
'numpydoc', 'says', 'they', 'have', 'to', 'fit', 'in', 'one', 'line'}
        """

analyzing with --convention=numpy results in

Traceback (most recent call last):
  File "/usr/bin/pydocstyle", line 11, in <module>
    load_entry_point('pydocstyle==5.0.1', 'console_scripts', 'pydocstyle')()
  File "/usr/lib/python3.8/site-packages/pydocstyle/cli.py", line 68, in main
    sys.exit(run_pydocstyle())
  File "/usr/lib/python3.8/site-packages/pydocstyle/cli.py", line 44, in run_pydocstyle
    errors.extend(check((filename,), select=checked_codes,
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 968, in check
    for error in ConventionChecker().check_source(source, filename,
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 123, in check_source
    for error in errors:
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 915, in check_docstring_sections
    found_numpy = yield from self._check_numpy_sections(lines, definition, docstring)
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 879, in _check_numpy_sections
    yield from self._check_numpy_section(docstring, definition, ctx)
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 693, in _check_numpy_section
    yield from cls._check_parameters_section(docstring, definition, context)
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 731, in _check_parameters_section
    yield from ConventionChecker._check_missing_args(docstring_args, definition)
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 762, in _check_missing_args
    function_args = get_function_args(definition.source)
  File "/usr/lib/python3.8/site-packages/pydocstyle/checker.py", line 1002, in get_function_args
    function_arg_node = ast.parse(textwrap.dedent(function_string)).body[0].args
  File "/usr/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    def foo(self, x):
    ^
IndentationError: unexpected indent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions