Skip to content

Incorrectly dedenting class documentation (non PEP-257-compliant) #54

@jaredkhan

Description

@jaredkhan

Leading whitespace on class comments is not stripped correctly when the first line of text is on the same line as the triple-quotes.

A class like the following:

class A:
     """This is a class.
     
     More words here.
     """
     pass

ends up having whitespace stripped to look like this:

This is a class.

    More words here.

whereas this is expected:

This is a class.

More words here.

The intended behaviour is specified in PEP-257: Docstring Conventions > Handling Docstring Indentation and implemented in inspect.cleandoc (which is called by inspect.getdoc)

This is only a problem for classes, since elsewhere pytkdocs does use inspect.getdoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocstringsDocstrings parsing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions