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)):
54 .query(models.Customer.id)\
55 .filter(models.Customer.account_id == account_id,
56 models.Customer.email == email_address)\
57 .order_by(models.Customer.id.asc())\
60 def off_and_on_without_data():
61 """All comments here are technically on the same prefix.
63 The comments between will be formatted. This is a known limitation.
73 def on_and_off_broken():
74 """Another known limitation."""
77 this=should.not_be.formatted()
79 because . the . handling . inside . generate_ignored_nodes()
80 doesnt . consider . ordering . within . one . prefix
84 gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
91 _type_comment_re = re.compile(
99 (?<!ignore) # note: this will force the non-greedy + in <type> to match
100 # a trailing space which is why we need the silliness below
101 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
102 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
103 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
112 re.MULTILINE|re.VERBOSE
115 def single_literal_yapf_disable():
116 """Black does not support this."""
123 "Default", "address",
124 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
125 xxxxxx="xx_xxxxx", xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
126 xxxxxxxxx_xxxx=True, xxxxxxxx_xxxxxxxxxx=False,
127 xxxxxx_xxxxxx=2, xxxxxx_xxxxx_xxxxxxxx=70, xxxxxx_xxxxxx_xxxxx=True,
129 xxxxxxx_xxxxxxxxxxxx={
133 "xxxx_xxxxxx": "xxxxx",
138 "xxxx_xxxxxx": "xxxxxx",
142 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5
145 # No formatting to the end of the file
153 #!/usr/bin/env python3
157 from third_party import X, Y, Z
159 from library import some_connection, some_decorator
162 from third_party import (X,
173 if True: raise RuntimeError
178 exec('new-style exec', {}, {})
180 async def coroutine(arg, exec=False):
181 'Single-line docstring. Multiline is harder to reformat.'
182 async with some_connection() as conn:
183 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
184 await asyncio.sleep(1)
190 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
191 return text[number:-1]
193 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
194 offset = attr.ib(default=attr.Factory(lambda: _r.uniform(10000, 200000)))
195 assert task._cancel_stack[: len(old_stack)] == old_stack
205 g: int = 1 if False else 2,
212 def spaces2(result=_core.Value(None)):
222 def example(session):
225 .query(models.Customer.id)\
226 .filter(models.Customer.account_id == account_id,
227 models.Customer.email == email_address)\
228 .order_by(models.Customer.id.asc())\
233 def off_and_on_without_data():
234 """All comments here are technically on the same prefix.
236 The comments between will be formatted. This is a known limitation.
240 # hey, that won't work
246 def on_and_off_broken():
247 """Another known limitation."""
250 this = should.not_be.formatted()
251 but = it is formatted
252 because.the.handling.inside.generate_ignored_nodes()
253 doesnt.consider.ordering.within.one.prefix
258 typedargslist.extend(
259 gen_annotated_params(
261 ast_args.kw_defaults,
263 implicit_default=True,
268 unnecessary_bracket()
271 _type_comment_re = re.compile(
279 (?<!ignore) # note: this will force the non-greedy + in <type> to match
280 # a trailing space which is why we need the silliness below
281 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
282 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
283 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
292 re.MULTILINE|re.VERBOSE
297 def single_literal_yapf_disable():
298 """Black does not support this."""
299 BAZ = {(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)} # yapf: disable
305 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
307 xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
309 xxxxxxxx_xxxxxxxxxx=False,
311 xxxxxx_xxxxx_xxxxxxxx=70,
312 xxxxxx_xxxxxx_xxxxx=True,
314 xxxxxxx_xxxxxxxxxxxx={
318 "xxxx_xxxxxx": "xxxxx",
323 "xxxx_xxxxxx": "xxxxxx",
327 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
330 # No formatting to the end of the file