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(10000, 200000)))
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()
112 because . the . handling . inside . generate_ignored_nodes()
113 doesnt . consider . ordering . within . one . prefix
116 typedargslist.extend(
117 gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
121 unnecessary_bracket()
124 _type_comment_re = re.compile(
132 (?<!ignore) # note: this will force the non-greedy + in <type> to match
133 # a trailing space which is why we need the silliness below
134 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
135 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
136 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
145 re.MULTILINE|re.VERBOSE
148 def single_literal_yapf_disable():
149 """Black does not support this."""
156 "Default", "address",
157 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
158 xxxxxx="xx_xxxxx", xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
159 xxxxxxxxx_xxxx=True, xxxxxxxx_xxxxxxxxxx=False,
160 xxxxxx_xxxxxx=2, xxxxxx_xxxxx_xxxxxxxx=70, xxxxxx_xxxxxx_xxxxx=True,
162 xxxxxxx_xxxxxxxxxxxx={
166 "xxxx_xxxxxx": "xxxxx",
171 "xxxx_xxxxxx": "xxxxxx",
175 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5
179 # No formatting to the end of the file
187 #!/usr/bin/env python3
191 from third_party import X, Y, Z
193 from library import some_connection, some_decorator
196 from third_party import (X,
207 if True: raise RuntimeError
212 exec('new-style exec', {}, {})
214 async def coroutine(arg, exec=False):
215 'Single-line docstring. Multiline is harder to reformat.'
216 async with some_connection() as conn:
217 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
218 await asyncio.sleep(1)
224 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
225 return text[number:-1]
227 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
228 offset = attr.ib(default=attr.Factory(lambda: _r.uniform(10000, 200000)))
229 assert task._cancel_stack[: len(old_stack)] == old_stack
239 g: int = 1 if False else 2,
246 def spaces2(result=_core.Value(None)):
267 def import_as_names():
269 from hello import a, b
274 def testlist_star_expr():
293 def example(session):
296 .query(models.Customer.id)\
297 .filter(models.Customer.account_id == account_id,
298 models.Customer.email == email_address)\
299 .order_by(models.Customer.id.asc())\
304 def off_and_on_without_data():
305 """All comments here are technically on the same prefix.
307 The comments between will be formatted. This is a known limitation.
311 # hey, that won't work
317 def on_and_off_broken():
318 """Another known limitation."""
321 this = should.not_be.formatted()
322 but = it is formatted
323 because.the.handling.inside.generate_ignored_nodes()
324 doesnt.consider.ordering.within.one.prefix
329 typedargslist.extend(
330 gen_annotated_params(
332 ast_args.kw_defaults,
334 implicit_default=True,
339 unnecessary_bracket()
342 _type_comment_re = re.compile(
350 (?<!ignore) # note: this will force the non-greedy + in <type> to match
351 # a trailing space which is why we need the silliness below
352 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
353 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
354 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
363 re.MULTILINE|re.VERBOSE
368 def single_literal_yapf_disable():
369 """Black does not support this."""
370 BAZ = {(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)} # yapf: disable
376 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
378 xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
380 xxxxxxxx_xxxxxxxxxx=False,
382 xxxxxx_xxxxx_xxxxxxxx=70,
383 xxxxxx_xxxxxx_xxxxx=True,
385 xxxxxxx_xxxxxxxxxxxx={
389 "xxxx_xxxxxx": "xxxxx",
394 "xxxx_xxxxxx": "xxxxxx",
398 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
402 # No formatting to the end of the file