Skip to content

Formatter: Preserve leading empty lines of indented classes and functions #6066

@konstin

Description

@konstin

While the behavior for empty lines before top level classes and functions looks correct, indented classes and function can gain or lose their leading newlines

black:

def f():
    ...
    # comment

    class Meta:
        pass

    if True:

        def register_type():
            pass

ours:

def f():
    ...

    # comment

    class Meta:
        pass

    if True:
        def register_type():
            pass

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions