From d62073ed5730cee416650d63e1ed196e5d98eca3 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:15:56 +0200 Subject: [PATCH 1/6] STY: Apply ruff/Pyflakes rule F401 F401 imported but unused --- nipype/algorithms/misc.py | 2 +- nipype/algorithms/tests/test_ErrorMap.py | 3 --- nipype/algorithms/tests/test_Overlap.py | 1 - nipype/algorithms/tests/test_confounds.py | 1 - nipype/algorithms/tests/test_mesh_ops.py | 2 -- nipype/algorithms/tests/test_modelgen.py | 1 - nipype/algorithms/tests/test_normalize_tpms.py | 3 --- nipype/algorithms/tests/test_splitmerge.py | 2 -- nipype/interfaces/afni/model.py | 7 ------- nipype/interfaces/ants/base.py | 2 +- nipype/interfaces/cmtk/convert.py | 3 +-- nipype/interfaces/cmtk/nbs.py | 1 - nipype/interfaces/cmtk/nx.py | 1 - nipype/interfaces/cmtk/parcellation.py | 2 -- nipype/interfaces/dipy/base.py | 1 - nipype/interfaces/dipy/reconstruction.py | 2 -- nipype/interfaces/dipy/simulate.py | 2 +- nipype/interfaces/freesurfer/longitudinal.py | 5 ----- nipype/interfaces/freesurfer/tests/test_model.py | 1 - nipype/interfaces/fsl/aroma.py | 1 - nipype/interfaces/fsl/tests/test_base.py | 2 +- nipype/interfaces/fsl/tests/test_epi.py | 1 - nipype/interfaces/fsl/tests/test_model.py | 1 - nipype/interfaces/fsl/tests/test_preprocess.py | 2 -- nipype/interfaces/fsl/tests/test_utils.py | 3 +-- nipype/interfaces/minc/testdata.py | 1 - nipype/interfaces/mipav/developer.py | 6 ------ nipype/interfaces/mrtrix/convert.py | 2 +- nipype/interfaces/mrtrix3/base.py | 1 - nipype/interfaces/mrtrix3/preprocess.py | 1 - nipype/interfaces/nipy/preprocess.py | 2 +- nipype/interfaces/nipy/utils.py | 2 +- nipype/interfaces/r.py | 3 --- nipype/interfaces/robex/preprocess.py | 5 ----- nipype/interfaces/semtools/brains/classify.py | 7 ------- nipype/interfaces/semtools/brains/segmentation.py | 6 ------ nipype/interfaces/semtools/brains/utilities.py | 6 ------ nipype/interfaces/semtools/converters.py | 7 ------- nipype/interfaces/semtools/diffusion/diffusion.py | 5 ----- nipype/interfaces/semtools/diffusion/gtract.py | 6 ------ nipype/interfaces/semtools/diffusion/maxcurvature.py | 7 ------- .../semtools/diffusion/tractography/commandlineonly.py | 7 ------- .../semtools/diffusion/tractography/fiberprocess.py | 7 ------- .../semtools/diffusion/tractography/fibertrack.py | 7 ------- .../semtools/diffusion/tractography/ukftractography.py | 6 ------ nipype/interfaces/semtools/featurecreator.py | 7 ------- nipype/interfaces/semtools/filtering/denoising.py | 6 ------ nipype/interfaces/semtools/filtering/featuredetection.py | 6 ------ nipype/interfaces/semtools/legacy/registration.py | 7 ------- nipype/interfaces/semtools/registration/brainsfit.py | 6 ------ nipype/interfaces/semtools/registration/brainsresample.py | 6 ------ nipype/interfaces/semtools/registration/brainsresize.py | 7 ------- nipype/interfaces/semtools/registration/specialized.py | 6 ------ nipype/interfaces/semtools/segmentation/specialized.py | 4 ---- nipype/interfaces/semtools/testing/featuredetection.py | 6 ------ .../interfaces/semtools/testing/generateaveragelmkfile.py | 5 ----- nipype/interfaces/semtools/testing/landmarkscompare.py | 6 ------ nipype/interfaces/semtools/utilities/brains.py | 4 ---- nipype/interfaces/slicer/converters.py | 5 ----- nipype/interfaces/slicer/diffusion/diffusion.py | 4 ---- nipype/interfaces/slicer/filtering/arithmetic.py | 6 ------ nipype/interfaces/slicer/filtering/checkerboardfilter.py | 5 ----- nipype/interfaces/slicer/filtering/denoising.py | 5 ----- nipype/interfaces/slicer/filtering/extractskeleton.py | 6 ------ nipype/interfaces/slicer/filtering/histogrammatching.py | 6 ------ nipype/interfaces/slicer/filtering/imagelabelcombine.py | 6 ------ nipype/interfaces/slicer/filtering/morphology.py | 6 ------ .../slicer/filtering/n4itkbiasfieldcorrection.py | 5 ----- .../slicer/filtering/resamplescalarvectordwivolume.py | 5 ----- .../interfaces/slicer/filtering/thresholdscalarvolume.py | 6 ------ .../slicer/filtering/votingbinaryholefillingimagefilter.py | 5 ----- nipype/interfaces/slicer/legacy/converters.py | 6 ------ nipype/interfaces/slicer/legacy/diffusion/denoising.py | 5 ----- nipype/interfaces/slicer/legacy/filtering.py | 5 ----- nipype/interfaces/slicer/legacy/registration.py | 5 ----- nipype/interfaces/slicer/legacy/segmentation.py | 6 ------ .../slicer/quantification/changequantification.py | 6 ------ .../quantification/petstandarduptakevaluecomputation.py | 5 ----- nipype/interfaces/slicer/registration/brainsfit.py | 5 ----- nipype/interfaces/slicer/registration/brainsresample.py | 5 ----- nipype/interfaces/slicer/registration/specialized.py | 5 ----- .../slicer/segmentation/simpleregiongrowingsegmentation.py | 5 ----- nipype/interfaces/slicer/segmentation/specialized.py | 4 ---- nipype/interfaces/slicer/surface.py | 4 ---- nipype/interfaces/slicer/utilities.py | 6 ------ nipype/interfaces/spm/base.py | 2 +- nipype/interfaces/tests/test_extra_dcm2nii.py | 1 - nipype/interfaces/utility/tests/test_wrappers.py | 1 - nipype/pipeline/engine/base.py | 1 - nipype/pipeline/engine/nodes.py | 1 - nipype/pipeline/plugins/tests/test_somaflow.py | 1 - nipype/pipeline/plugins/tests/test_tools.py | 2 -- nipype/refs.py | 2 +- nipype/scripts/crash_files.py | 2 -- nipype/sphinxext/plot_workflow.py | 1 - nipype/testing/tests/test_utils.py | 1 - nipype/utils/config.py | 1 - nipype/utils/draw_gantt_chart.py | 1 - nipype/utils/nipype_cmd.py | 1 - nipype/utils/tests/test_filemanip.py | 1 - nipype/utils/tests/test_provenance.py | 1 - 101 files changed, 11 insertions(+), 373 deletions(-) diff --git a/nipype/algorithms/misc.py b/nipype/algorithms/misc.py index 8d2e406793..e1a67f0b08 100644 --- a/nipype/algorithms/misc.py +++ b/nipype/algorithms/misc.py @@ -1345,7 +1345,7 @@ def split_rois(in_file, mask=None, roishape=None): """ import nibabel as nb import numpy as np - from math import sqrt, ceil + from math import ceil import os.path as op if roishape is None: diff --git a/nipype/algorithms/tests/test_ErrorMap.py b/nipype/algorithms/tests/test_ErrorMap.py index c1b3f1cac8..4cd0c7ce7e 100644 --- a/nipype/algorithms/tests/test_ErrorMap.py +++ b/nipype/algorithms/tests/test_ErrorMap.py @@ -1,11 +1,8 @@ #!/usr/bin/env python -import pytest -from nipype.testing import example_data from nipype.algorithms.metrics import ErrorMap import nibabel as nb import numpy as np -import os def test_errormap(tmpdir): diff --git a/nipype/algorithms/tests/test_Overlap.py b/nipype/algorithms/tests/test_Overlap.py index ee3900e82e..93a7cbb68f 100644 --- a/nipype/algorithms/tests/test_Overlap.py +++ b/nipype/algorithms/tests/test_Overlap.py @@ -2,7 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os from nipype.testing import example_data diff --git a/nipype/algorithms/tests/test_confounds.py b/nipype/algorithms/tests/test_confounds.py index 9698b6d2c1..b3fb198707 100644 --- a/nipype/algorithms/tests/test_confounds.py +++ b/nipype/algorithms/tests/test_confounds.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -import os import pytest from nipype.testing import example_data diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index 484925ddbb..f626cc6c0c 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -1,10 +1,8 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os import pytest -import nipype.testing as npt from nipype.testing import example_data import numpy as np from nipype.algorithms import mesh as m diff --git a/nipype/algorithms/tests/test_modelgen.py b/nipype/algorithms/tests/test_modelgen.py index 2707b93faa..1b1aacae00 100644 --- a/nipype/algorithms/tests/test_modelgen.py +++ b/nipype/algorithms/tests/test_modelgen.py @@ -2,7 +2,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: from copy import deepcopy -import os from nibabel import Nifti1Image import numpy as np diff --git a/nipype/algorithms/tests/test_normalize_tpms.py b/nipype/algorithms/tests/test_normalize_tpms.py index 5f3f2456ca..37eb9bb51b 100644 --- a/nipype/algorithms/tests/test_normalize_tpms.py +++ b/nipype/algorithms/tests/test_normalize_tpms.py @@ -1,14 +1,11 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os -import pytest from nipype.testing import example_data import numpy as np import nibabel as nb -import nipype.testing as nit from nipype.algorithms.misc import normalize_tpms diff --git a/nipype/algorithms/tests/test_splitmerge.py b/nipype/algorithms/tests/test_splitmerge.py index 5a8f098c18..af4a920be5 100644 --- a/nipype/algorithms/tests/test_splitmerge.py +++ b/nipype/algorithms/tests/test_splitmerge.py @@ -6,8 +6,6 @@ def test_split_and_merge(tmpdir): import numpy as np import nibabel as nb - import os.path as op - import os from nipype.algorithms.misc import split_rois, merge_rois diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index a227e90867..e3a7348b3b 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -12,26 +12,19 @@ import os from ..base import ( - CommandLineInputSpec, - CommandLine, - Directory, TraitedSpec, traits, isdefined, File, InputMultiPath, - Undefined, Str, Tuple, ) -from ...external.due import BibTeX from .base import ( - AFNICommandBase, AFNICommand, AFNICommandInputSpec, AFNICommandOutputSpec, - Info, ) diff --git a/nipype/interfaces/ants/base.py b/nipype/interfaces/ants/base.py index c484104d28..c78a375b02 100644 --- a/nipype/interfaces/ants/base.py +++ b/nipype/interfaces/ants/base.py @@ -2,7 +2,7 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """The ants module provides basic functions for interfacing with ANTS tools.""" import os -from packaging.version import Version, parse +from packaging.version import parse # Local imports from ... import logging diff --git a/nipype/interfaces/cmtk/convert.py b/nipype/interfaces/cmtk/convert.py index b2e21c3bb9..0c38fd3342 100644 --- a/nipype/interfaces/cmtk/convert.py +++ b/nipype/interfaces/cmtk/convert.py @@ -2,7 +2,6 @@ import os.path as op import datetime import string -import networkx as nx from ...utils.filemanip import split_filename from ..base import ( @@ -13,7 +12,7 @@ InputMultiPath, isdefined, ) -from .base import CFFBaseInterface, have_cfflib +from .base import CFFBaseInterface def _read_pickle(fname): diff --git a/nipype/interfaces/cmtk/nbs.py b/nipype/interfaces/cmtk/nbs.py index 4b4be74ebb..b63144cb50 100644 --- a/nipype/interfaces/cmtk/nbs.py +++ b/nipype/interfaces/cmtk/nbs.py @@ -18,7 +18,6 @@ OutputMultiPath, isdefined, ) -from .base import have_cv iflogger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/cmtk/nx.py b/nipype/interfaces/cmtk/nx.py index 53706389aa..ad72582f3d 100644 --- a/nipype/interfaces/cmtk/nx.py +++ b/nipype/interfaces/cmtk/nx.py @@ -18,7 +18,6 @@ OutputMultiPath, isdefined, ) -from .base import have_cmp iflogger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/cmtk/parcellation.py b/nipype/interfaces/cmtk/parcellation.py index 548fa99897..cbde492fb6 100644 --- a/nipype/interfaces/cmtk/parcellation.py +++ b/nipype/interfaces/cmtk/parcellation.py @@ -10,7 +10,6 @@ from ... import logging from ..base import ( - BaseInterface, LibraryBaseInterface, BaseInterfaceInputSpec, traits, @@ -19,7 +18,6 @@ Directory, isdefined, ) -from .base import have_cmp iflogger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/dipy/base.py b/nipype/interfaces/dipy/base.py index 12ca3be085..ec19d1fe7b 100644 --- a/nipype/interfaces/dipy/base.py +++ b/nipype/interfaces/dipy/base.py @@ -3,7 +3,6 @@ import os.path as op import inspect import numpy as np -from ... import logging from ..base import ( traits, File, diff --git a/nipype/interfaces/dipy/reconstruction.py b/nipype/interfaces/dipy/reconstruction.py index 1b07bbf6d4..084fd7c501 100644 --- a/nipype/interfaces/dipy/reconstruction.py +++ b/nipype/interfaces/dipy/reconstruction.py @@ -85,7 +85,6 @@ class RESTORE(DipyDiffusionInterface): def _run_interface(self, runtime): from scipy.special import gamma from dipy.reconst.dti import TensorModel - import gc img = nb.load(self.inputs.in_file) hdr = img.header.copy() @@ -222,7 +221,6 @@ class EstimateResponseSH(DipyDiffusionInterface): output_spec = EstimateResponseSHOutputSpec def _run_interface(self, runtime): - from dipy.core.gradients import GradientTable from dipy.reconst.dti import fractional_anisotropy, mean_diffusivity from dipy.reconst.csdeconv import recursive_response, auto_response diff --git a/nipype/interfaces/dipy/simulate.py b/nipype/interfaces/dipy/simulate.py index 3fc812e365..6959e0a31d 100644 --- a/nipype/interfaces/dipy/simulate.py +++ b/nipype/interfaces/dipy/simulate.py @@ -324,7 +324,7 @@ def _generate_gradients(ndirs=64, values=[1000, 3000], nb0s=1): """ import numpy as np - from dipy.core.sphere import disperse_charges, Sphere, HemiSphere + from dipy.core.sphere import disperse_charges, HemiSphere from dipy.core.gradients import gradient_table theta = np.pi * np.random.rand(ndirs) diff --git a/nipype/interfaces/freesurfer/longitudinal.py b/nipype/interfaces/freesurfer/longitudinal.py index 923ef45eee..227ea76775 100644 --- a/nipype/interfaces/freesurfer/longitudinal.py +++ b/nipype/interfaces/freesurfer/longitudinal.py @@ -13,18 +13,13 @@ InputMultiPath, OutputMultiPath, isdefined, - InputMultiObject, - Directory, ) from .base import ( FSCommand, FSTraitedSpec, FSCommandOpenMP, FSTraitedSpecOpenMP, - CommandLine, ) -from .preprocess import ReconAllInputSpec -from ..io import FreeSurferSource __docformat__ = "restructuredtext" iflogger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/freesurfer/tests/test_model.py b/nipype/interfaces/freesurfer/tests/test_model.py index 0c56a87522..f300edf3a1 100644 --- a/nipype/interfaces/freesurfer/tests/test_model.py +++ b/nipype/interfaces/freesurfer/tests/test_model.py @@ -1,7 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os import numpy as np import nibabel as nb diff --git a/nipype/interfaces/fsl/aroma.py b/nipype/interfaces/fsl/aroma.py index 85033a3f88..b699cd47e2 100644 --- a/nipype/interfaces/fsl/aroma.py +++ b/nipype/interfaces/fsl/aroma.py @@ -11,7 +11,6 @@ File, Directory, traits, - isdefined, ) import os diff --git a/nipype/interfaces/fsl/tests/test_base.py b/nipype/interfaces/fsl/tests/test_base.py index d87bc73d70..2b07381e81 100644 --- a/nipype/interfaces/fsl/tests/test_base.py +++ b/nipype/interfaces/fsl/tests/test_base.py @@ -4,7 +4,7 @@ import nipype.interfaces.fsl as fsl from nipype.interfaces.base import InterfaceResult -from nipype.interfaces.fsl import check_fsl, no_fsl +from nipype.interfaces.fsl import no_fsl import pytest diff --git a/nipype/interfaces/fsl/tests/test_epi.py b/nipype/interfaces/fsl/tests/test_epi.py index 6e796324a8..715da57f7d 100644 --- a/nipype/interfaces/fsl/tests/test_epi.py +++ b/nipype/interfaces/fsl/tests/test_epi.py @@ -1,6 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os import pytest from nipype.testing.fixtures import create_files_in_directory diff --git a/nipype/interfaces/fsl/tests/test_model.py b/nipype/interfaces/fsl/tests/test_model.py index 7278f1f6aa..5b43850c43 100644 --- a/nipype/interfaces/fsl/tests/test_model.py +++ b/nipype/interfaces/fsl/tests/test_model.py @@ -1,6 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os import pytest import nipype.interfaces.fsl.model as fsl diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index 7f076f8d30..143179a5ec 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -4,7 +4,6 @@ from copy import deepcopy import pytest -import pdb from nipype.utils.filemanip import split_filename, ensure_list from .. import preprocess as fsl from nipype.interfaces.fsl import Info @@ -579,7 +578,6 @@ def test_applywarp(setup_flirt): def setup_fugue(tmpdir): import nibabel as nb import numpy as np - import os.path as op d = np.ones((80, 80, 80)) infile = tmpdir.join("dumbfile.nii.gz").strpath diff --git a/nipype/interfaces/fsl/tests/test_utils.py b/nipype/interfaces/fsl/tests/test_utils.py index 8c295a9fb4..bfe895c6ee 100644 --- a/nipype/interfaces/fsl/tests/test_utils.py +++ b/nipype/interfaces/fsl/tests/test_utils.py @@ -5,10 +5,9 @@ import numpy as np -import nibabel as nb import pytest import nipype.interfaces.fsl.utils as fsl -from nipype.interfaces.fsl import no_fsl, Info +from nipype.interfaces.fsl import no_fsl from nipype.testing.fixtures import create_files_in_directory_plus_output_type diff --git a/nipype/interfaces/minc/testdata.py b/nipype/interfaces/minc/testdata.py index 9bd06355d1..1d2ff36d6f 100644 --- a/nipype/interfaces/minc/testdata.py +++ b/nipype/interfaces/minc/testdata.py @@ -1,4 +1,3 @@ -import os from ...testing import example_data minc2Dfile = example_data("minc_test_2D_00.mnc") diff --git a/nipype/interfaces/mipav/developer.py b/nipype/interfaces/mipav/developer.py index f0d67eb9ba..a76f2e35c4 100644 --- a/nipype/interfaces/mipav/developer.py +++ b/nipype/interfaces/mipav/developer.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ..base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/mrtrix/convert.py b/nipype/interfaces/mrtrix/convert.py index f47bc0eff2..783974c667 100644 --- a/nipype/interfaces/mrtrix/convert.py +++ b/nipype/interfaces/mrtrix/convert.py @@ -9,7 +9,7 @@ from ... import logging from ...utils.filemanip import split_filename from ..base import TraitedSpec, File, isdefined -from ..dipy.base import DipyBaseInterface, HAVE_DIPY as have_dipy +from ..dipy.base import DipyBaseInterface iflogger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/mrtrix3/base.py b/nipype/interfaces/mrtrix3/base.py index fb13ee2871..cd5d492fcf 100644 --- a/nipype/interfaces/mrtrix3/base.py +++ b/nipype/interfaces/mrtrix3/base.py @@ -5,7 +5,6 @@ from looseversion import LooseVersion from ... import logging -from ...utils.filemanip import which from ..base import ( CommandLineInputSpec, CommandLine, diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 8f9ddccca8..57cdad0168 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -12,7 +12,6 @@ InputMultiObject, TraitedSpec, Undefined, - isdefined, traits, Tuple, ) diff --git a/nipype/interfaces/nipy/preprocess.py b/nipype/interfaces/nipy/preprocess.py index af31a1ef19..a85c8d3ad4 100644 --- a/nipype/interfaces/nipy/preprocess.py +++ b/nipype/interfaces/nipy/preprocess.py @@ -5,7 +5,7 @@ from ...utils.filemanip import split_filename, fname_presuffix -from .base import NipyBaseInterface, have_nipy +from .base import NipyBaseInterface from ..base import ( TraitedSpec, traits, diff --git a/nipype/interfaces/nipy/utils.py b/nipype/interfaces/nipy/utils.py index cdbb5ea46a..96773f27dc 100644 --- a/nipype/interfaces/nipy/utils.py +++ b/nipype/interfaces/nipy/utils.py @@ -2,7 +2,7 @@ import numpy as np import nibabel as nb -from .base import NipyBaseInterface, have_nipy +from .base import NipyBaseInterface from ..base import TraitedSpec, traits, BaseInterfaceInputSpec, File, isdefined diff --git a/nipype/interfaces/r.py b/nipype/interfaces/r.py index 780484bdf8..1894d00960 100644 --- a/nipype/interfaces/r.py +++ b/nipype/interfaces/r.py @@ -4,15 +4,12 @@ import os from shutil import which -from .. import config from .base import ( CommandLineInputSpec, - InputMultiPath, isdefined, CommandLine, traits, File, - Directory, ) diff --git a/nipype/interfaces/robex/preprocess.py b/nipype/interfaces/robex/preprocess.py index 85660f8211..b2e92e94cb 100644 --- a/nipype/interfaces/robex/preprocess.py +++ b/nipype/interfaces/robex/preprocess.py @@ -1,15 +1,10 @@ -import os -from pathlib import Path - from nipype.interfaces.base import ( TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, - isdefined, ) -from nipype.utils.filemanip import split_filename class RobexInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/semtools/brains/classify.py b/nipype/interfaces/semtools/brains/classify.py index e1305471f0..149e63c95e 100644 --- a/nipype/interfaces/semtools/brains/classify.py +++ b/nipype/interfaces/semtools/brains/classify.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/brains/segmentation.py b/nipype/interfaces/semtools/brains/segmentation.py index 75105fc0aa..a6dbfbd449 100644 --- a/nipype/interfaces/semtools/brains/segmentation.py +++ b/nipype/interfaces/semtools/brains/segmentation.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/brains/utilities.py b/nipype/interfaces/semtools/brains/utilities.py index 5f76478156..3b5596e6d7 100644 --- a/nipype/interfaces/semtools/brains/utilities.py +++ b/nipype/interfaces/semtools/brains/utilities.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/converters.py b/nipype/interfaces/semtools/converters.py index 65fd1d4739..091f832b2b 100644 --- a/nipype/interfaces/semtools/converters.py +++ b/nipype/interfaces/semtools/converters.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ..base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/diffusion.py b/nipype/interfaces/semtools/diffusion/diffusion.py index e990606e77..6a85d5cd7a 100644 --- a/nipype/interfaces/semtools/diffusion/diffusion.py +++ b/nipype/interfaces/semtools/diffusion/diffusion.py @@ -1,19 +1,14 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/gtract.py b/nipype/interfaces/semtools/diffusion/gtract.py index d9bace5e59..58d7264864 100644 --- a/nipype/interfaces/semtools/diffusion/gtract.py +++ b/nipype/interfaces/semtools/diffusion/gtract.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/maxcurvature.py b/nipype/interfaces/semtools/diffusion/maxcurvature.py index 66c147ad81..86a7580f2d 100644 --- a/nipype/interfaces/semtools/diffusion/maxcurvature.py +++ b/nipype/interfaces/semtools/diffusion/maxcurvature.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/tractography/commandlineonly.py b/nipype/interfaces/semtools/diffusion/tractography/commandlineonly.py index fe4520f9df..e03c8fde9e 100644 --- a/nipype/interfaces/semtools/diffusion/tractography/commandlineonly.py +++ b/nipype/interfaces/semtools/diffusion/tractography/commandlineonly.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ....base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/tractography/fiberprocess.py b/nipype/interfaces/semtools/diffusion/tractography/fiberprocess.py index d20a7cba53..7efb9c9e23 100644 --- a/nipype/interfaces/semtools/diffusion/tractography/fiberprocess.py +++ b/nipype/interfaces/semtools/diffusion/tractography/fiberprocess.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ....base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/tractography/fibertrack.py b/nipype/interfaces/semtools/diffusion/tractography/fibertrack.py index 663010632c..1fa64180d5 100644 --- a/nipype/interfaces/semtools/diffusion/tractography/fibertrack.py +++ b/nipype/interfaces/semtools/diffusion/tractography/fibertrack.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ....base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/diffusion/tractography/ukftractography.py b/nipype/interfaces/semtools/diffusion/tractography/ukftractography.py index cc3619f8ec..fc8035762d 100644 --- a/nipype/interfaces/semtools/diffusion/tractography/ukftractography.py +++ b/nipype/interfaces/semtools/diffusion/tractography/ukftractography.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ....base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/featurecreator.py b/nipype/interfaces/semtools/featurecreator.py index 85c72a993f..08482853a5 100644 --- a/nipype/interfaces/semtools/featurecreator.py +++ b/nipype/interfaces/semtools/featurecreator.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ..base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/filtering/denoising.py b/nipype/interfaces/semtools/filtering/denoising.py index 22575b7842..9afd9184fa 100644 --- a/nipype/interfaces/semtools/filtering/denoising.py +++ b/nipype/interfaces/semtools/filtering/denoising.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/filtering/featuredetection.py b/nipype/interfaces/semtools/filtering/featuredetection.py index 7e72c2c2b4..b61cf59a11 100644 --- a/nipype/interfaces/semtools/filtering/featuredetection.py +++ b/nipype/interfaces/semtools/filtering/featuredetection.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/legacy/registration.py b/nipype/interfaces/semtools/legacy/registration.py index e899aa44ab..b0755aff40 100644 --- a/nipype/interfaces/semtools/legacy/registration.py +++ b/nipype/interfaces/semtools/legacy/registration.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/registration/brainsfit.py b/nipype/interfaces/semtools/registration/brainsfit.py index 41d8b2c77f..0ed5dd2be9 100644 --- a/nipype/interfaces/semtools/registration/brainsfit.py +++ b/nipype/interfaces/semtools/registration/brainsfit.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/registration/brainsresample.py b/nipype/interfaces/semtools/registration/brainsresample.py index f7351f17c4..37f2eeb69b 100644 --- a/nipype/interfaces/semtools/registration/brainsresample.py +++ b/nipype/interfaces/semtools/registration/brainsresample.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/registration/brainsresize.py b/nipype/interfaces/semtools/registration/brainsresize.py index ae4c50fe83..f86d7d9e62 100644 --- a/nipype/interfaces/semtools/registration/brainsresize.py +++ b/nipype/interfaces/semtools/registration/brainsresize.py @@ -1,19 +1,12 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/registration/specialized.py b/nipype/interfaces/semtools/registration/specialized.py index 61e71611e7..68a6a0b993 100644 --- a/nipype/interfaces/semtools/registration/specialized.py +++ b/nipype/interfaces/semtools/registration/specialized.py @@ -1,19 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/segmentation/specialized.py b/nipype/interfaces/semtools/segmentation/specialized.py index b00c2309eb..d4f1ab1b07 100644 --- a/nipype/interfaces/semtools/segmentation/specialized.py +++ b/nipype/interfaces/semtools/segmentation/specialized.py @@ -1,17 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, InputMultiPath, OutputMultiPath, ) diff --git a/nipype/interfaces/semtools/testing/featuredetection.py b/nipype/interfaces/semtools/testing/featuredetection.py index 59d7dd3ea7..67aa38746d 100644 --- a/nipype/interfaces/semtools/testing/featuredetection.py +++ b/nipype/interfaces/semtools/testing/featuredetection.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class SphericalCoordinateGenerationInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/semtools/testing/generateaveragelmkfile.py b/nipype/interfaces/semtools/testing/generateaveragelmkfile.py index b1c701a119..9235e63dd2 100644 --- a/nipype/interfaces/semtools/testing/generateaveragelmkfile.py +++ b/nipype/interfaces/semtools/testing/generateaveragelmkfile.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class GenerateAverageLmkFileInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/semtools/testing/landmarkscompare.py b/nipype/interfaces/semtools/testing/landmarkscompare.py index a03ce653af..7d628518a8 100644 --- a/nipype/interfaces/semtools/testing/landmarkscompare.py +++ b/nipype/interfaces/semtools/testing/landmarkscompare.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class LandmarksCompareInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/semtools/utilities/brains.py b/nipype/interfaces/semtools/utilities/brains.py index a7b2591f09..de38a52fc2 100644 --- a/nipype/interfaces/semtools/utilities/brains.py +++ b/nipype/interfaces/semtools/utilities/brains.py @@ -1,17 +1,13 @@ """Autogenerated file - DO NOT EDIT If you spot a bug, please report it on the mailing list and/or change the generator.""" -import os - from ...base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, InputMultiPath, OutputMultiPath, ) diff --git a/nipype/interfaces/slicer/converters.py b/nipype/interfaces/slicer/converters.py index f9aa9e458b..1be9651f55 100644 --- a/nipype/interfaces/slicer/converters.py +++ b/nipype/interfaces/slicer/converters.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class DicomToNrrdConverterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/diffusion/diffusion.py b/nipype/interfaces/slicer/diffusion/diffusion.py index 56d398b3b3..3238981562 100644 --- a/nipype/interfaces/slicer/diffusion/diffusion.py +++ b/nipype/interfaces/slicer/diffusion/diffusion.py @@ -2,18 +2,14 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class ResampleDTIVolumeInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/arithmetic.py b/nipype/interfaces/slicer/filtering/arithmetic.py index 47fb8da82b..8b729d8c6a 100644 --- a/nipype/interfaces/slicer/filtering/arithmetic.py +++ b/nipype/interfaces/slicer/filtering/arithmetic.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class MultiplyScalarVolumesInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/checkerboardfilter.py b/nipype/interfaces/slicer/filtering/checkerboardfilter.py index 429fdc83b8..336d0b13d7 100644 --- a/nipype/interfaces/slicer/filtering/checkerboardfilter.py +++ b/nipype/interfaces/slicer/filtering/checkerboardfilter.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class CheckerBoardFilterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/denoising.py b/nipype/interfaces/slicer/filtering/denoising.py index fa8518c1bc..e5d1135038 100644 --- a/nipype/interfaces/slicer/filtering/denoising.py +++ b/nipype/interfaces/slicer/filtering/denoising.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class GradientAnisotropicDiffusionInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/extractskeleton.py b/nipype/interfaces/slicer/filtering/extractskeleton.py index d0ec5ffe98..8b873bad98 100644 --- a/nipype/interfaces/slicer/filtering/extractskeleton.py +++ b/nipype/interfaces/slicer/filtering/extractskeleton.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class ExtractSkeletonInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/histogrammatching.py b/nipype/interfaces/slicer/filtering/histogrammatching.py index c9eb9af89c..df1d87bd2f 100644 --- a/nipype/interfaces/slicer/filtering/histogrammatching.py +++ b/nipype/interfaces/slicer/filtering/histogrammatching.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class HistogramMatchingInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/imagelabelcombine.py b/nipype/interfaces/slicer/filtering/imagelabelcombine.py index b8e2202d4d..6941ff05fe 100644 --- a/nipype/interfaces/slicer/filtering/imagelabelcombine.py +++ b/nipype/interfaces/slicer/filtering/imagelabelcombine.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class ImageLabelCombineInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/morphology.py b/nipype/interfaces/slicer/filtering/morphology.py index 8338f56407..bd1232dece 100644 --- a/nipype/interfaces/slicer/filtering/morphology.py +++ b/nipype/interfaces/slicer/filtering/morphology.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class GrayscaleGrindPeakImageFilterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/n4itkbiasfieldcorrection.py b/nipype/interfaces/slicer/filtering/n4itkbiasfieldcorrection.py index ccf066f4da..69768e3b7e 100644 --- a/nipype/interfaces/slicer/filtering/n4itkbiasfieldcorrection.py +++ b/nipype/interfaces/slicer/filtering/n4itkbiasfieldcorrection.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class N4ITKBiasFieldCorrectionInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/resamplescalarvectordwivolume.py b/nipype/interfaces/slicer/filtering/resamplescalarvectordwivolume.py index 74db29363a..e9d6a8271f 100644 --- a/nipype/interfaces/slicer/filtering/resamplescalarvectordwivolume.py +++ b/nipype/interfaces/slicer/filtering/resamplescalarvectordwivolume.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class ResampleScalarVectorDWIVolumeInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/thresholdscalarvolume.py b/nipype/interfaces/slicer/filtering/thresholdscalarvolume.py index 0bcf5b413c..d5f0cef21f 100644 --- a/nipype/interfaces/slicer/filtering/thresholdscalarvolume.py +++ b/nipype/interfaces/slicer/filtering/thresholdscalarvolume.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class ThresholdScalarVolumeInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/filtering/votingbinaryholefillingimagefilter.py b/nipype/interfaces/slicer/filtering/votingbinaryholefillingimagefilter.py index 73c7ed5b47..9903b07793 100644 --- a/nipype/interfaces/slicer/filtering/votingbinaryholefillingimagefilter.py +++ b/nipype/interfaces/slicer/filtering/votingbinaryholefillingimagefilter.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class VotingBinaryHoleFillingImageFilterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/legacy/converters.py b/nipype/interfaces/slicer/legacy/converters.py index 053415b189..c5f0ecd21a 100644 --- a/nipype/interfaces/slicer/legacy/converters.py +++ b/nipype/interfaces/slicer/legacy/converters.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class BSplineToDeformationFieldInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/legacy/diffusion/denoising.py b/nipype/interfaces/slicer/legacy/diffusion/denoising.py index 5adda02a5a..8cccf949bb 100644 --- a/nipype/interfaces/slicer/legacy/diffusion/denoising.py +++ b/nipype/interfaces/slicer/legacy/diffusion/denoising.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class DWIUnbiasedNonLocalMeansFilterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/legacy/filtering.py b/nipype/interfaces/slicer/legacy/filtering.py index 749ba3942c..978752f25b 100644 --- a/nipype/interfaces/slicer/legacy/filtering.py +++ b/nipype/interfaces/slicer/legacy/filtering.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class OtsuThresholdImageFilterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/legacy/registration.py b/nipype/interfaces/slicer/legacy/registration.py index 7eee2b069e..01c9d17cb8 100644 --- a/nipype/interfaces/slicer/legacy/registration.py +++ b/nipype/interfaces/slicer/legacy/registration.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class BSplineDeformableRegistrationInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/legacy/segmentation.py b/nipype/interfaces/slicer/legacy/segmentation.py index 0f51afe35c..664d9913ae 100644 --- a/nipype/interfaces/slicer/legacy/segmentation.py +++ b/nipype/interfaces/slicer/legacy/segmentation.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class OtsuThresholdSegmentationInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/quantification/changequantification.py b/nipype/interfaces/slicer/quantification/changequantification.py index 0e0f5dc20a..952a8d6e1d 100644 --- a/nipype/interfaces/slicer/quantification/changequantification.py +++ b/nipype/interfaces/slicer/quantification/changequantification.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class IntensityDifferenceMetricInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/quantification/petstandarduptakevaluecomputation.py b/nipype/interfaces/slicer/quantification/petstandarduptakevaluecomputation.py index 2c4c337dac..4861eca651 100644 --- a/nipype/interfaces/slicer/quantification/petstandarduptakevaluecomputation.py +++ b/nipype/interfaces/slicer/quantification/petstandarduptakevaluecomputation.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class PETStandardUptakeValueComputationInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/registration/brainsfit.py b/nipype/interfaces/slicer/registration/brainsfit.py index c9b61e8da0..079d538499 100644 --- a/nipype/interfaces/slicer/registration/brainsfit.py +++ b/nipype/interfaces/slicer/registration/brainsfit.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class BRAINSFitInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/registration/brainsresample.py b/nipype/interfaces/slicer/registration/brainsresample.py index 201bbeab55..82a69f6d0a 100644 --- a/nipype/interfaces/slicer/registration/brainsresample.py +++ b/nipype/interfaces/slicer/registration/brainsresample.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class BRAINSResampleInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/registration/specialized.py b/nipype/interfaces/slicer/registration/specialized.py index e03f1a95b1..30688928c2 100644 --- a/nipype/interfaces/slicer/registration/specialized.py +++ b/nipype/interfaces/slicer/registration/specialized.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class ACPCTransformInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/segmentation/simpleregiongrowingsegmentation.py b/nipype/interfaces/slicer/segmentation/simpleregiongrowingsegmentation.py index 98af4fdc1b..4d652ffb0e 100644 --- a/nipype/interfaces/slicer/segmentation/simpleregiongrowingsegmentation.py +++ b/nipype/interfaces/slicer/segmentation/simpleregiongrowingsegmentation.py @@ -2,18 +2,13 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class SimpleRegionGrowingSegmentationInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/segmentation/specialized.py b/nipype/interfaces/slicer/segmentation/specialized.py index 90374ddd0c..fc278b1da5 100644 --- a/nipype/interfaces/slicer/segmentation/specialized.py +++ b/nipype/interfaces/slicer/segmentation/specialized.py @@ -2,18 +2,14 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, - isdefined, InputMultiPath, - OutputMultiPath, ) -import os class RobustStatisticsSegmenterInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/surface.py b/nipype/interfaces/slicer/surface.py index 7a4c77af70..3993e5028d 100644 --- a/nipype/interfaces/slicer/surface.py +++ b/nipype/interfaces/slicer/surface.py @@ -2,18 +2,14 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, InputMultiPath, OutputMultiPath, ) -import os class MergeModelsInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/slicer/utilities.py b/nipype/interfaces/slicer/utilities.py index 2e0eae1165..eb079766c9 100644 --- a/nipype/interfaces/slicer/utilities.py +++ b/nipype/interfaces/slicer/utilities.py @@ -2,18 +2,12 @@ If you spot a bug, please report it on the mailing list and/or change the generator.""" from nipype.interfaces.base import ( - CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, - Directory, traits, - isdefined, - InputMultiPath, - OutputMultiPath, ) -import os class EMSegmentTransformToNewFormatInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/spm/base.py b/nipype/interfaces/spm/base.py index ac20682696..e6b898c78b 100644 --- a/nipype/interfaces/spm/base.py +++ b/nipype/interfaces/spm/base.py @@ -38,7 +38,7 @@ ) from ..base.traits_extension import NoDefaultSpecified from ..matlab import MatlabCommand -from ...external.due import due, Doi, BibTeX +from ...external.due import BibTeX __docformat__ = "restructuredtext" logger = logging.getLogger("nipype.interface") diff --git a/nipype/interfaces/tests/test_extra_dcm2nii.py b/nipype/interfaces/tests/test_extra_dcm2nii.py index 0b0c132f7d..b093d26e6d 100644 --- a/nipype/interfaces/tests/test_extra_dcm2nii.py +++ b/nipype/interfaces/tests/test_extra_dcm2nii.py @@ -1,6 +1,5 @@ import os import pytest -import shutil from nipype.interfaces.dcm2nii import Dcm2niix diff --git a/nipype/interfaces/utility/tests/test_wrappers.py b/nipype/interfaces/utility/tests/test_wrappers.py index f3e378c2c3..345d6483ad 100644 --- a/nipype/interfaces/utility/tests/test_wrappers.py +++ b/nipype/interfaces/utility/tests/test_wrappers.py @@ -1,6 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os import pytest from nipype.interfaces import utility diff --git a/nipype/pipeline/engine/base.py b/nipype/pipeline/engine/base.py index f2e1009884..27d3426863 100644 --- a/nipype/pipeline/engine/base.py +++ b/nipype/pipeline/engine/base.py @@ -3,7 +3,6 @@ """Defines functionality for pipelined execution of interfaces.""" from copy import deepcopy import re -import numpy as np from ... import config from ...interfaces.base import DynamicTraitedSpec diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 5f357abb00..d2d7705408 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -36,7 +36,6 @@ from ...interfaces.base import ( traits, InputMultiPath, - CommandLine, Undefined, DynamicTraitedSpec, Bunch, diff --git a/nipype/pipeline/plugins/tests/test_somaflow.py b/nipype/pipeline/plugins/tests/test_somaflow.py index f9a6a07b16..4c074522d8 100644 --- a/nipype/pipeline/plugins/tests/test_somaflow.py +++ b/nipype/pipeline/plugins/tests/test_somaflow.py @@ -1,5 +1,4 @@ import os -from time import sleep import nipype.interfaces.base as nib import pytest diff --git a/nipype/pipeline/plugins/tests/test_tools.py b/nipype/pipeline/plugins/tests/test_tools.py index 454621573e..e21ef42072 100644 --- a/nipype/pipeline/plugins/tests/test_tools.py +++ b/nipype/pipeline/plugins/tests/test_tools.py @@ -2,8 +2,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """Tests for the engine module """ -import numpy as np -import scipy.sparse as ssp import re from unittest import mock diff --git a/nipype/refs.py b/nipype/refs.py index 0478d7ceed..9d81b314eb 100644 --- a/nipype/refs.py +++ b/nipype/refs.py @@ -1,7 +1,7 @@ # Use duecredit (duecredit.org) to provide a citation to relevant work to # be cited. This does nothing, unless the user has duecredit installed, # And calls this with duecredit (as in `python -m duecredit script.py`): -from .external.due import due, Doi, BibTeX +from .external.due import due, Doi due.cite( Doi("10.3389/fninf.2011.00013"), diff --git a/nipype/scripts/crash_files.py b/nipype/scripts/crash_files.py index 84464ccddb..1caa0c430b 100644 --- a/nipype/scripts/crash_files.py +++ b/nipype/scripts/crash_files.py @@ -1,7 +1,5 @@ """Utilities to manipulate and search through .pklz crash files.""" -import re -import sys import os.path as op from glob import glob diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index ff8b02249a..ca95f56fa3 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -113,7 +113,6 @@ import re import textwrap from os.path import relpath -from errno import EEXIST import traceback missing_imports = [] diff --git a/nipype/testing/tests/test_utils.py b/nipype/testing/tests/test_utils.py index 0055038392..9217d54694 100644 --- a/nipype/testing/tests/test_utils.py +++ b/nipype/testing/tests/test_utils.py @@ -4,7 +4,6 @@ """ import os -import warnings import subprocess from unittest.mock import patch, MagicMock from unittest import SkipTest diff --git a/nipype/utils/config.py b/nipype/utils/config.py index e7ec7fd64b..8317270d83 100644 --- a/nipype/utils/config.py +++ b/nipype/utils/config.py @@ -15,7 +15,6 @@ from warnings import warn from looseversion import LooseVersion import configparser -import numpy as np from simplejson import load, dump diff --git a/nipype/utils/draw_gantt_chart.py b/nipype/utils/draw_gantt_chart.py index ef4ec58ec2..3ae4b77246 100644 --- a/nipype/utils/draw_gantt_chart.py +++ b/nipype/utils/draw_gantt_chart.py @@ -5,7 +5,6 @@ ``nipype.utils.profiler.log_nodes_cb()`` """ # Import packages -import sys import random import datetime import simplejson as json diff --git a/nipype/utils/nipype_cmd.py b/nipype/utils/nipype_cmd.py index eabe84d4c3..ec0f603f3f 100644 --- a/nipype/utils/nipype_cmd.py +++ b/nipype/utils/nipype_cmd.py @@ -5,7 +5,6 @@ from ..interfaces.base import Interface, InputMultiPath, traits from ..interfaces.base.support import get_trait_desc -from .misc import str2bool def listClasses(module=None): diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index a104903a06..be16a9cea1 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -26,7 +26,6 @@ get_related_files, indirectory, loadpkl, - loadcrash, savepkl, path_resolve, write_rst_list, diff --git a/nipype/utils/tests/test_provenance.py b/nipype/utils/tests/test_provenance.py index ffdabd6f83..f440acb2ed 100644 --- a/nipype/utils/tests/test_provenance.py +++ b/nipype/utils/tests/test_provenance.py @@ -1,6 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -import os from nibabel.optpkg import optional_package import pytest From 2bd015b1ae58057367783d49aaecbcce36cbc6b6 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:18:28 +0200 Subject: [PATCH 2/6] STY: Apply ruff/Pyflakes rule F523 F523 `.format` call has unused arguments --- nipype/pipeline/engine/nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index d2d7705408..31ee29e04d 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -1381,7 +1381,7 @@ def _run_interface(self, execute=True, updatehash=False): ) ) except Exception as msg: - result.runtime.stderr = "%s\n\n%s".format( + result.runtime.stderr = "{}\n\n{}".format( getattr(result.runtime, "stderr", ""), msg ) _save_resultfile( From 968771c2d36ec3eb35bf7c9443b7cb8a07afbd7a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:21:13 +0200 Subject: [PATCH 3/6] STY: Apply ruff/Pyflakes rule F541 F541 f-string without any placeholders --- nipype/interfaces/cat12/preprocess.py | 2 +- nipype/utils/provenance.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/cat12/preprocess.py b/nipype/interfaces/cat12/preprocess.py index ebc436c674..0153c556fd 100644 --- a/nipype/interfaces/cat12/preprocess.py +++ b/nipype/interfaces/cat12/preprocess.py @@ -576,7 +576,7 @@ def _list_outputs(self): ] outputs["report"] = fname_presuffix( - f, prefix=os.path.join("report", f"cat_"), suffix=".xml", use_ext=False + f, prefix=os.path.join("report", "cat_"), suffix=".xml", use_ext=False ) outputs["label_files"] = [ diff --git a/nipype/utils/provenance.py b/nipype/utils/provenance.py index 95e54d405d..ba71ac6d6e 100644 --- a/nipype/utils/provenance.py +++ b/nipype/utils/provenance.py @@ -120,7 +120,7 @@ def _get_sorteddict(object, dictwithhash=False): else: out = hash elif isinstance(object, float): - out = f"%.10f" + out = f"{object:.10f}" else: out = object return out From d6b775f79224b9b888e186dee5a6929f441861de Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:14:08 +0200 Subject: [PATCH 4/6] STY: Apply ruff/Pyflakes rule F821 F821 Undefined name I have left some occurrences, to be fixed in a later pull request. --- nipype/interfaces/ants/resampling.py | 4 ++-- nipype/interfaces/cmtk/parcellation.py | 15 ++++++++------- nipype/interfaces/mrtrix3/connectivity.py | 4 ++-- nipype/interfaces/vtkbase.py | 2 +- nipype/pipeline/plugins/tests/test_oar.py | 1 + nipype/utils/filemanip.py | 5 +++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index 2b1da8e9f5..95f29d5982 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -122,7 +122,7 @@ def _format_arg(self, opt, spec, val): if isdefined(self.inputs.invert_affine): diff_inv = set(self.inputs.invert_affine) - set(affine_invert) if diff_inv: - raise Exceptions( + raise Exception( "Review invert_affine, not all indexes from invert_affine were used, " "check the description for the full definition" ) @@ -275,7 +275,7 @@ def _format_arg(self, opt, spec, val): if isdefined(self.inputs.invert_affine): diff_inv = set(self.inputs.invert_affine) - set(affine_invert) if diff_inv: - raise Exceptions( + raise Exception( "Review invert_affine, not all indexes from invert_affine were used, " "check the description for the full definition" ) diff --git a/nipype/interfaces/cmtk/parcellation.py b/nipype/interfaces/cmtk/parcellation.py index cbde492fb6..65062247d8 100644 --- a/nipype/interfaces/cmtk/parcellation.py +++ b/nipype/interfaces/cmtk/parcellation.py @@ -23,7 +23,7 @@ def create_annot_label(subject_id, subjects_dir, fs_dir, parcellation_name): - import cmp + from cmp.configuration import PipelineConfiguration from cmp.util import runCmd iflogger.info("Create the cortical labels necessary for our ROIs") @@ -31,7 +31,7 @@ def create_annot_label(subject_id, subjects_dir, fs_dir, parcellation_name): fs_label_dir = op.join(op.join(subjects_dir, subject_id), "label") output_dir = op.abspath(op.curdir) paths = [] - cmp_config = cmp.configuration.PipelineConfiguration() + cmp_config = PipelineConfiguration() cmp_config.parcellation_scheme = "Lausanne2008" for hemi in ["lh", "rh"]: spath = ( @@ -332,13 +332,13 @@ def create_annot_label(subject_id, subjects_dir, fs_dir, parcellation_name): def create_roi(subject_id, subjects_dir, fs_dir, parcellation_name, dilation): """Creates the ROI_%s.nii.gz files using the given parcellation information from networks. Iteratively create volume.""" - import cmp + from cmp.configuration import PipelineConfiguration from cmp.util import runCmd iflogger.info("Create the ROIs:") output_dir = op.abspath(op.curdir) fs_dir = op.join(subjects_dir, subject_id) - cmp_config = cmp.configuration.PipelineConfiguration() + cmp_config = PipelineConfiguration() cmp_config.parcellation_scheme = "Lausanne2008" log = cmp_config.get_logger() parval = cmp_config._get_lausanne_parcellation("Lausanne2008")[parcellation_name] @@ -467,12 +467,12 @@ def create_roi(subject_id, subjects_dir, fs_dir, parcellation_name, dilation): def create_wm_mask(subject_id, subjects_dir, fs_dir, parcellation_name): - import cmp + from cmp.configuration import PipelineConfiguration import scipy.ndimage.morphology as nd iflogger.info("Create white matter mask") fs_dir = op.join(subjects_dir, subject_id) - cmp_config = cmp.configuration.PipelineConfiguration() + cmp_config = PipelineConfiguration() cmp_config.parcellation_scheme = "Lausanne2008" pgpath = cmp_config._get_lausanne_parcellation("Lausanne2008")[parcellation_name][ "node_information_graphml" @@ -618,10 +618,11 @@ def create_wm_mask(subject_id, subjects_dir, fs_dir, parcellation_name): def crop_and_move_datasets( subject_id, subjects_dir, fs_dir, parcellation_name, out_roi_file, dilation ): + from cmp.configuration import PipelineConfiguration from cmp.util import runCmd fs_dir = op.join(subjects_dir, subject_id) - cmp_config = cmp.configuration.PipelineConfiguration() + cmp_config = PipelineConfiguration() cmp_config.parcellation_scheme = "Lausanne2008" log = cmp_config.get_logger() output_dir = op.abspath(op.curdir) diff --git a/nipype/interfaces/mrtrix3/connectivity.py b/nipype/interfaces/mrtrix3/connectivity.py index ed57ecdefc..a3dde940dc 100644 --- a/nipype/interfaces/mrtrix3/connectivity.py +++ b/nipype/interfaces/mrtrix3/connectivity.py @@ -212,7 +212,7 @@ def _parse_inputs(self, skip=None): path = which(self._cmd) if path is None: - path = os.getenv(MRTRIX3_HOME, "/opt/mrtrix3") + path = os.getenv("MRTRIX3_HOME", "/opt/mrtrix3") else: path = op.dirname(op.dirname(path)) @@ -304,7 +304,7 @@ def _parse_inputs(self, skip=None): path = which(self._cmd) if path is None: - path = os.getenv(MRTRIX3_HOME, "/opt/mrtrix3") + path = os.getenv("MRTRIX3_HOME", "/opt/mrtrix3") else: path = op.dirname(op.dirname(path)) diff --git a/nipype/interfaces/vtkbase.py b/nipype/interfaces/vtkbase.py index dffcb6e2a4..4b49d56815 100644 --- a/nipype/interfaces/vtkbase.py +++ b/nipype/interfaces/vtkbase.py @@ -63,7 +63,7 @@ def vtk_old(): """Checks if VTK uses the old-style pipeline (VTK<6.0)""" global _vtk_version if _vtk_version is None: - raise RuntimeException("VTK is not correctly installed.") + raise RuntimeError("VTK is not correctly installed.") return _vtk_version[0] < 6 diff --git a/nipype/pipeline/plugins/tests/test_oar.py b/nipype/pipeline/plugins/tests/test_oar.py index 57d0d54e84..fcb1efac6e 100644 --- a/nipype/pipeline/plugins/tests/test_oar.py +++ b/nipype/pipeline/plugins/tests/test_oar.py @@ -1,3 +1,4 @@ +import os from shutil import which import nipype.interfaces.base as nib diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 6aa0c5e74c..568ba28ae2 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -47,7 +47,7 @@ def split_filename(fname): fname : str filename from fname, without extension ext : str - file extension from fname + file extension from fname706 Examples -------- @@ -700,10 +700,11 @@ def savepkl(filename, record, versioning=False): os.rename(tmpfile, filename) break except FileNotFoundError as e: + last_e = e fmlogger.debug(str(e)) sleep(2) else: - raise e + raise last_e rst_levels = ["=", "-", "~", "+"] From 715d7cdf95be09604c8197a15c941b63ab71c7d4 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:38:21 +0200 Subject: [PATCH 5/6] STY: Apply ruff/Pyflakes rule F841 F841 Local variable is assigned to but never used I have left a few occurrences, to be examined later. --- nipype/__init__.py | 2 +- nipype/interfaces/cmtk/tests/test_nbs.py | 4 ++-- nipype/interfaces/io.py | 5 ++--- nipype/interfaces/tests/test_io.py | 2 +- nipype/interfaces/utility/tests/test_csv.py | 1 - nipype/pipeline/plugins/base.py | 2 +- nipype/pipeline/plugins/tests/test_sgelike.py | 2 +- nipype/sphinxext/plot_workflow.py | 2 +- nipype/utils/profiler.py | 2 +- 9 files changed, 10 insertions(+), 12 deletions(-) diff --git a/nipype/__init__.py b/nipype/__init__.py index 22e6f97c2d..54872f193e 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -25,7 +25,7 @@ import faulthandler faulthandler.enable() -except (ImportError, OSError) as e: +except (ImportError, OSError): pass config = NipypeConfig() diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 51ea9580cd..efc8aed678 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -8,7 +8,7 @@ have_cv = True try: package_check("cviewer") -except Exception as e: +except Exception: have_cv = False @@ -39,7 +39,7 @@ def test_importerror(creating_graphs, tmpdir): nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - with pytest.raises(ImportError) as e: + with pytest.raises(ImportError): nbs.run() diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index eb64dd141d..46cdfb44f2 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -530,7 +530,7 @@ def _fetch_bucket(self, bucket_name): try: import boto3 import botocore - except ImportError as exc: + except ImportError: err_msg = "Boto3 package is not installed - install boto3 and try again." raise Exception(err_msg) @@ -572,7 +572,7 @@ def _fetch_bucket(self, bucket_name): # And try fetch the bucket with the name argument try: _get_head_bucket(s3_resource, bucket_name) - except Exception as exc: + except Exception: # Try to connect anonymously s3_resource.meta.client.meta.events.register( "choose-signer.s3.*", botocore.handlers.disable_signing @@ -2619,7 +2619,6 @@ def _list_outputs(self): ) if len(arg) > maxlen: maxlen = len(arg) - outfiles = [] for i in range(maxlen): argtuple = [] for arg in arglist: diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index d0af921f09..fc7f03db9f 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -565,7 +565,7 @@ def test_freesurfersource(): def test_freesurfersource_incorrectdir(): fss = nio.FreeSurferSource() - with pytest.raises(TraitError) as err: + with pytest.raises(TraitError): fss.inputs.subjects_dir = "path/to/no/existing/directory" diff --git a/nipype/interfaces/utility/tests/test_csv.py b/nipype/interfaces/utility/tests/test_csv.py index 8a8f06e509..2ce78876cc 100644 --- a/nipype/interfaces/utility/tests/test_csv.py +++ b/nipype/interfaces/utility/tests/test_csv.py @@ -29,7 +29,6 @@ def test_csvReader(tmpdir): def test_csvReader_quoted(tmpdir): - header = "files,labels,erosion\n" lines = ['foo,"hello, world",300.1\n'] name = tmpdir.join("testfile.csv").strpath diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index 1ea62c890e..1571ab71a9 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -541,7 +541,7 @@ def _get_result(self, taskid): "Node working directory: ({}) ".format(taskid, timeout, node_dir) ) raise OSError(error_message) - except OSError as e: + except OSError: result_data["traceback"] = "\n".join(format_exception(*sys.exc_info())) else: results_file = glob(os.path.join(node_dir, "result_*.pklz"))[0] diff --git a/nipype/pipeline/plugins/tests/test_sgelike.py b/nipype/pipeline/plugins/tests/test_sgelike.py index a150309e1f..26c3d70a06 100644 --- a/nipype/pipeline/plugins/tests/test_sgelike.py +++ b/nipype/pipeline/plugins/tests/test_sgelike.py @@ -27,7 +27,7 @@ def test_crashfile_creation(tmp_path): pipe.config["execution"]["crashdump_dir"] = str(tmp_path) pipe.add_nodes([pe.Node(interface=Function(function=crasher), name="crasher")]) sgelike_plugin = SGELikeBatchManagerBase("") - with pytest.raises(RuntimeError) as e: + with pytest.raises(RuntimeError): assert pipe.run(plugin=sgelike_plugin) crashfiles = list(tmp_path.glob("crash*crasher*.pklz")) + list( diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index ca95f56fa3..74745f99cb 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -672,7 +672,7 @@ def _dummy_print(*arg, **kwarg): exec(code, ns) if function_name is not None: exec(function_name + "()", ns) - except (Exception, SystemExit) as err: + except (Exception, SystemExit): raise GraphError(traceback.format_exc()) finally: os.chdir(pwd) diff --git a/nipype/utils/profiler.py b/nipype/utils/profiler.py index 370097e90b..cc2b4f7905 100644 --- a/nipype/utils/profiler.py +++ b/nipype/utils/profiler.py @@ -10,7 +10,7 @@ try: import psutil -except ImportError as exc: +except ImportError: psutil = None From cb889bf15fa7601f21d4dd6b59e19b40fcdabc66 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:23:10 +0200 Subject: [PATCH 6/6] STY: Apply ruff/Pyflakes rule F901 F901 `raise NotImplemented` should be `raise NotImplementedError` --- nipype/interfaces/minc/minc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/minc/minc.py b/nipype/interfaces/minc/minc.py index dbcc1313f8..bf80e23732 100644 --- a/nipype/interfaces/minc/minc.py +++ b/nipype/interfaces/minc/minc.py @@ -3403,7 +3403,7 @@ def _gen_filename(self, name): + ".xfm" ) else: - raise NotImplemented + raise NotImplementedError def _list_outputs(self): outputs = self.output_spec().get() @@ -3502,7 +3502,7 @@ def _gen_filename(self, name): + ".xfm" ) else: - raise NotImplemented + raise NotImplementedError def _gen_outfilename(self): return self._gen_filename("output_file") @@ -3573,7 +3573,7 @@ def _gen_filename(self, name): + ".xfm" ) else: - raise NotImplemented + raise NotImplementedError def _gen_outfilename(self): return self._gen_filename("output_file")