Skip to content

Module docstrings aren't formatted, unlike other docstrings #3493

@yilei

Description

@yilei

Example: https://black.vercel.app/?version=main&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4ADgAHldAD2IimZxl1N_Wk8FsJZhkAjhyjG3tVjxJ9Gp9Zojsi1i8DVq3VtVGWVA4en-neQWZRs0Yby6Rh486UwtT5kSyua0nvj17KQw7tG7Ya2GvmqWyx6rvshnP2g3A9E7w_INJJXQ8vt9s7PWaZ1j-sQaPDU8Y6Oj32p-9QAAAAAAuYXePL9oFb0AAZUB4QEAAPc2n9yxxGf7AgAAAAAEWVo=

"""This is a module docstring.


"""


def func():
    """This is a func docstring.
    
    
    """

is formatted to:

"""This is a module docstring.


"""


def func():
    """This is a func docstring."""

From what I can tell, this is because is_docstring(leaf) returns False for the module doc here, so this looks like a bug, not an intentional design choice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: docstringsHow we format docstringsT: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions