Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub files: style shouldn't change when inside "if" statements #2785

Closed
Akuli opened this issue Jan 19, 2022 · 1 comment
Closed

Stub files: style shouldn't change when inside "if" statements #2785

Akuli opened this issue Jan 19, 2022 · 1 comment
Labels
T: style What do we want Blackened code to look like?

Comments

@Akuli
Copy link

Akuli commented Jan 19, 2022

Describe the style change

In stub files (.pyi), do not add/remove blank lines depending on whether code is under if statements.

Examples in the current Black style

class A:
    def foo(self) -> None: ...

class B:
    def foo(self) -> None: ...

if sys.platform == "linux":
    class A:
        def foo(self) -> None: ...
    class B:
        def foo(self) -> None: ...

Desired style

class A:
    def foo(self) -> None: ...

class B:
    def foo(self) -> None: ...

if sys.platform == "linux":
    class A:
        def foo(self) -> None: ...

    class B:
        def foo(self) -> None: ...

Additional context

The current behavior makes many typeshed PRs unreadable. When reviewing PRs like this, I usually have to recreate the changes of the PR myself and diff my results against what's in the PR.

@Akuli Akuli added the T: style What do we want Blackened code to look like? label Jan 19, 2022
@hauntsaninja
Copy link
Collaborator

:-) I went through the exact same steps as you and filed #2784 an hour ago

@Akuli Akuli closed this as completed Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants