Skip to content

Commit 3083a18

Browse files
MNT: .format() → f-strings
1 parent 3b46457 commit 3083a18

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

smriprep/cli/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def get_parser():
8686

8787
# optional arguments
8888
parser.add_argument(
89-
"--version", action="version", version="smriprep v{}".format(__version__)
89+
"--version", action="version", version=f"smriprep v{__version__}"
9090
)
9191

9292
g_bids = parser.add_argument_group("Options for filtering BIDS queries")
@@ -380,7 +380,7 @@ def _warn_redirect(message, category, filename, lineno, file=None, line=None):
380380
if missing:
381381
print("Cannot run sMRIPrep. Missing dependencies:")
382382
for iface, cmd in missing:
383-
print("\t{} (Interface: {})".format(cmd, iface))
383+
print(f"\t{cmd} (Interface: {iface})")
384384
sys.exit(2)
385385

386386
# Clean up master process before running workflow, which may create forks
@@ -453,7 +453,7 @@ def build_workflow(opts, retval):
453453
""".format
454454

455455
# Set up some instrumental utilities
456-
run_uuid = "%s_%s" % (strftime("%Y%m%d-%H%M%S"), uuid.uuid4())
456+
run_uuid = "{}_{}".format(strftime("%Y%m%d-%H%M%S"), uuid.uuid4())
457457

458458
# First check that bids_dir looks like a BIDS folder
459459
bids_dir = opts.bids_dir.resolve()

smriprep/interfaces/freesurfer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def cmdline(self):
168168
no_run = True
169169
flags = []
170170
for step, outfiles, infiles in steps:
171-
flag = "-{}".format(step)
172-
noflag = "-no{}".format(step)
171+
flag = f"-{step}"
172+
noflag = f"-no{step}"
173173
if noflag in cmd:
174174
continue
175175
elif flag in cmd:

smriprep/interfaces/reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _generate_segment(self):
122122

123123
t2w_seg = ""
124124
if self.inputs.t2w:
125-
t2w_seg = "(+ {:d} T2-weighted)".format(len(self.inputs.t2w))
125+
t2w_seg = f"(+ {len(self.inputs.t2w):d} T2-weighted)"
126126

127127
output_spaces = self.inputs.output_spaces
128128
if not isdefined(output_spaces):

smriprep/workflows/surfaces.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def _dedup(in_list):
459459
vals = set(in_list)
460460
if len(vals) > 1:
461461
raise ValueError(
462-
"Non-identical values can't be deduplicated:\n{!r}".format(in_list)
462+
f"Non-identical values can't be deduplicated:\n{in_list!r}"
463463
)
464464
return vals.pop()
465465

@@ -694,7 +694,7 @@ def init_segs_to_native_wf(*, name="segs_to_native", segmentation="aseg"):
694694
The selected segmentation, after resampling in native space
695695
696696
"""
697-
workflow = Workflow(name="%s_%s" % (name, segmentation))
697+
workflow = Workflow(name=f"{name}_{segmentation}")
698698
inputnode = pe.Node(
699699
niu.IdentityInterface(
700700
["in_file", "subjects_dir", "subject_id", "fsnative2t1w_xfm"]

0 commit comments

Comments
 (0)