Skip to content

Commit 0244297

Browse files
committed
sty: Apply UP031 to fmriprep
1 parent 600ae7c commit 0244297

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

fmriprep/cli/tests/test_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def test_parser_valid(tmp_path, args):
8282
('1000MB', 1),
8383
('1T', 1000),
8484
('1TB', 1000),
85-
('%dK' % 1e6, 1),
86-
('%dKB' % 1e6, 1),
87-
('%dB' % 1e9, 1),
85+
('1000000K', 1),
86+
('1000000KB', 1),
87+
('1000000000B', 1),
8888
],
8989
)
9090
def test_memory_arg(tmp_path, argval, gb):

fmriprep/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@
149149
# Just get so analytics track one hit
150150
from contextlib import suppress
151151

152-
from requests import ConnectionError, ReadTimeout
153-
from requests import get as _get_url
152+
import requests
154153

155-
with suppress((ConnectionError, ReadTimeout)):
156-
_get_url('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
154+
with suppress((requests.ConnectionError, requests.ReadTimeout)):
155+
requests.get('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
157156

158157
# Execution environment
159158
_exec_env = os.name

fmriprep/interfaces/reports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ def _generate_segment(self):
242242
reg = {
243243
'FSL': [
244244
'FSL <code>flirt</code> with boundary-based registration'
245-
' (BBR) metric - %d dof' % dof,
245+
f' (BBR) metric - {dof} dof',
246246
'FSL <code>flirt</code> rigid registration - 6 dof',
247247
],
248248
'FreeSurfer': [
249249
'FreeSurfer <code>bbregister</code> '
250-
'(boundary-based registration, BBR) - %d dof' % dof,
251-
'FreeSurfer <code>mri_coreg</code> - %d dof' % dof,
250+
f'(boundary-based registration, BBR) - {dof} dof',
251+
f'FreeSurfer <code>mri_coreg</code> - {dof} dof',
252252
],
253253
}[self.inputs.registration][self.inputs.fallback]
254254

fmriprep/utils/telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def process_crashfile(crashfile):
116116
scope.set_extra(k, strv[0])
117117
else:
118118
for i, chunk in enumerate(strv):
119-
scope.set_extra('%s_%02d' % (k, i), chunk)
119+
scope.set_extra(f'{k}_{i:02d}', chunk)
120120

121121
fingerprint = ''
122122
issue_title = f'{node_name}: {gist}'

fmriprep/workflows/bold/stc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def init_bold_stc_wf(
106106
frac = config.workflow.slice_time_ref
107107
tzero = np.round(first + frac * (last - first), 3)
108108

109-
afni_ver = ''.join('%02d' % v for v in afni.Info().version() or [])
109+
afni_ver = ''.join(f'{v:02d}' for v in afni.Info().version() or [])
110110
workflow = Workflow(name=name)
111111
workflow.__desc__ = f"""\
112112
BOLD runs were slice-time corrected to {tzero:0.3g}s ({frac:g} of slice acquisition range

0 commit comments

Comments
 (0)