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

Black formats union arguments with default call value weirdly #3296

Closed
zmievsa opened this issue Sep 28, 2022 · 1 comment
Closed

Black formats union arguments with default call value weirdly #3296

zmievsa opened this issue Sep 28, 2022 · 1 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?

Comments

@zmievsa
Copy link

zmievsa commented Sep 28, 2022

Examples in the current Black style

def some_fastapi_route(
    some_header: str
    | None = Header(
        None,
        some_helpful_description="Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn",
    ),
):
    ...

Desired style

def some_fastapi_route(
    some_header: str | None = Header(
        None,
        some_helpful_description="Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn",
    ),
):
    ...

Additional context

Here's how black formats the same snippet without the new Union syntax:

def some_fastapi_route(
    some_header: Optional[str] = Header(
        None,
        some_helpful_description="Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn",
    ),
):
    ...
@zmievsa zmievsa added the T: style What do we want Blackened code to look like? label Sep 28, 2022
@ichard26 ichard26 added R: duplicate This issue or pull request already exists F: linebreak How should we split up lines? labels Sep 28, 2022
@ichard26
Copy link
Collaborator

Hey thanks for filing a style issue! I appreciate the feedback, but this is mostly a duplicate of #2316 so I'll be closing this in favour of that.

@ichard26 ichard26 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 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

2 participants