Skip to content

Commit a6cd627

Browse files
authored
Merge pull request #417 from mgxd/fix/style
FIX: New styling catches
2 parents ed90a8c + 51c306b commit a6cd627

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

nibabies/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+
(f'{1e6:.0f}K', 1),
86+
(f'{1e6:.0f}KB', 1),
87+
(f'{1e9:.0f}B', 1),
8888
],
8989
)
9090
def test_memory_arg(tmp_path, argval, gb):

nibabies/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,10 @@
130130
# Just get so analytics track one hit
131131
from contextlib import suppress
132132

133-
from requests import ConnectionError, ReadTimeout
134-
from requests import get as _get_url
133+
import requests
135134

136-
with suppress((ConnectionError, ReadTimeout)):
137-
_get_url('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
135+
with suppress((requests.ConnectionError, requests.ReadTimeout)):
136+
requests.get('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
138137

139138
# Execution environment
140139
_exec_env = os.name

nibabies/interfaces/reports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ def _generate_segment(self):
274274
reg = {
275275
'FSL': [
276276
'FSL <code>flirt</code> with boundary-based registration'
277-
' (BBR) metric - %d dof' % dof,
277+
f' (BBR) metric - {dof} dof',
278278
'FSL <code>flirt</code> rigid registration - 6 dof',
279279
],
280280
'FreeSurfer': [
281281
'FreeSurfer <code>bbregister</code> '
282-
'(boundary-based registration, BBR) - %d dof' % dof,
283-
'FreeSurfer <code>mri_coreg</code> - %d dof' % dof,
282+
f'(boundary-based registration, BBR) - {dof} dof',
283+
f'FreeSurfer <code>mri_coreg</code> - {dof} dof',
284284
],
285285
}[self.inputs.registration][self.inputs.fallback]
286286

nibabies/reports/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def generate_reports(
5858

5959
logger = logging.getLogger('cli')
6060
error_list = ', '.join(
61-
'%s (%d)' % (subid, err)
61+
f'{subid} ({err})'
6262
for subid, err in zip(sub_ses_list, report_errors, strict=False)
6363
if err
6464
)

nibabies/workflows/bold/outputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def prepare_timing_parameters(metadata: dict):
133133
if run_stc:
134134
first, last = st[0], st[-1]
135135
frac = config.workflow.slice_time_ref
136-
tzero = np.round(first + frac * (last - first), 3)
136+
tzero = float(np.round(first + frac * (last - first), 3))
137137
timing_parameters['StartTime'] = tzero
138138

139139
return timing_parameters

nibabies/workflows/bold/stc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def init_bold_stc_wf(metadata, name='bold_stc_wf'):
100100
frac = config.workflow.slice_time_ref
101101
tzero = np.round(first + frac * (last - first), 3)
102102

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

0 commit comments

Comments
 (0)