]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/black/tests/data/cases/remove_await_parens.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 / remove_await_parens.py
1 import asyncio
2
3 # Control example
4 async def main():
5     await asyncio.sleep(1)
6
7 # Remove brackets for short coroutine/task
8 async def main():
9     await (asyncio.sleep(1))
10
11 async def main():
12     await (
13         asyncio.sleep(1)
14     )
15
16 async def main():
17     await (asyncio.sleep(1)
18     )
19
20 # Check comments
21 async def main():
22     await (  # Hello
23         asyncio.sleep(1)
24     )
25
26 async def main():
27     await (
28         asyncio.sleep(1)  # Hello
29     )
30
31 async def main():
32     await (
33         asyncio.sleep(1)
34     )  # Hello
35
36 # Long lines
37 async def main():
38     await asyncio.gather(asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1))
39
40 # Same as above but with magic trailing comma in function
41 async def main():
42     await asyncio.gather(asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1),)
43
44 # Cr@zY Br@ck3Tz
45 async def main():
46     await (
47         (((((((((((((
48         (((        (((
49         (((         (((
50         (((         (((
51         (((        (((
52         ((black(1)))
53         )))        )))
54         )))         )))
55         )))         )))
56         )))        )))
57         )))))))))))))
58     )
59
60 # Keep brackets around non power operations and nested awaits
61 async def main():
62     await (set_of_tasks | other_set)
63
64 async def main():
65     await (await asyncio.sleep(1))
66
67 # It's awaits all the way down...
68 async def main():
69     await (await x)
70
71 async def main():
72     await (yield x)
73
74 async def main():
75     await (await (asyncio.sleep(1)))
76
77 async def main():
78     await (await (await (await (await (asyncio.sleep(1))))))
79
80 async def main():
81     await (yield)
82
83 # output
84 import asyncio
85
86
87 # Control example
88 async def main():
89     await asyncio.sleep(1)
90
91
92 # Remove brackets for short coroutine/task
93 async def main():
94     await asyncio.sleep(1)
95
96
97 async def main():
98     await asyncio.sleep(1)
99
100
101 async def main():
102     await asyncio.sleep(1)
103
104
105 # Check comments
106 async def main():
107     await asyncio.sleep(1)  # Hello
108
109
110 async def main():
111     await asyncio.sleep(1)  # Hello
112
113
114 async def main():
115     await asyncio.sleep(1)  # Hello
116
117
118 # Long lines
119 async def main():
120     await asyncio.gather(
121         asyncio.sleep(1),
122         asyncio.sleep(1),
123         asyncio.sleep(1),
124         asyncio.sleep(1),
125         asyncio.sleep(1),
126         asyncio.sleep(1),
127         asyncio.sleep(1),
128     )
129
130
131 # Same as above but with magic trailing comma in function
132 async def main():
133     await asyncio.gather(
134         asyncio.sleep(1),
135         asyncio.sleep(1),
136         asyncio.sleep(1),
137         asyncio.sleep(1),
138         asyncio.sleep(1),
139         asyncio.sleep(1),
140         asyncio.sleep(1),
141     )
142
143
144 # Cr@zY Br@ck3Tz
145 async def main():
146     await black(1)
147
148
149 # Keep brackets around non power operations and nested awaits
150 async def main():
151     await (set_of_tasks | other_set)
152
153
154 async def main():
155     await (await asyncio.sleep(1))
156
157
158 # It's awaits all the way down...
159 async def main():
160     await (await x)
161
162
163 async def main():
164     await (yield x)
165
166
167 async def main():
168     await (await asyncio.sleep(1))
169
170
171 async def main():
172     await (await (await (await (await asyncio.sleep(1)))))
173
174
175 async def main():
176     await (yield)