@@ -185,15 +185,11 @@ def parse_args(args=None):
185
185
),
186
186
)
187
187
188
- instparser = subparsers .add_parser (
189
- "install" , help = "Install all distributions."
190
- )
188
+ instparser = subparsers .add_parser ("install" , help = "Install all distributions." )
191
189
192
190
def setup_instparser (instparser ):
193
191
instparser .set_defaults (func = install_args )
194
- instparser .add_argument (
195
- "pipargs" , nargs = argparse .REMAINDER , help = extraargs_help ("pip" )
196
- )
192
+ instparser .add_argument ("pipargs" , nargs = argparse .REMAINDER , help = extraargs_help ("pip" ))
197
193
198
194
setup_instparser (instparser )
199
195
instparser .add_argument ("--editable" , "-e" , action = "store_true" )
@@ -213,9 +209,7 @@ def setup_instparser(instparser):
213
209
with_test_deps = True ,
214
210
)
215
211
216
- lintparser = subparsers .add_parser (
217
- "lint" , help = "Lint everything, autofixing if possible."
218
- )
212
+ lintparser = subparsers .add_parser ("lint" , help = "Lint everything, autofixing if possible." )
219
213
lintparser .add_argument ("--check-only" , action = "store_true" )
220
214
lintparser .set_defaults (func = lint_args )
221
215
@@ -224,9 +218,7 @@ def setup_instparser(instparser):
224
218
help = "Test everything (run pytest yourself for more complex operations)." ,
225
219
)
226
220
testparser .set_defaults (func = test_args )
227
- testparser .add_argument (
228
- "pytestargs" , nargs = argparse .REMAINDER , help = extraargs_help ("pytest" )
229
- )
221
+ testparser .add_argument ("pytestargs" , nargs = argparse .REMAINDER , help = extraargs_help ("pytest" ))
230
222
231
223
fmtparser = subparsers .add_parser (
232
224
"format" ,
@@ -263,12 +255,7 @@ def find_targets_unordered(rootpath):
263
255
264
256
265
257
def getlistcfg (strval ):
266
- return [
267
- val .strip ()
268
- for line in strval .split ("\n " )
269
- for val in line .split ("," )
270
- if val .strip ()
271
- ]
258
+ return [val .strip () for line in strval .split ("\n " ) for val in line .split ("," ) if val .strip ()]
272
259
273
260
274
261
def find_targets (mode , rootpath ):
@@ -281,11 +268,7 @@ def find_targets(mode, rootpath):
281
268
282
269
targets = list (find_targets_unordered (rootpath ))
283
270
if "extraroots" in mcfg :
284
- targets += [
285
- path
286
- for extraglob in getlistcfg (mcfg ["extraroots" ])
287
- for path in rootpath .glob (extraglob )
288
- ]
271
+ targets += [path for extraglob in getlistcfg (mcfg ["extraroots" ]) for path in rootpath .glob (extraglob )]
289
272
if "sortfirst" in mcfg :
290
273
sortfirst = getlistcfg (mcfg ["sortfirst" ])
291
274
@@ -319,9 +302,7 @@ def filter_func(path):
319
302
for target in targets
320
303
for subglob in subglobs
321
304
# We need to special-case the dot, because glob fails to parse that with an IndexError.
322
- for subdir in (
323
- (target ,) if subglob == "." else target .glob (subglob )
324
- )
305
+ for subdir in ((target ,) if subglob == "." else target .glob (subglob ))
325
306
)
326
307
if ".egg-info" not in str (newentry ) and newentry .exists ()
327
308
]
@@ -361,9 +342,7 @@ def runsubprocess(dry_run, params, *args, **kwargs):
361
342
try :
362
343
return subprocess_run (params , * args , check = check , ** kwargs )
363
344
except OSError as exc :
364
- raise ValueError (
365
- "Failed executing " + repr (params ) + ": " + str (exc )
366
- ) from exc
345
+ raise ValueError ("Failed executing " + repr (params ) + ": " + str (exc )) from exc
367
346
368
347
369
348
def execute_args (args ):
@@ -388,9 +367,7 @@ def fmt_for_path(fmt, path):
388
367
)
389
368
390
369
def _runcmd (cmd ):
391
- result = runsubprocess (
392
- args .dry_run , shlex .split (cmd ), cwd = rootpath , check = False
393
- )
370
+ result = runsubprocess (args .dry_run , shlex .split (cmd ), cwd = rootpath , check = False )
394
371
if result is not None and result .returncode not in args .allowexitcode :
395
372
print (
396
373
f"'{ cmd } ' failed with code { result .returncode } " ,
@@ -399,9 +376,7 @@ def _runcmd(cmd):
399
376
sys .exit (result .returncode )
400
377
401
378
if args .all :
402
- allstr = args .allsep .join (
403
- fmt_for_path (args .all , path ) for path in targets
404
- )
379
+ allstr = args .allsep .join (fmt_for_path (args .all , path ) for path in targets )
405
380
cmd = args .format .format (allstr )
406
381
_runcmd (cmd )
407
382
else :
@@ -492,8 +467,7 @@ def lint_args(args):
492
467
493
468
runsubprocess (
494
469
args .dry_run ,
495
- ("black" , "--config" , f"{ rootdir } /pyproject.toml" , "." )
496
- + (("--diff" , "--check" ) if args .check_only else ()),
470
+ ("black" , "--config" , f"{ rootdir } /pyproject.toml" , "." ) + (("--diff" , "--check" ) if args .check_only else ()),
497
471
cwd = rootdir ,
498
472
check = True ,
499
473
)
@@ -509,11 +483,7 @@ def lint_args(args):
509
483
("flake8" , "--config" , f"{ rootdir } /.flake8" , rootdir ),
510
484
check = True ,
511
485
)
512
- execute_args (
513
- parse_subargs (
514
- args , ("exec" , "pylint {}" , "--all" , "--mode" , "lintroots" )
515
- )
516
- )
486
+ execute_args (parse_subargs (args , ("exec" , "pylint {}" , "--all" , "--mode" , "lintroots" )))
517
487
execute_args (
518
488
parse_subargs (
519
489
args ,
0 commit comments