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

Change List[...] formatting on function parameter type-hints #1386

Closed
jacobchrismarsh opened this issue May 7, 2020 · 1 comment
Closed
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?

Comments

@jacobchrismarsh
Copy link

When a function has enough arguments to put each parameter on its own line, and one of those parameters is a List, Set, etc. with a default argument that is not the correct type, it gets very gross looking.

Examples in the current Black style Think of some short code snippets that show
how the current Black style is not great:

Problematic style

def foo(
    really_long_arg_1_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: int,
    string_arg: List[
        str
    ] = "some_really_long_string..........................................",
) -> int:
    return 0

Desired style How do you think Black should format the above snippets:

def foo(
    really_long_arg_1_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: int,
    string_arg: List[str] = (
        "some_really_long_string.........................................."
    ),
) -> int:
    return 0

This is a unique case, but it is gross formatting nonetheless

@jacobchrismarsh jacobchrismarsh added the T: style What do we want Blackened code to look like? label May 7, 2020
@JelleZijlstra JelleZijlstra added the F: linebreak How should we split up lines? label May 30, 2021
@JelleZijlstra
Copy link
Collaborator

Duplicate of #1765

@JelleZijlstra JelleZijlstra marked this as a duplicate of #1765 Jan 29, 2022
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants