]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/black/tests/data/cases/pep604_union_types_line_breaks.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '882d8795c6ff65c02f2657e596391748d1b6b7f5'
[etc/vim.git] / .vim / bundle / black / tests / data / cases / pep604_union_types_line_breaks.py
1 # flags: --preview --minimum-version=3.10
2 # This has always worked
3 z= Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong
4
5 # "AnnAssign"s now also work
6 z: Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong
7 z: (Short
8     | Short2
9     | Short3
10     | Short4)
11 z: (int)
12 z: ((int))
13
14
15 z: Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong | Loooooooooooooooooooooooong = 7
16 z: (Short
17     | Short2
18     | Short3
19     | Short4) = 8
20 z: (int) = 2.3
21 z: ((int)) = foo()
22
23 # In case I go for not enforcing parantheses, this might get improved at the same time
24 x = (
25     z
26     == 9999999999999999999999999999999999999999
27     | 9999999999999999999999999999999999999999
28     | 9999999999999999999999999999999999999999
29     | 9999999999999999999999999999999999999999,
30     y
31     == 9999999999999999999999999999999999999999
32     + 9999999999999999999999999999999999999999
33     + 9999999999999999999999999999999999999999
34     + 9999999999999999999999999999999999999999,
35 )
36
37 x = (
38     z == (9999999999999999999999999999999999999999
39     | 9999999999999999999999999999999999999999
40     | 9999999999999999999999999999999999999999
41     | 9999999999999999999999999999999999999999),
42     y == (9999999999999999999999999999999999999999
43     + 9999999999999999999999999999999999999999
44     + 9999999999999999999999999999999999999999
45     + 9999999999999999999999999999999999999999),
46 )
47
48 # handle formatting of "tname"s in parameter list
49
50 # remove unnecessary paren
51 def foo(i: (int)) -> None: ...
52
53
54 # this is a syntax error in the type annotation according to mypy, but it's not invalid *python* code, so make sure we don't mess with it and make it so.
55 def foo(i: (int,)) -> None: ...
56
57 def foo(
58     i: int,
59     x: Loooooooooooooooooooooooong
60     | Looooooooooooooooong
61     | Looooooooooooooooooooong
62     | Looooooong,
63     *,
64     s: str,
65 ) -> None:
66     pass
67
68
69 @app.get("/path/")
70 async def foo(
71     q: str
72     | None = Query(None, title="Some long title", description="Some long description")
73 ):
74     pass
75
76
77 def f(
78     max_jobs: int
79     | None = Option(
80         None, help="Maximum number of jobs to launch. And some additional text."
81         ),
82     another_option: bool = False
83     ):
84     ...
85
86
87 # output
88 # This has always worked
89 z = (
90     Loooooooooooooooooooooooong
91     | Loooooooooooooooooooooooong
92     | Loooooooooooooooooooooooong
93     | Loooooooooooooooooooooooong
94 )
95
96 # "AnnAssign"s now also work
97 z: (
98     Loooooooooooooooooooooooong
99     | Loooooooooooooooooooooooong
100     | Loooooooooooooooooooooooong
101     | Loooooooooooooooooooooooong
102 )
103 z: Short | Short2 | Short3 | Short4
104 z: int
105 z: int
106
107
108 z: (
109     Loooooooooooooooooooooooong
110     | Loooooooooooooooooooooooong
111     | Loooooooooooooooooooooooong
112     | Loooooooooooooooooooooooong
113 ) = 7
114 z: Short | Short2 | Short3 | Short4 = 8
115 z: int = 2.3
116 z: int = foo()
117
118 # In case I go for not enforcing parantheses, this might get improved at the same time
119 x = (
120     z
121     == 9999999999999999999999999999999999999999
122     | 9999999999999999999999999999999999999999
123     | 9999999999999999999999999999999999999999
124     | 9999999999999999999999999999999999999999,
125     y
126     == 9999999999999999999999999999999999999999
127     + 9999999999999999999999999999999999999999
128     + 9999999999999999999999999999999999999999
129     + 9999999999999999999999999999999999999999,
130 )
131
132 x = (
133     z
134     == (
135         9999999999999999999999999999999999999999
136         | 9999999999999999999999999999999999999999
137         | 9999999999999999999999999999999999999999
138         | 9999999999999999999999999999999999999999
139     ),
140     y
141     == (
142         9999999999999999999999999999999999999999
143         + 9999999999999999999999999999999999999999
144         + 9999999999999999999999999999999999999999
145         + 9999999999999999999999999999999999999999
146     ),
147 )
148
149 # handle formatting of "tname"s in parameter list
150
151
152 # remove unnecessary paren
153 def foo(i: int) -> None: ...
154
155
156 # this is a syntax error in the type annotation according to mypy, but it's not invalid *python* code, so make sure we don't mess with it and make it so.
157 def foo(i: (int,)) -> None: ...
158
159
160 def foo(
161     i: int,
162     x: (
163         Loooooooooooooooooooooooong
164         | Looooooooooooooooong
165         | Looooooooooooooooooooong
166         | Looooooong
167     ),
168     *,
169     s: str,
170 ) -> None:
171     pass
172
173
174 @app.get("/path/")
175 async def foo(
176     q: str | None = Query(
177         None, title="Some long title", description="Some long description"
178     )
179 ):
180     pass
181
182
183 def f(
184     max_jobs: int | None = Option(
185         None, help="Maximum number of jobs to launch. And some additional text."
186     ),
187     another_option: bool = False,
188 ): ...