Module docstrings aren't formatted, unlike other docstrings · Issue #3493 · psf/black (original) (raw)

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?