diff --git a/nibabies/cli/tests/test_parser.py b/nibabies/cli/tests/test_parser.py
index e2be6190..bd0c83ea 100644
--- a/nibabies/cli/tests/test_parser.py
+++ b/nibabies/cli/tests/test_parser.py
@@ -82,9 +82,9 @@ def test_parser_valid(tmp_path, args):
('1000MB', 1),
('1T', 1000),
('1TB', 1000),
- ('%dK' % 1e6, 1),
- ('%dKB' % 1e6, 1),
- ('%dB' % 1e9, 1),
+ (f'{1e6:.0f}K', 1),
+ (f'{1e6:.0f}KB', 1),
+ (f'{1e9:.0f}B', 1),
],
)
def test_memory_arg(tmp_path, argval, gb):
diff --git a/nibabies/config.py b/nibabies/config.py
index 4c6263e7..70f309cb 100644
--- a/nibabies/config.py
+++ b/nibabies/config.py
@@ -130,11 +130,10 @@
# Just get so analytics track one hit
from contextlib import suppress
- from requests import ConnectionError, ReadTimeout
- from requests import get as _get_url
+ import requests
- with suppress((ConnectionError, ReadTimeout)):
- _get_url('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
+ with suppress((requests.ConnectionError, requests.ReadTimeout)):
+ requests.get('https://rig.mit.edu/et/projects/nipy/nipype', timeout=0.05)
# Execution environment
_exec_env = os.name
diff --git a/nibabies/interfaces/reports.py b/nibabies/interfaces/reports.py
index c0e0c8a3..b99d921f 100644
--- a/nibabies/interfaces/reports.py
+++ b/nibabies/interfaces/reports.py
@@ -274,13 +274,13 @@ def _generate_segment(self):
reg = {
'FSL': [
'FSL flirt with boundary-based registration'
- ' (BBR) metric - %d dof' % dof,
+ f' (BBR) metric - {dof} dof',
'FSL flirt rigid registration - 6 dof',
],
'FreeSurfer': [
'FreeSurfer bbregister '
- '(boundary-based registration, BBR) - %d dof' % dof,
- 'FreeSurfer mri_coreg - %d dof' % dof,
+ f'(boundary-based registration, BBR) - {dof} dof',
+ f'FreeSurfer mri_coreg - {dof} dof',
],
}[self.inputs.registration][self.inputs.fallback]
diff --git a/nibabies/reports/core.py b/nibabies/reports/core.py
index 2b0c142e..ed7ccdd2 100644
--- a/nibabies/reports/core.py
+++ b/nibabies/reports/core.py
@@ -58,7 +58,7 @@ def generate_reports(
logger = logging.getLogger('cli')
error_list = ', '.join(
- '%s (%d)' % (subid, err)
+ f'{subid} ({err})'
for subid, err in zip(sub_ses_list, report_errors, strict=False)
if err
)
diff --git a/nibabies/workflows/bold/outputs.py b/nibabies/workflows/bold/outputs.py
index befeaa24..36884c4a 100644
--- a/nibabies/workflows/bold/outputs.py
+++ b/nibabies/workflows/bold/outputs.py
@@ -133,7 +133,7 @@ def prepare_timing_parameters(metadata: dict):
if run_stc:
first, last = st[0], st[-1]
frac = config.workflow.slice_time_ref
- tzero = np.round(first + frac * (last - first), 3)
+ tzero = float(np.round(first + frac * (last - first), 3))
timing_parameters['StartTime'] = tzero
return timing_parameters
diff --git a/nibabies/workflows/bold/stc.py b/nibabies/workflows/bold/stc.py
index 4c0ae8c8..92c0fe53 100644
--- a/nibabies/workflows/bold/stc.py
+++ b/nibabies/workflows/bold/stc.py
@@ -100,7 +100,7 @@ def init_bold_stc_wf(metadata, name='bold_stc_wf'):
frac = config.workflow.slice_time_ref
tzero = np.round(first + frac * (last - first), 3)
- afni_ver = ''.join('%02d' % v for v in afni.Info().version() or [])
+ afni_ver = ''.join(f'{v:02d}' % v for v in afni.Info().version() or [])
workflow = Workflow(name=name)
workflow.__desc__ = f"""\
BOLD runs were slice-time corrected to {tzero:0.3g}s ({frac:g} of slice acquisition range