]> git.madduck.net Git - etc/vim.git/blob - tests/data/long_strings__regression.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

33bf14cfaa3e1a1886f863f859ec8dee698d4eef
[etc/vim.git] / tests / data / long_strings__regression.py
1 class A:
2     def foo():
3         result = type(message)("")
4
5
6 # Don't merge multiline (e.g. triple-quoted) strings.
7 def foo():
8     query = (
9         """SELECT xxxxxxxxxxxxxxxxxxxx(xxx)"""
10         """ FROM xxxxxxxxxxxxxxxx WHERE xxxxxxxxxx AND xxx <> xxxxxxxxxxxxxx()""")
11
12 # There was a bug where tuples were being identified as long strings.
13 long_tuple = ('Apple', 'Berry', 'Cherry', 'Dill', 'Evergreen', 'Fig',
14            'Grape', 'Harry', 'Iglu', 'Jaguar')
15
16 stupid_format_method_bug = "Some really long string that just so happens to be the {} {} to force the 'format' method to hang over the line length boundary. This is pretty annoying.".format("perfect", "length")
17
18 class A:
19     def foo():
20         os.system("This is a regression test. xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxxx.".format("xxxxxxxxxx", "xxxxxx", "xxxxxxxxxx"))
21
22
23 class A:
24     def foo():
25         XXXXXXXXXXXX.append(
26             (
27                 "xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx, xxxx_xxxx_xxxxxxxxxx={})".format(
28                     xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx
29                 ),
30                 my_var,
31                 my_other_var,
32             )
33         )
34
35 class A:
36     class B:
37         def foo():
38             bar(
39                 (
40                     "[{}]: xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx={}"
41                     " xxxx_xxxx_xxxxxxxxxx={}, xxxx={})"
42                     .format(xxxx._xxxxxxxxxxxxxx, xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx, xxxxxxx)
43                 ),
44                 varX,
45                 varY,
46                 varZ,
47             )
48
49 def foo(xxxx):
50     for (xxx_xxxx, _xxx_xxx, _xxx_xxxxx, xxx_xxxx) in xxxx:
51         for xxx in xxx_xxxx:
52             assert ("x" in xxx) or (
53                 xxx in xxx_xxx_xxxxx
54             ), "{0} xxxxxxx xx {1}, xxx {1} xx xxx xx xxxx xx xxx xxxx: xxx xxxx {2}".format(
55                 xxx_xxxx, xxx, xxxxxx.xxxxxxx(xxx_xxx_xxxxx)
56             )
57
58 class A:
59     def disappearing_comment():
60         return (
61             (  # xx -x xxxxxxx xx xxx xxxxxxx.
62                 '{{xxx_xxxxxxxxxx_xxxxxxxx}} xxx xxxx'
63                 ' {} {{xxxx}} >&2'
64                 .format(
65                     "{xxxx} {xxxxxx}"
66                     if xxxxx.xx_xxxxxxxxxx
67                     else ( # Disappearing Comment
68                         "--xxxxxxx --xxxxxx=x --xxxxxx-xxxxx=xxxxxx"
69                         " --xxxxxx-xxxx=xxxxxxxxxxx.xxx"
70                     )
71                 )
72             ),
73             (x, y, z),
74         )
75
76 class A:
77     class B:
78         def foo():
79             xxxxx_xxxx(
80                 xx, "\t"
81                 "@xxxxxx '{xxxx_xxx}\t' > {xxxxxx_xxxx}.xxxxxxx;"
82                 "{xxxx_xxx} >> {xxxxxx_xxxx}.xxxxxxx 2>&1; xx=$$?;"
83                 "xxxx $$xx"
84                 .format(xxxx_xxx=xxxx_xxxxxxx, xxxxxx_xxxx=xxxxxxx + "/" + xxxx_xxx_xxxx, x=xxx_xxxxx_xxxxx_xxx),
85                 x,
86                 y,
87                 z,
88             )
89
90 func_call_where_string_arg_has_method_call_and_bad_parens(
91     (
92         "A long string with {}. This string is so long that it is ridiculous. It can't fit on one line at alllll.".format("formatting")
93     ),
94 )
95
96 func_call_where_string_arg_has_old_fmt_and_bad_parens(
97     (
98         "A long string with {}. This string is so long that it is ridiculous. It can't fit on one line at alllll." % "formatting"
99     ),
100 )
101
102 func_call_where_string_arg_has_old_fmt_and_bad_parens(
103     (
104         "A long string with {}. This {} is so long that it is ridiculous. It can't fit on one line at alllll." % ("formatting", "string")
105     ),
106 )
107
108 class A:
109     def append(self):
110         if True:
111             xxxx.xxxxxxx.xxxxx( ('xxxxxxxxxx xxxx xx xxxxxx(%x) xx %x xxxx xx xxx %x.xx'
112                                  % (len(self) + 1,
113                                     xxxx.xxxxxxxxxx,
114                                     xxxx.xxxxxxxxxx))
115                                 + (' %.3f (%s) to %.3f (%s).\n'
116                                    % (xxxx.xxxxxxxxx,
117                                       xxxx.xxxxxxxxxxxxxx(xxxx.xxxxxxxxx),
118                                       x,
119                                       xxxx.xxxxxxxxxxxxxx( xx)
120                                       )))
121
122 class A:
123     def foo():
124         some_func_call(
125             'xxxxxxxxxx',
126             (
127                 "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
128                 "\"xxxx xxxxxxx xxxxxx xxxx; xxxx xxxxxx_xxxxx xxxxxx xxxx; "
129                 "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" "
130             ),
131             None,
132             ('xxxxxxxxxxx',),
133         ),
134
135 class A:
136     def foo():
137         some_func_call(
138             (
139                 "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
140                 "xxxx, ('xxxxxxx xxxxxx xxxx, xxxx') xxxxxx_xxxxx xxxxxx xxxx; "
141                 "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" "
142             ),
143             None,
144             ('xxxxxxxxxxx',),
145         ),
146
147 xxxxxxx = { 'xx' : 'xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} \
148 -xx {1} -xx xxx=xxx_xxxx,xxx_xx,xxx_xxx,xxx_xxxx,xxx_xx,xxx_xxx |\
149  xxxxxx -x xxxxxxxx -x xxxxxxxx -x',
150          'xx' : 'xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} \
151 -xx {1} -xx xxx=xxx_xxxx_xxx_xxxx,xxx_xx_xxx_xxxx,xxx_xxxx_xxx_xxxx,\
152 xxx_xx_xxxx_xxxx,xxx_xxx_xxxx,xxx_xxx_xxxx xxxx=xxx | xxxxxx -x xxxxxxxx -x xxxxxxxx -x'
153 }
154
155 class A:
156     def foo(self):
157         if True:
158             xxxxx_xxxxxxxxxxxx('xxx xxxxxx xxx xxxxxxxxx.xx xx xxxxxxxx.  xxx xxxxxxxxxxxxx.xx xxxxxxx '
159                                + 'xx xxxxxx xxxxxx xxxxxx xx xxxxxxx xxx xxx ${0} xx x xxxxxxxx xxxxx'.xxxxxx(xxxxxx_xxxxxx_xxx))
160
161 class A:
162     class B:
163         def foo():
164             row = {
165                 'xxxxxxxxxxxxxxx' : xxxxxx_xxxxx_xxxx,
166                 # 'xxxxxxxxxxxxxxxxxxxxxxx'
167                 # 'xxxxxxxxxxxxxxxxxxxxxx'
168                 # 'xxxxxxxxxxxxxxxxxx'
169                 # 'xxxxxxxxxxxxxxxxx'
170                 'xxxxxxxxxx' : xxxxx_xxxxx,
171                 }
172
173 class A:
174     def xxxx_xxx_xx_xxxxxxxxxx_xxxx_xxxxxxxxx(xxxx):
175         xxxxxxxx = [
176             xxxxxxxxxxxxxxxx(
177                 'xxxx',
178                 xxxxxxxxxxx={
179                     'xxxx' : 1.0,
180                 },
181                 xxxxxx={'xxxxxx 1' : xxxxxx(xxxx='xxxxxx 1', xxxxxx=600.0)},
182                 xxxxxxxx_xxxxxxx=0.0,
183             ),
184             xxxxxxxxxxxxxxxx(
185                 'xxxxxxx',
186                 xxxxxxxxxxx={
187                     'xxxx' : 1.0,
188                 },
189                 xxxxxx={'xxxxxx 1' : xxxxxx(xxxx='xxxxxx 1', xxxxxx=200.0)},
190                 xxxxxxxx_xxxxxxx=0.0,
191             ),
192             xxxxxxxxxxxxxxxx(
193                 'xxxx',
194             ),
195         ]
196
197 some_dictionary = {
198     'xxxxx006': ['xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx== xxxxx000 xxxxxxxxxx\n',
199                  'xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx== xxxxx010 xxxxxxxxxx\n'],
200     'xxxxx016': ['xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx== xxxxx000 xxxxxxxxxx\n',
201                  'xxx-xxx xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx== xxxxx010 xxxxxxxxxx\n']
202 }
203
204 def foo():
205     xxx_xxx = (
206         'xxxx xxx xxxxxxxx_xxxx xx "xxxxxxxxxx".'
207         '\n xxx: xxxxxx xxxxxxxx_xxxx=xxxxxxxxxx'
208     ) # xxxx xxxxxxxxxx xxxx xx xxxx xx xxx xxxxxxxx xxxxxx xxxxx.
209
210 some_tuple = ("some string", "some string" " which should be joined")
211
212 some_commented_string = (
213     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # This comment gets thrown to the top.
214     " {} that I just can't think of any more good words to say about it at"
215     " allllllllllll".format("ha")  # comments here are fine
216 )
217
218 some_commented_string = (
219     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # But these
220     " {} that I just can't think of any more good words to say about it at"  # comments will stay
221     " allllllllllll".format("ha")  # comments here are fine
222 )
223
224 lpar_and_rpar_have_comments = func_call(  # LPAR Comment
225     "Long really ridiculous type of string that shouldn't really even exist at all. I mean commmme onnn!!!",  # Comma Comment
226 )  # RPAR Comment
227
228 cmd_fstring = (
229     f"sudo -E deluge-console info --detailed --sort-reverse=time_added "
230     f"{'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
231 )
232
233 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
234
235 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {'{{}}' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
236
237 cmd_fstring = f"sudo -E deluge-console info --detailed --sort-reverse=time_added {{'' if ID is None else ID}} | perl -nE 'print if /^{field}:/'"
238
239 fstring = f"This string really doesn't need to be an {{{{fstring}}}}, but this one most certainly, absolutely {does}."
240
241 fstring = (
242     f"We have to remember to escape {braces}."
243     " Like {these}."
244     f" But not {this}."
245 )
246
247 class A:
248     class B:
249         def foo():
250             st_error = STError(
251                 f"This string ({string_leaf.value}) appears to be pointless (i.e. has"
252                 " no parent)."
253             )
254
255 def foo():
256     user_regex = _lazy_re_compile(
257         r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"  # dot-atom
258         r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)',  # quoted-string
259         re.IGNORECASE)
260
261 def foo():
262     user_regex = _lazy_re_compile(
263         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
264         'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  # quoted-string
265         xyz
266     )
267
268 def foo():
269     user_regex = _lazy_re_compile(
270         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
271         'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',  # quoted-string
272         xyz
273     )
274
275 class A:
276     class B:
277         def foo():
278             if not hasattr(module, name):
279                 raise ValueError(
280                     "Could not find object %s in %s.\n"
281                     "Please note that you cannot serialize things like inner "
282                     "classes. Please move the object into the main module "
283                     "body to use migrations.\n"
284                     "For more information, see "
285                     "https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
286                     % (name, module_name, get_docs_version()))
287
288 class A:
289     class B:
290         def foo():
291             if not hasattr(module, name):
292                 raise ValueError(
293                     "Could not find object %s in %s.\nPlease note that you cannot serialize things like inner classes. Please move the object into the main module body to use migrations.\nFor more information, see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
294                     % (name, module_name, get_docs_version()))
295
296 x = (
297     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
298     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
299     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
300     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
301 )
302
303 class Step(StepBase):
304     def who(self):
305         self.cmd = 'SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name} {title}/P{passenger_association}'.format(
306             last_name=last_name,
307             first_name=first_name,
308             middle_name=middle_name,
309             title=title,
310             passenger_association=passenger_association,
311         )
312
313 if __name__ == "__main__":
314     for i in range(4, 8):
315         cmd = (
316             r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk '{print $2}'); do kill $pid; done"
317             % (i)
318         )
319
320 # output
321
322
323 class A:
324     def foo():
325         result = type(message)("")
326
327
328 # Don't merge multiline (e.g. triple-quoted) strings.
329 def foo():
330     query = (
331         """SELECT xxxxxxxxxxxxxxxxxxxx(xxx)"""
332         """ FROM xxxxxxxxxxxxxxxx WHERE xxxxxxxxxx AND xxx <> xxxxxxxxxxxxxx()"""
333     )
334
335
336 # There was a bug where tuples were being identified as long strings.
337 long_tuple = (
338     "Apple",
339     "Berry",
340     "Cherry",
341     "Dill",
342     "Evergreen",
343     "Fig",
344     "Grape",
345     "Harry",
346     "Iglu",
347     "Jaguar",
348 )
349
350 stupid_format_method_bug = (
351     "Some really long string that just so happens to be the {} {} to force the 'format'"
352     " method to hang over the line length boundary. This is pretty annoying.".format(
353         "perfect", "length"
354     )
355 )
356
357
358 class A:
359     def foo():
360         os.system(
361             "This is a regression test. xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx"
362             " xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx"
363             " xxxx.".format("xxxxxxxxxx", "xxxxxx", "xxxxxxxxxx")
364         )
365
366
367 class A:
368     def foo():
369         XXXXXXXXXXXX.append(
370             (
371                 "xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx, xxxx_xxxx_xxxxxxxxxx={})"
372                 .format(xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx),
373                 my_var,
374                 my_other_var,
375             )
376         )
377
378
379 class A:
380     class B:
381         def foo():
382             bar(
383                 "[{}]: xxx_xxxxxxxxxx(xxxxx={}, xxxx={}, xxxxx={}"
384                 " xxxx_xxxx_xxxxxxxxxx={}, xxxx={})".format(
385                     xxxx._xxxxxxxxxxxxxx, xxxxx, xxxx, xxxx_xxxx_xxxxxxxxxx, xxxxxxx
386                 ),
387                 varX,
388                 varY,
389                 varZ,
390             )
391
392
393 def foo(xxxx):
394     for (xxx_xxxx, _xxx_xxx, _xxx_xxxxx, xxx_xxxx) in xxxx:
395         for xxx in xxx_xxxx:
396             assert ("x" in xxx) or (xxx in xxx_xxx_xxxxx), (
397                 "{0} xxxxxxx xx {1}, xxx {1} xx xxx xx xxxx xx xxx xxxx: xxx xxxx {2}"
398                 .format(xxx_xxxx, xxx, xxxxxx.xxxxxxx(xxx_xxx_xxxxx))
399             )
400
401
402 class A:
403     def disappearing_comment():
404         return (
405             (  # xx -x xxxxxxx xx xxx xxxxxxx.
406                 "{{xxx_xxxxxxxxxx_xxxxxxxx}} xxx xxxx {} {{xxxx}} >&2".format(
407                     "{xxxx} {xxxxxx}"
408                     if xxxxx.xx_xxxxxxxxxx
409                     else (  # Disappearing Comment
410                         "--xxxxxxx --xxxxxx=x --xxxxxx-xxxxx=xxxxxx"
411                         " --xxxxxx-xxxx=xxxxxxxxxxx.xxx"
412                     )
413                 )
414             ),
415             (x, y, z),
416         )
417
418
419 class A:
420     class B:
421         def foo():
422             xxxxx_xxxx(
423                 xx,
424                 "\t"
425                 "@xxxxxx '{xxxx_xxx}\t' > {xxxxxx_xxxx}.xxxxxxx;"
426                 "{xxxx_xxx} >> {xxxxxx_xxxx}.xxxxxxx 2>&1; xx=$$?;"
427                 "xxxx $$xx".format(
428                     xxxx_xxx=xxxx_xxxxxxx,
429                     xxxxxx_xxxx=xxxxxxx + "/" + xxxx_xxx_xxxx,
430                     x=xxx_xxxxx_xxxxx_xxx,
431                 ),
432                 x,
433                 y,
434                 z,
435             )
436
437
438 func_call_where_string_arg_has_method_call_and_bad_parens(
439     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
440     " on one line at alllll.".format("formatting"),
441 )
442
443 func_call_where_string_arg_has_old_fmt_and_bad_parens(
444     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
445     " on one line at alllll." % "formatting",
446 )
447
448 func_call_where_string_arg_has_old_fmt_and_bad_parens(
449     "A long string with {}. This {} is so long that it is ridiculous. It can't fit on"
450     " one line at alllll." % ("formatting", "string"),
451 )
452
453
454 class A:
455     def append(self):
456         if True:
457             xxxx.xxxxxxx.xxxxx(
458                 "xxxxxxxxxx xxxx xx xxxxxx(%x) xx %x xxxx xx xxx %x.xx"
459                 % (len(self) + 1, xxxx.xxxxxxxxxx, xxxx.xxxxxxxxxx)
460                 + " %.3f (%s) to %.3f (%s).\n"
461                 % (
462                     xxxx.xxxxxxxxx,
463                     xxxx.xxxxxxxxxxxxxx(xxxx.xxxxxxxxx),
464                     x,
465                     xxxx.xxxxxxxxxxxxxx(xx),
466                 )
467             )
468
469
470 class A:
471     def foo():
472         some_func_call(
473             "xxxxxxxxxx",
474             "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
475             '"xxxx xxxxxxx xxxxxx xxxx; xxxx xxxxxx_xxxxx xxxxxx xxxx; '
476             "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" ",
477             None,
478             ("xxxxxxxxxxx",),
479         ),
480
481
482 class A:
483     def foo():
484         some_func_call(
485             "xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
486             "xxxx, ('xxxxxxx xxxxxx xxxx, xxxx') xxxxxx_xxxxx xxxxxx xxxx; "
487             "xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" ",
488             None,
489             ("xxxxxxxxxxx",),
490         ),
491
492
493 xxxxxxx = {
494     "xx": (
495         "xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} -xx {1} -xx"
496         " xxx=xxx_xxxx,xxx_xx,xxx_xxx,xxx_xxxx,xxx_xx,xxx_xxx | xxxxxx -x xxxxxxxx -x"
497         " xxxxxxxx -x"
498     ),
499     "xx": (
500         "xxxx xxxxxxx xxxxxxxxx -x xxx -x /xxx/{0} -x xxx,xxx -xx {1} -xx {1} -xx"
501         " xxx=xxx_xxxx_xxx_xxxx,xxx_xx_xxx_xxxx,xxx_xxxx_xxx_xxxx,xxx_xx_xxxx_xxxx,xxx_xxx_xxxx,xxx_xxx_xxxx"
502         " xxxx=xxx | xxxxxx -x xxxxxxxx -x xxxxxxxx -x"
503     ),
504 }
505
506
507 class A:
508     def foo(self):
509         if True:
510             xxxxx_xxxxxxxxxxxx(
511                 "xxx xxxxxx xxx xxxxxxxxx.xx xx xxxxxxxx.  xxx xxxxxxxxxxxxx.xx"
512                 " xxxxxxx "
513                 + "xx xxxxxx xxxxxx xxxxxx xx xxxxxxx xxx xxx ${0} xx x xxxxxxxx xxxxx"
514                 .xxxxxx(xxxxxx_xxxxxx_xxx)
515             )
516
517
518 class A:
519     class B:
520         def foo():
521             row = {
522                 "xxxxxxxxxxxxxxx": xxxxxx_xxxxx_xxxx,
523                 # 'xxxxxxxxxxxxxxxxxxxxxxx'
524                 # 'xxxxxxxxxxxxxxxxxxxxxx'
525                 # 'xxxxxxxxxxxxxxxxxx'
526                 # 'xxxxxxxxxxxxxxxxx'
527                 "xxxxxxxxxx": xxxxx_xxxxx,
528             }
529
530
531 class A:
532     def xxxx_xxx_xx_xxxxxxxxxx_xxxx_xxxxxxxxx(xxxx):
533         xxxxxxxx = [
534             xxxxxxxxxxxxxxxx(
535                 "xxxx",
536                 xxxxxxxxxxx={
537                     "xxxx": 1.0,
538                 },
539                 xxxxxx={"xxxxxx 1": xxxxxx(xxxx="xxxxxx 1", xxxxxx=600.0)},
540                 xxxxxxxx_xxxxxxx=0.0,
541             ),
542             xxxxxxxxxxxxxxxx(
543                 "xxxxxxx",
544                 xxxxxxxxxxx={
545                     "xxxx": 1.0,
546                 },
547                 xxxxxx={"xxxxxx 1": xxxxxx(xxxx="xxxxxx 1", xxxxxx=200.0)},
548                 xxxxxxxx_xxxxxxx=0.0,
549             ),
550             xxxxxxxxxxxxxxxx(
551                 "xxxx",
552             ),
553         ]
554
555
556 some_dictionary = {
557     "xxxxx006": [
558         "xxx-xxx"
559         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx=="
560         " xxxxx000 xxxxxxxxxx\n",
561         "xxx-xxx"
562         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx=="
563         " xxxxx010 xxxxxxxxxx\n",
564     ],
565     "xxxxx016": [
566         "xxx-xxx"
567         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx0xx6xxxxxxxxxx2xxxxxx9xxxxxxxxxx0xxxxx1xxx2x/xx9xx6+x+xxxxxxxxxxxxxx4xxxxxxxxxxxxxxxxxxxxx43xxx2xx2x4x++xxx6xxxxxxxxx+xxxxx/xx9x+xxxxxxxxxxxxxx8x15xxxxxxxxxxxxxxxxx82xx/xxxxxxxxxxxxxx/x5xxxxxxxxxxxxxx6xxxxxx74x4/xxx4x+xxxxxxxxx2xxxxxxxx87xxxxx4xxxxxxxx3xx0xxxxx4xxx1xx9xx5xxxxxxx/xxxxx5xx6xx4xxxx1x/x2xxxxxxxxxxxx64xxxxxxx1x0xx5xxxxxxxxxxxxxx=="
568         " xxxxx000 xxxxxxxxxx\n",
569         "xxx-xxx"
570         " xxxxx3xxxx1xx2xxxxxxxxxxxxxx6xxxxxxxxxxxxxx9xxxxxxxxxxxxx3xxx9xxxxxxxxxxxxxxxx0xxxxxxxxxxxxxxxxx2xxxx2xxx6xxxxx/xx54xxxxxxxxx4xxx3xxxxxx9xx3xxxxx39xxxxxxxxx5xx91xxxx7xxxxxx8xxxxxxxxxxxxxxxx9xxx93xxxxxxxxxxxxxxxxx7xxx8xx8xx4/x1xxxxx1x3xxxxxxxxxxxxx3xxxxxx9xx4xx4x7xxxxxxxxxxxxx1xxxxxxxxx7xxxxxxxxxxxxxx4xx6xxxxxxxxx9xxx7xxxx2xxxxxxxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxxxxx6xx=="
571         " xxxxx010 xxxxxxxxxx\n",
572     ],
573 }
574
575
576 def foo():
577     xxx_xxx = (  # xxxx xxxxxxxxxx xxxx xx xxxx xx xxx xxxxxxxx xxxxxx xxxxx.
578         'xxxx xxx xxxxxxxx_xxxx xx "xxxxxxxxxx".\n xxx: xxxxxx xxxxxxxx_xxxx=xxxxxxxxxx'
579     )
580
581
582 some_tuple = ("some string", "some string which should be joined")
583
584 some_commented_string = (  # This comment gets thrown to the top.
585     "This string is long but not so long that it needs hahahah toooooo be so greatttt"
586     " {} that I just can't think of any more good words to say about it at"
587     " allllllllllll".format("ha")  # comments here are fine
588 )
589
590 some_commented_string = (
591     "This string is long but not so long that it needs hahahah toooooo be so greatttt"  # But these
592     " {} that I just can't think of any more good words to say about it at"  # comments will stay
593     " allllllllllll".format("ha")  # comments here are fine
594 )
595
596 lpar_and_rpar_have_comments = func_call(  # LPAR Comment
597     "Long really ridiculous type of string that shouldn't really even exist at all. I"
598     " mean commmme onnn!!!",  # Comma Comment
599 )  # RPAR Comment
600
601 cmd_fstring = (
602     "sudo -E deluge-console info --detailed --sort-reverse=time_added "
603     f"{'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
604 )
605
606 cmd_fstring = (
607     "sudo -E deluge-console info --detailed --sort-reverse=time_added"
608     f" {'' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
609 )
610
611 cmd_fstring = (
612     "sudo -E deluge-console info --detailed --sort-reverse=time_added"
613     f" {'{{}}' if ID is None else ID} | perl -nE 'print if /^{field}:/'"
614 )
615
616 cmd_fstring = (
617     "sudo -E deluge-console info --detailed --sort-reverse=time_added {'' if ID is"
618     f" None else ID}} | perl -nE 'print if /^{field}:/'"
619 )
620
621 fstring = (
622     "This string really doesn't need to be an {{fstring}}, but this one most"
623     f" certainly, absolutely {does}."
624 )
625
626 fstring = f"We have to remember to escape {braces}. Like {{these}}. But not {this}."
627
628
629 class A:
630     class B:
631         def foo():
632             st_error = STError(
633                 f"This string ({string_leaf.value}) appears to be pointless (i.e. has"
634                 " no parent)."
635             )
636
637
638 def foo():
639     user_regex = _lazy_re_compile(
640         r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*\Z"  # dot-atom
641         r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"\Z)',  # quoted-string
642         re.IGNORECASE,
643     )
644
645
646 def foo():
647     user_regex = _lazy_re_compile(
648         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
649         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",  # quoted-string
650         xyz,
651     )
652
653
654 def foo():
655     user_regex = _lazy_re_compile(
656         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  # dot-atom
657         "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",  # quoted-string
658         xyz,
659     )
660
661
662 class A:
663     class B:
664         def foo():
665             if not hasattr(module, name):
666                 raise ValueError(
667                     "Could not find object %s in %s.\n"
668                     "Please note that you cannot serialize things like inner "
669                     "classes. Please move the object into the main module "
670                     "body to use migrations.\n"
671                     "For more information, see "
672                     "https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
673                     % (name, module_name, get_docs_version())
674                 )
675
676
677 class A:
678     class B:
679         def foo():
680             if not hasattr(module, name):
681                 raise ValueError(
682                     "Could not find object %s in %s.\nPlease note that you cannot"
683                     " serialize things like inner classes. Please move the object into"
684                     " the main module body to use migrations.\nFor more information,"
685                     " see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values"
686                     % (name, module_name, get_docs_version())
687                 )
688
689
690 x = (
691     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
692     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
693     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
694     "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
695 )
696
697
698 class Step(StepBase):
699     def who(self):
700         self.cmd = (
701             "SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name}"
702             " {title}/P{passenger_association}".format(
703                 last_name=last_name,
704                 first_name=first_name,
705                 middle_name=middle_name,
706                 title=title,
707                 passenger_association=passenger_association,
708             )
709         )
710
711
712 if __name__ == "__main__":
713     for i in range(4, 8):
714         cmd = (
715             r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk"
716             r" '{print $2}'); do kill $pid; done" % (i)
717         )