Skip to content

Formatter adds unnecessary parentheses around return type annotations #6431

@charliermarsh

Description

@charliermarsh

Contrived example:

def handleMatch(self, m: Match[str], data: str) -> Union[Tuple[None, None, None], Tuple[None, None, None], Tuple[Element, int, int], Tuple[Element, int, int]]:
    pass

Ruff:

def handleMatch(self, m: Match[str], data: str) -> (
    Union[
        Tuple[None, None, None],
        Tuple[None, None, None],
        Tuple[Element, int, int],
        Tuple[Element, int, int],
    ]
):
    pass

Black:

def handleMatch(
    self, m: Match[str], data: str
) -> Union[
    Tuple[None, None, None],
    Tuple[None, None, None],
    Tuple[Element, int, int],
    Tuple[Element, int, int],
]:
    pass

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions