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.
5 from third_party import X, Y, Z
7 from library import some_connection, \
10 from third_party import (X,
21 if True: raise RuntimeError
26 exec('new-style exec', {}, {})
28 async def coroutine(arg, exec=False):
29 'Single-line docstring. Multiline is harder to reformat.'
30 async with some_connection() as conn:
31 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
32 await asyncio.sleep(1)
38 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
39 return text[number:-1]
41 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r''):
42 offset = attr.ib(default=attr.Factory( lambda: _r.uniform(1, 2)))
43 assert task._cancel_stack[:len(old_stack)] == old_stack
44 def spaces_types(a: int = 1, b: tuple = (), c: list = [], d: dict = {}, e: bool = True, f: int = -1, g: int = 1 if False else 2, h: str = "", i: str = r''): ...
45 def spaces2(result= _core.Value(None)):
61 def import_as_names():
63 from hello import a, b
67 def testlist_star_expr():
87 .query(models.Customer.id)\
88 .filter(models.Customer.account_id == account_id,
89 models.Customer.email == email_address)\
90 .order_by(models.Customer.id.asc())\
93 def off_and_on_without_data():
94 """All comments here are technically on the same prefix.
96 The comments between will be formatted. This is a known limitation.
101 #hey, that won't work
106 def on_and_off_broken():
107 """Another known limitation."""
110 this=should.not_be.formatted()
111 and_=indeed . it is not formatted
112 because . the . handling . inside . generate_ignored_nodes()
113 now . considers . multiple . fmt . directives . within . one . prefix
116 # ...but comments still get reformatted even though they should not be
120 typedargslist.extend(
121 gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
125 unnecessary_bracket()
128 _type_comment_re = re.compile(
136 (?<!ignore) # note: this will force the non-greedy + in <type> to match
137 # a trailing space which is why we need the silliness below
138 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
139 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
140 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
149 re.MULTILINE|re.VERBOSE
152 def single_literal_yapf_disable():
153 """Black does not support this."""
160 "Default", "address",
161 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
162 xxxxxx="xx_xxxxx", xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
163 xxxxxxxxx_xxxx=True, xxxxxxxx_xxxxxxxxxx=False,
164 xxxxxx_xxxxxx=2, xxxxxx_xxxxx_xxxxxxxx=70, xxxxxx_xxxxxx_xxxxx=True,
166 xxxxxxx_xxxxxxxxxxxx={
170 "xxxx_xxxxxx": "xxxxx",
175 "xxxx_xxxxxx": "xxxxxx",
179 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5
183 # No formatting to the end of the file
191 #!/usr/bin/env python3
195 from third_party import X, Y, Z
197 from library import some_connection, some_decorator
200 from third_party import (X,
211 if True: raise RuntimeError
216 exec('new-style exec', {}, {})
218 async def coroutine(arg, exec=False):
219 'Single-line docstring. Multiline is harder to reformat.'
220 async with some_connection() as conn:
221 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
222 await asyncio.sleep(1)
228 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
229 return text[number:-1]
231 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
232 offset = attr.ib(default=attr.Factory(lambda: _r.uniform(1, 2)))
233 assert task._cancel_stack[: len(old_stack)] == old_stack
243 g: int = 1 if False else 2,
250 def spaces2(result=_core.Value(None)):
271 def import_as_names():
273 from hello import a, b
278 def testlist_star_expr():
297 def example(session):
300 .query(models.Customer.id)\
301 .filter(models.Customer.account_id == account_id,
302 models.Customer.email == email_address)\
303 .order_by(models.Customer.id.asc())\
308 def off_and_on_without_data():
309 """All comments here are technically on the same prefix.
311 The comments between will be formatted. This is a known limitation.
315 # hey, that won't work
321 def on_and_off_broken():
322 """Another known limitation."""
325 this=should.not_be.formatted()
326 and_=indeed . it is not formatted
327 because . the . handling . inside . generate_ignored_nodes()
328 now . considers . multiple . fmt . directives . within . one . prefix
331 # ...but comments still get reformatted even though they should not be
337 typedargslist.extend(
338 gen_annotated_params(
340 ast_args.kw_defaults,
342 implicit_default=True,
347 unnecessary_bracket()
350 _type_comment_re = re.compile(
358 (?<!ignore) # note: this will force the non-greedy + in <type> to match
359 # a trailing space which is why we need the silliness below
360 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
361 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
362 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
371 re.MULTILINE|re.VERBOSE
376 def single_literal_yapf_disable():
377 """Black does not support this."""
378 BAZ = {(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)} # yapf: disable
384 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
386 xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
388 xxxxxxxx_xxxxxxxxxx=False,
390 xxxxxx_xxxxx_xxxxxxxx=70,
391 xxxxxx_xxxxxx_xxxxx=True,
393 xxxxxxx_xxxxxxxxxxxx={
397 "xxxx_xxxxxx": "xxxxx",
402 "xxxx_xxxxxx": "xxxxxx",
406 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
410 # No formatting to the end of the file