Skip to content

Commit 46a3018

Browse files
committed
run: ruff check --fix [ignore-rev]
1 parent ba441f0 commit 46a3018

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

.maint/update_authors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _aslist(value):
288288

289289
print(
290290
'\n\nAffiliations:\n%s'
291-
% '\n'.join(['{0: >2}. {1}'.format(i + 1, a) for i, a in enumerate(affiliations)])
291+
% '\n'.join([f'{i + 1: >2}. {a}' for i, a in enumerate(affiliations)])
292292
)
293293

294294

docs/tools/apigen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
DEBUG = True
2828

2929

30-
class ApiDocWriter(object):
30+
class ApiDocWriter:
3131
"""Class for automatic detection and parsing of API docs
3232
to Sphinx-parsable reST format"""
3333

@@ -185,7 +185,7 @@ def _parse_module(self, uri):
185185
# nothing that we could handle here.
186186
return ([], [])
187187

188-
f = open(filename, 'rt')
188+
f = open(filename)
189189
functions, classes = self._parse_lines(f)
190190
f.close()
191191
return functions, classes
@@ -439,7 +439,7 @@ def write_modules_api(self, modules, outdir):
439439

440440
out_module = ulm + self.rst_extension
441441
outfile = os.path.join(outdir, out_module)
442-
fileobj = open(outfile, 'wt')
442+
fileobj = open(outfile, 'w')
443443

444444
fileobj.writelines(document_head + document_body)
445445
fileobj.close()
@@ -497,7 +497,7 @@ def write_index(self, outdir, froot='gen', relative_to=None):
497497
relpath = (outdir + os.path.sep).replace(relative_to + os.path.sep, '')
498498
else:
499499
relpath = outdir
500-
idx = open(path, 'wt')
500+
idx = open(path, 'w')
501501
w = idx.write
502502
w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n')
503503

docs/tools/buildmodref.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env python
22
"""Script to auto-generate API docs."""
33

4-
from __future__ import division, print_function
5-
64
# stdlib imports
75
import sys
86

sdcflows/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
_memory_gb = None
201201
try:
202202
if 'linux' in sys.platform:
203-
with open('/proc/meminfo', 'r') as f_in:
203+
with open('/proc/meminfo') as f_in:
204204
_meminfo_lines = f_in.readlines()
205205
_mem_total_line = [line for line in _meminfo_lines if 'MemTotal' in line][0]
206206
_mem_total = float(_mem_total_line.split()[1])

sdcflows/tests/test_transform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap):
197197
error_margin = 0.5
198198
if fmap is False: # If no fieldmap, this is equivalent to only HMC
199199
realigned = LinearTransformsMapping(hmc_xfms, reference=in_file).apply(in_file)
200-
error = np.sqrt(((corrected.dataobj - realigned.dataobj) ** 2))
200+
error = np.sqrt((corrected.dataobj - realigned.dataobj) ** 2)
201201

202202
if outdir:
203203
# Do not include the first volume in the average to enhance differences
@@ -226,7 +226,7 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap):
226226
)
227227
else:
228228
realigned = nb.load(in_file)
229-
error = np.nan_to_num(np.sqrt(((corrected.dataobj - realigned.dataobj) ** 2)), nan=0)
229+
error = np.nan_to_num(np.sqrt((corrected.dataobj - realigned.dataobj) ** 2), nan=0)
230230
error_margin = 200 # test oracle is pretty bad here - needs revision.
231231

232232
if outdir:
@@ -290,7 +290,7 @@ def test_apply_transform(tmpdir, outdir, datadir, pe0, hmc, fmap):
290290
out_report=str(outdir / f'sub-pilot_ses-15_acq-b0_dir-{pe0}_desc-hmcdiff_dwi.svg'),
291291
).run()
292292

293-
error = np.sqrt(((corrected.dataobj - corrected_nohmc.dataobj) ** 2))
293+
error = np.sqrt((corrected.dataobj - corrected_nohmc.dataobj) ** 2)
294294
realigned.__class__(
295295
error,
296296
realigned.affine,

sdcflows/transform.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@
4949

5050
import asyncio
5151
import os
52+
from collections.abc import Sequence
5253
from functools import partial
5354
from pathlib import Path
54-
from typing import Callable, Sequence, Tuple
55+
from typing import Callable, Tuple
5556
from warnings import warn
5657

5758
import attr

0 commit comments

Comments
 (0)