astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.87k stars 1.1k forks source link

Split long stringified type annotations #13479

Open MichaReiser opened 1 month ago

MichaReiser commented 1 month ago

Black automatically splits long stringified type annotations:

def test() -> "aaaaaaaaaaaaaaaaaaaa | Bbbbbbbbbbbbbbbbbbbbbbbbbbbbb | cccccccccccccccccccccccc | ddddddddddddddddddddddd":
        pass

Output

def test() -> (
    "aaaaaaaaaaaaaaaaaaaa | Bbbbbbbbbbbbbbbbbbbbbbbbbbbbb | cccccccccccccccccccccccc"
    | "ddddddddddddddddddddddd"
):
    pass
MichaReiser commented 1 week ago

Note, this is an unstable preview style