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,
212 if True: raise RuntimeError
217 exec('new-style exec', {}, {})
219 async def coroutine(arg, exec=False):
220 'Single-line docstring. Multiline is harder to reformat.'
221 async with some_connection() as conn:
222 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
223 await asyncio.sleep(1)
229 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
230 return text[number:-1]
232 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
233 offset = attr.ib(default=attr.Factory(lambda: _r.uniform(1, 2)))
234 assert task._cancel_stack[: len(old_stack)] == old_stack
244 g: int = 1 if False else 2,
251 def spaces2(result=_core.Value(None)):
272 def import_as_names():
274 from hello import a, b
279 def testlist_star_expr():
298 def example(session):
301 .query(models.Customer.id)\
302 .filter(models.Customer.account_id == account_id,
303 models.Customer.email == email_address)\
304 .order_by(models.Customer.id.asc())\
309 def off_and_on_without_data():
310 """All comments here are technically on the same prefix.
312 The comments between will be formatted. This is a known limitation.
316 # hey, that won't work
322 def on_and_off_broken():
323 """Another known limitation."""
326 this=should.not_be.formatted()
327 and_=indeed . it is not formatted
328 because . the . handling . inside . generate_ignored_nodes()
329 now . considers . multiple . fmt . directives . within . one . prefix
332 # ...but comments still get reformatted even though they should not be
338 typedargslist.extend(
339 gen_annotated_params(
341 ast_args.kw_defaults,
343 implicit_default=True,
348 unnecessary_bracket()
351 _type_comment_re = re.compile(
359 (?<!ignore) # note: this will force the non-greedy + in <type> to match
360 # a trailing space which is why we need the silliness below
361 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
362 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
363 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
372 re.MULTILINE|re.VERBOSE
377 def single_literal_yapf_disable():
378 """Black does not support this."""
379 BAZ = {(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)} # yapf: disable
385 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
387 xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
389 xxxxxxxx_xxxxxxxxxx=False,
391 xxxxxx_xxxxx_xxxxxxxx=70,
392 xxxxxx_xxxxxx_xxxxx=True,
394 xxxxxxx_xxxxxxxxxxxx={
398 "xxxx_xxxxxx": "xxxxx",
403 "xxxx_xxxxxx": "xxxxxx",
407 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
411 # No formatting to the end of the file