Skip to content

Commit 01a13ca

Browse files
STY: Apply pyupgrade suggestions (#3043)
pyupgrade --py38-plus
1 parent 822e44a commit 01a13ca

File tree

13 files changed

+17
-28
lines changed

13 files changed

+17
-28
lines changed

docs/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# fmriprep documentation build configuration file, created by
42
# sphinx-quickstart on Mon May 9 09:04:25 2016.
53
#
@@ -87,7 +85,7 @@
8785
# General information about the project.
8886
project = "fmriprep"
8987
author = "The fMRIPrep developers"
90-
copyright = "2016-%s, %s" % (datetime.now().year, author)
88+
copyright = f"2016-{datetime.now().year}, {author}"
9189

9290
# The version info for the project you're documenting, acts as replacement for
9391
# |version| and |release|, also used in various other places throughout the

fmriprep/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929

3030
# `python -m <module>` typically displays the command as __main__.py
3131
if '__main__.py' in sys.argv[0]:
32-
sys.argv[0] = '%s -m %s' % (sys.executable, module)
32+
sys.argv[0] = f'{sys.executable} -m {module}'
3333
main()

fmriprep/cli/run.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ def main():
165165
from ..utils.telemetry import process_crashfile
166166

167167
crashfolders = [
168-
config.execution.fmriprep_dir
169-
/ "sub-{}".format(s)
170-
/ "log"
171-
/ config.execution.run_uuid
168+
config.execution.fmriprep_dir / f"sub-{s}" / "log" / config.execution.run_uuid
172169
for s in config.execution.participant_label
173170
]
174171
for crashfolder in crashfolders:

fmriprep/cli/tests/test_parser.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,10 @@ def _mock_check_latest(*args, **kwargs):
113113
_build_parser()
114114
captured = capsys.readouterr().err
115115

116-
msg = """\
117-
You are using fMRIPrep-%s, and a newer version of fMRIPrep is available: %s.
116+
msg = f"""\
117+
You are using fMRIPrep-{current}, and a newer version of fMRIPrep is available: {latest}.
118118
Please check out our documentation about how and when to upgrade:
119-
https://fmriprep.readthedocs.io/en/latest/faq.html#upgrading""" % (
120-
current,
121-
latest,
122-
)
119+
https://fmriprep.readthedocs.io/en/latest/faq.html#upgrading"""
123120

124121
assert (msg in captured) is expectation
125122

fmriprep/interfaces/gifti.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
32
# vi: set ft=python sts=4 ts=4 sw=4 et:
43
"""Interfaces for manipulating GIFTI files."""

fmriprep/interfaces/multiecho.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class T2SMap(CommandLine):
102102
def _format_arg(self, name, trait_spec, value):
103103
if name == 'echo_times':
104104
value = [te * 1000 for te in value]
105-
return super(T2SMap, self)._format_arg(name, trait_spec, value)
105+
return super()._format_arg(name, trait_spec, value)
106106

107107
def _list_outputs(self):
108108
outputs = self._outputs().get()

fmriprep/interfaces/patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _run_interface(self, runtime):
4444
failures = 0
4545
while True:
4646
try:
47-
runtime = super(RobustACompCor, self)._run_interface(runtime)
47+
runtime = super()._run_interface(runtime)
4848
break
4949
except LinAlgError:
5050
failures += 1
@@ -67,7 +67,7 @@ def _run_interface(self, runtime):
6767
failures = 0
6868
while True:
6969
try:
70-
runtime = super(RobustTCompCor, self)._run_interface(runtime)
70+
runtime = super()._run_interface(runtime)
7171
break
7272
except LinAlgError:
7373
failures += 1

fmriprep/interfaces/reports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class SubjectSummary(SummaryInterface):
130130
def _run_interface(self, runtime):
131131
if isdefined(self.inputs.subject_id):
132132
self._results['subject_id'] = self.inputs.subject_id
133-
return super(SubjectSummary, self)._run_interface(runtime)
133+
return super()._run_interface(runtime)
134134

135135
def _generate_segment(self):
136136
BIDS_NAME = re.compile(
@@ -159,7 +159,7 @@ def _generate_segment(self):
159159

160160
t2w_seg = ''
161161
if self.inputs.t2w:
162-
t2w_seg = '(+ {:d} T2-weighted)'.format(len(self.inputs.t2w))
162+
t2w_seg = f'(+ {len(self.inputs.t2w):d} T2-weighted)'
163163

164164
# Add list of tasks with number of runs
165165
bold_series = self.inputs.bold if isdefined(self.inputs.bold) else []

fmriprep/interfaces/workbench.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
32
# vi: set ft=python sts=4 ts=4 sw=4 et:
43
"""This module provides interfaces for workbench surface commands."""
@@ -297,7 +296,7 @@ def _format_arg(self, opt, spec, val):
297296
roi_out = self._gen_filename(self.inputs.in_file, suffix="_roi")
298297
iflogger.info("Setting roi output file as", roi_out)
299298
spec.argstr += " " + roi_out
300-
return super(MetricResample, self)._format_arg(opt, spec, val)
299+
return super()._format_arg(opt, spec, val)
301300

302301
def _list_outputs(self):
303302
outputs = super()._list_outputs()

fmriprep/reports/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _load_config(self, config):
4040
# In this version, pass reportlets_dir and out_dir with fmriprep in the path.
4141

4242
if self.subject_id is not None:
43-
self.root = self.root / "sub-{}".format(self.subject_id)
43+
self.root = self.root / f"sub-{self.subject_id}"
4444

4545
if "template_path" in settings:
4646
self.template_path = config.parent / settings["template_path"]

0 commit comments

Comments
 (0)