google / yapf

A formatter for Python files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Split type hints with trailing comma

b-chu opened this issue · comments

Type hints aren't being split on separate lines even though arguments are. What's the correct setting to get consistent formatting?

Incorrect

argument: Optional[Union[SomeType,
                   Tuple[SomeType, int],
                   Sequence[Union[SomeType, Tuple[SomeType, int]]],
                  ]] = None,

Correct

argument: Optional[Union[
    SomeType,
    Tuple[SomeType, int],
    Sequence[Union[SomeType, Tuple[SomeType, int]]],
]] = None,