20
20
import subprocess
21
21
22
22
__version__ = "99.99.99"
23
- __copyright__ = (
24
- "Copyright 2019, Center for Reproducible Neuroscience, Stanford University"
25
- )
23
+ __copyright__ = "Copyright 2019, Center for Reproducible Neuroscience, Stanford University"
26
24
__credits__ = [
27
25
"Oscar Esteban" ,
28
26
"Chris Gorgolewski" ,
@@ -87,9 +85,7 @@ def check_docker():
87
85
1 Test run OK
88
86
"""
89
87
try :
90
- ret = subprocess .run (
91
- ["docker" , "version" ], stdout = subprocess .PIPE , stderr = subprocess .PIPE
92
- )
88
+ ret = subprocess .run (["docker" , "version" ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
93
89
except OSError as e :
94
90
from errno import ENOENT
95
91
@@ -117,9 +113,7 @@ def check_memory(image):
117
113
return - 1
118
114
119
115
mem = [
120
- line .decode ().split ()[1 ]
121
- for line in ret .stdout .splitlines ()
122
- if line .startswith (b"Mem:" )
116
+ line .decode ().split ()[1 ] for line in ret .stdout .splitlines () if line .startswith (b"Mem:" )
123
117
][0 ]
124
118
return int (mem )
125
119
@@ -170,7 +164,9 @@ def _get_posargs(usage):
170
164
171
165
# Make sure we're not clobbering options we don't mean to
172
166
overlap = set (w_flags ).intersection (t_flags )
173
- expected_overlap = set (["h" , "version" , "w" , "fs-license-file" , "use-plugin" , "fs-subjects-dir" ])
167
+ expected_overlap = set (
168
+ ["h" , "version" , "w" , "fs-license-file" , "use-plugin" , "fs-subjects-dir" ]
169
+ )
174
170
175
171
assert overlap == expected_overlap , "Clobbering options: {}" .format (
176
172
", " .join (overlap - expected_overlap )
@@ -339,12 +335,8 @@ def _is_file(path, parser):
339
335
metavar = ("ENV_VAR" , "value" ),
340
336
help = "Set custom environment variable within container" ,
341
337
)
342
- g_dev .add_argument (
343
- "-u" , "--user" , action = "store" , help = "Run container as a given user/uid"
344
- )
345
- g_dev .add_argument (
346
- "--no-tty" , action = "store_true" , help = "Run docker without TTY flag -it"
347
- )
338
+ g_dev .add_argument ("-u" , "--user" , action = "store" , help = "Run container as a given user/uid" )
339
+ g_dev .add_argument ("--no-tty" , action = "store_true" , help = "Run docker without TTY flag -it" )
348
340
349
341
return parser
350
342
@@ -398,10 +390,7 @@ def main():
398
390
"Do you have permission to run docker?"
399
391
)
400
392
return 1
401
- if (
402
- not (opts .help or opts .version or "--reports-only" in unknown_args )
403
- and mem_total < 8000
404
- ):
393
+ if not (opts .help or opts .version or "--reports-only" in unknown_args ) and mem_total < 8000 :
405
394
print (
406
395
"Warning: <8GB of RAM is available within your Docker "
407
396
"environment.\n Some parts of sMRIPrep may fail to complete."
@@ -445,9 +434,7 @@ def main():
445
434
command .extend (["-u" , opts .user ])
446
435
447
436
if opts .fs_license_file :
448
- command .extend (
449
- ["-v" , "{}:/opt/freesurfer/license.txt:ro" .format (opts .fs_license_file )]
450
- )
437
+ command .extend (["-v" , "{}:/opt/freesurfer/license.txt:ro" .format (opts .fs_license_file )])
451
438
452
439
main_args = []
453
440
if opts .bids_dir :
@@ -467,9 +454,7 @@ def main():
467
454
unknown_args .extend (['--fs-subjects-dir' , '/opt/subjects' ])
468
455
469
456
if opts .config :
470
- command .extend (
471
- ["-v" , ":" .join ((opts .config , "/home/smriprep/.nipype/nipype.cfg" , "ro" ))]
472
- )
457
+ command .extend (["-v" , ":" .join ((opts .config , "/home/smriprep/.nipype/nipype.cfg" , "ro" ))])
473
458
474
459
if opts .use_plugin :
475
460
command .extend (["-v" , ":" .join ((opts .use_plugin , "/tmp/plugin.yml" , "ro" ))])
0 commit comments