Skip to content

Commit dc37060

Browse files
committed
run: ruff check --fix [ignore-rev]
1 parent b40fce4 commit dc37060

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+243
-175
lines changed

.maint/update_authors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
# ///
1010
"""Update and sort the creators list of the zenodo record."""
1111

12+
import json
1213
import sys
1314
from pathlib import Path
14-
import json
15+
1516
import click
1617
from fuzzywuzzy import fuzz, process
1718

@@ -123,7 +124,7 @@ def get_git_lines(fname='line-contributors.txt'):
123124
if not lines and cmd[0]:
124125
print(f'Running {" ".join(cmd)!r} on repo')
125126
lines = sp.check_output(cmd).decode().splitlines()
126-
lines = [l for l in lines if 'Not Committed Yet' not in l]
127+
lines = [line for line in lines if 'Not Committed Yet' not in line]
127128
contrib_file.write_text('\n'.join(lines))
128129

129130
if not lines:

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"""
99

1010
from packaging.version import Version
11-
from sdcflows import __version__, __copyright__, __packagename__
11+
12+
from sdcflows import __copyright__, __packagename__, __version__
1213

1314
# -- Path setup --------------------------------------------------------------
1415
# If extensions (or modules to document with autodoc) are in another directory,

docs/notebooks/SDC - Theory and physics.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@
5454
"outputs": [],
5555
"source": [
5656
"from itertools import product\n",
57+
"\n",
58+
"import nibabel as nb\n",
5759
"import numpy as np\n",
5860
"from scipy import ndimage as ndi\n",
59-
"import nibabel as nb\n",
6061
"from templateflow.api import get"
6162
]
6263
},

docs/tools/apigen.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import os
2222
import re
2323
from inspect import getmodule
24-
2524
from types import BuiltinFunctionType, FunctionType
2625

2726
# suppress print statements (warnings for empty files)
@@ -43,7 +42,7 @@ def __init__(
4342
module_skip_patterns=None,
4443
other_defines=True,
4544
):
46-
"""Initialize package for parsing
45+
r"""Initialize package for parsing
4746
4847
Parameters
4948
----------
@@ -362,7 +361,7 @@ def _survives_exclude(self, matchstr, match_type):
362361
return True
363362

364363
def discover_modules(self):
365-
"""Return module sequence discovered from ``self.package_name``
364+
r"""Return module sequence discovered from ``self.package_name``
366365
367366
368367
Parameters
@@ -410,7 +409,6 @@ def discover_modules(self):
410409

411410
def write_modules_api(self, modules, outdir):
412411
# upper-level modules
413-
main_module = modules[0].split('.')[0]
414412
ulms = [
415413
'.'.join(m.split('.')[:2]) if m.count('.') >= 1 else m.split('.')[0] for m in modules
416414
]

docs/tools/buildmodref.py

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

4-
from __future__ import print_function, division
4+
from __future__ import division, print_function
55

66
# stdlib imports
77
import sys
88

9-
# local imports
10-
from apigen import ApiDocWriter
11-
129
# version comparison
1310
from distutils.version import LooseVersion as V
1411

12+
# local imports
13+
from apigen import ApiDocWriter
14+
1515
# *****************************************************************************
1616

1717

sdcflows/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
try:
66
from ._version import __version__
77
except ModuleNotFoundError:
8-
from importlib.metadata import version, PackageNotFoundError
8+
from importlib.metadata import PackageNotFoundError, version
99

1010
try:
1111
__version__ = version(__packagename__)

sdcflows/cli/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525

2626
def main(argv=None):
2727
"""Entry point for SDCFlows' CLI."""
28+
import atexit
2829
import gc
2930
import os
3031
import sys
3132
from tempfile import mktemp
32-
import atexit
33+
3334
from sdcflows import config
3435
from sdcflows.cli.parser import parse_args
3536

@@ -59,6 +60,7 @@ def main(argv=None):
5960

6061
if config.execution.dry_run: # --dry-run: pretty print results
6162
from niworkflows.utils.bids import collect_participants
63+
6264
from sdcflows.utils.wrangler import find_estimators
6365

6466
subjects = collect_participants(
@@ -91,9 +93,9 @@ def main(argv=None):
9193
# Initialize process pool if multiprocessing
9294
_pool = None
9395
if config.nipype.plugin in ('MultiProc', 'LegacyMultiProc'):
94-
from contextlib import suppress
9596
import multiprocessing as mp
9697
from concurrent.futures import ProcessPoolExecutor
98+
from contextlib import suppress
9799

98100
os.environ['OMP_NUM_THREADS'] = '1'
99101

sdcflows/cli/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ def _bids_filter(value):
270270

271271
def parse_args(args=None, namespace=None):
272272
"""Parse args and run further checks on the command line."""
273-
from logging import DEBUG
274273
from json import loads
274+
from logging import DEBUG
275275

276276
parser = _parser()
277277
opts = parser.parse_args(args, namespace)

sdcflows/cli/tests/test_find_estimators.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"""Check the CLI."""
2424

2525
from importlib import reload
26+
2627
import pytest
2728
from niworkflows.utils.testing import generate_bids_skeleton
2829

sdcflows/config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
from importlib_metadata import version as get_version
125125

126126
# Ignore annoying warnings
127-
from sdcflows._warnings import logging
128127
from sdcflows import __version__
128+
from sdcflows._warnings import logging
129129

130130
_pre_exec_env = dict(os.environ)
131131

@@ -426,8 +426,9 @@ def init(cls):
426426

427427
if cls._layout is None:
428428
import re
429-
from bids.layout.index import BIDSLayoutIndexer
429+
430430
from bids.layout import BIDSLayout
431+
from bids.layout.index import BIDSLayoutIndexer
431432

432433
ignore_paths = [
433434
# Ignore folders at the top if they don't start with /sub-<label>/
@@ -532,8 +533,8 @@ def init(cls):
532533
533534
"""
534535
if not cls._init:
535-
from nipype import logging as nlogging
536536
from nipype import config as ncfg
537+
from nipype import logging as nlogging
537538

538539
cls.workflow = nlogging.getLogger('nipype.workflow')
539540
cls.interface = nlogging.getLogger('nipype.interface')

0 commit comments

Comments
 (0)