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,
17 if True: raise RuntimeError
22 exec('new-style exec', {}, {})
24 async def coroutine(arg, exec=False):
25 'Single-line docstring. Multiline is harder to reformat.'
26 async with some_connection() as conn:
27 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
28 await asyncio.sleep(1)
34 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
35 return text[number:-1]
37 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r''):
38 offset = attr.ib(default=attr.Factory( lambda: _r.uniform(10000, 200000)))
39 assert task._cancel_stack[:len(old_stack)] == old_stack
40 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''): ...
41 def spaces2(result= _core.Value(None)):
50 .query(models.Customer.id)\
51 .filter(models.Customer.account_id == account_id,
52 models.Customer.email == email_address)\
53 .order_by(models.Customer.id.asc())\
56 def off_and_on_without_data():
57 """All comments here are technically on the same prefix.
59 The comments between will be formatted. This is a known limitation.
69 def on_and_off_broken():
70 """Another known limitation."""
73 this=should.not_be.formatted()
75 because . the . handling . inside . generate_ignored_nodes()
76 doesnt . consider . ordering . within . one . prefix
80 gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
87 _type_comment_re = re.compile(
95 (?<!ignore) # note: this will force the non-greedy + in <type> to match
96 # a trailing space which is why we need the silliness below
97 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
98 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
99 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
108 re.MULTILINE|re.VERBOSE
111 def single_literal_yapf_disable():
112 """Black does not support this."""
119 "Default", "address",
120 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
121 xxxxxx="xx_xxxxx", xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
122 xxxxxxxxx_xxxx=True, xxxxxxxx_xxxxxxxxxx=False,
123 xxxxxx_xxxxxx=2, xxxxxx_xxxxx_xxxxxxxx=70, xxxxxx_xxxxxx_xxxxx=True,
125 xxxxxxx_xxxxxxxxxxxx={
129 "xxxx_xxxxxx": "xxxxx",
134 "xxxx_xxxxxx": "xxxxxx",
138 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5
141 # No formatting to the end of the file
149 #!/usr/bin/env python3
153 from third_party import X, Y, Z
155 from library import some_connection, some_decorator
158 from third_party import (X,
165 if True: raise RuntimeError
170 exec('new-style exec', {}, {})
172 async def coroutine(arg, exec=False):
173 'Single-line docstring. Multiline is harder to reformat.'
174 async with some_connection() as conn:
175 await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
176 await asyncio.sleep(1)
182 def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
183 return text[number:-1]
185 def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
186 offset = attr.ib(default=attr.Factory(lambda: _r.uniform(10000, 200000)))
187 assert task._cancel_stack[: len(old_stack)] == old_stack
197 g: int = 1 if False else 2,
204 def spaces2(result=_core.Value(None)):
214 def example(session):
217 .query(models.Customer.id)\
218 .filter(models.Customer.account_id == account_id,
219 models.Customer.email == email_address)\
220 .order_by(models.Customer.id.asc())\
225 def off_and_on_without_data():
226 """All comments here are technically on the same prefix.
228 The comments between will be formatted. This is a known limitation.
232 # hey, that won't work
238 def on_and_off_broken():
239 """Another known limitation."""
242 this = should.not_be.formatted()
243 but = it is formatted
244 because.the.handling.inside.generate_ignored_nodes()
245 doesnt.consider.ordering.within.one.prefix
250 typedargslist.extend(
251 gen_annotated_params(
253 ast_args.kw_defaults,
255 implicit_default=True,
260 unnecessary_bracket()
263 _type_comment_re = re.compile(
271 (?<!ignore) # note: this will force the non-greedy + in <type> to match
272 # a trailing space which is why we need the silliness below
273 (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
274 (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
275 (?<!ignore[ ]{9})(?<!ignore[ ]{10})
284 re.MULTILINE|re.VERBOSE
289 def single_literal_yapf_disable():
290 """Black does not support this."""
291 BAZ = {(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)} # yapf: disable
297 xxxx_xxxx=["xxx-xxxxxx-xxxxxxxxxx"],
299 xxxxxxx="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
301 xxxxxxxx_xxxxxxxxxx=False,
303 xxxxxx_xxxxx_xxxxxxxx=70,
304 xxxxxx_xxxxxx_xxxxx=True,
306 xxxxxxx_xxxxxxxxxxxx={
310 "xxxx_xxxxxx": "xxxxx",
315 "xxxx_xxxxxx": "xxxxxx",
319 xxxxxxxxxx_xxxxxxxxxxx_xxxxxxx_xxxxxxxxx=5,
322 # No formatting to the end of the file