Skip to content

Commit 6419e7d

Browse files
authored
Merge pull request #348 from DimitriPapadopoulos/pyupgrade
MNT: apply pyupgrade suggestions
2 parents b2a434c + e813126 commit 6419e7d

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

docs/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Configuration file for the Sphinx documentation builder.
42
#
53
# This file does only contain a selection of the most common options. For a

get_version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
43
# vi: set ft=python sts=4 ts=4 sw=4 et:
54
# @Author: oesteban

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
import sys
43
from setuptools import setup
54
import versioneer

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class SubjectSummary(SummaryInterface):
103103
def _run_interface(self, runtime):
104104
if isdefined(self.inputs.subject_id):
105105
self._results["subject_id"] = self.inputs.subject_id
106-
return super(SubjectSummary, self)._run_interface(runtime)
106+
return super()._run_interface(runtime)
107107

108108
def _generate_segment(self):
109109
if not isdefined(self.inputs.subjects_dir):
@@ -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)