Skip to content

Blank lines at top level code in stubs should be the same inside an if #2784

@hauntsaninja

Description

@hauntsaninja

Describe the style change

Blank lines should be treated the same in top-level code under an if-statement as in top-level code proper

Examples in the current Black style

class A:
    def f(self): ...

class B:
    def f(self): ...

if sys.version_info >= (3, 8):
    class C:
        def f(self): ...
    class D:
        def f(self): ...

Desired style

class A:
    def f(self): ...

class B:
    def f(self): ...

if sys.version_info >= (3, 8):
    class C:
        def f(self): ...

    class D:
        def f(self): ...

Additional context

Playground link

Similar to / discussed in #2783

Metadata

Metadata

Assignees

No one assigned

    Labels

    S: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedT: 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