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

Addition of type ignore causes undesirable splitting on another line #3681

Open
hauntsaninja opened this issue May 6, 2023 · 0 comments
Open
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? T: bug Something isn't working

Comments

@hauntsaninja
Copy link
Collaborator

This is the original version of the code:

Playground

def one():
    def two():
        def three():
            _zzzzzzz_zzzz_zzzz_zzzz(
                zzz.getZZZZZZZZZZZZZZZZZ("zzz_zzz_zzzz_zzzz")[0].getZZZZZZZZZZZZZZZZZ(
                    "zzzzzzz_zzzz_zzz"
                )[0]
            )

Black is quite content with this.

However, if you add a # type: ignore on line 5:

Playground

def one():
    def two():
        def three():
            _zzzzzzz_zzzz_zzzz_zzzz(
                zzz.getZZZZZZZZZZZZZZZZZ("zzz_zzz_zzzz_zzzz")[0].getZZZZZZZZZZZZZZZZZ(  # type: ignore
                    "zzzzzzz_zzzz_zzz"
                )[0]
            )

Black suddenly wants to split line 7:

def one():
    def two():
        def three():
            _zzzzzzz_zzzz_zzzz_zzzz(
                zzz.getZZZZZZZZZZZZZZZZZ("zzz_zzz_zzzz_zzzz")[0].getZZZZZZZZZZZZZZZZZ(  # type: ignore
                    "zzzzzzz_zzzz_zzz"
                )[
                    0
                ]
            )
@hauntsaninja hauntsaninja added the T: bug Something isn't working label May 6, 2023
@ichard26 ichard26 added F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? labels May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. F: linebreak How should we split up lines? T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants