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 c6f270e8c7..e0f8a7cf03 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 -------- @@ -702,8 +702,8 @@ def savepkl(filename, record, versioning=False): except FileNotFoundError as e: fmlogger.debug(str(e)) sleep(2) - else: - raise e + else: + raise rst_levels = ["=", "-", "~", "+"]