Skip to content

Commit

Permalink
STY: Apply ruff/Pyflakes rule F821
Browse files Browse the repository at this point in the history
F821 Undefined name

I have left some occurrences, to be fixed in a later pull request.
  • Loading branch information
DimitriPapadopoulos committed Oct 6, 2024
1 parent 3e4ce28 commit 5248305
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions nipype/interfaces/ants/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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"
)
Expand Down
15 changes: 8 additions & 7 deletions nipype/interfaces/cmtk/parcellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@


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")
iflogger.info("=================================================")
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 = (
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/mrtrix3/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/vtkbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions nipype/pipeline/plugins/tests/test_oar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from shutil import which

import nipype.interfaces.base as nib
Expand Down
6 changes: 3 additions & 3 deletions nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------
Expand Down Expand Up @@ -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 = ["=", "-", "~", "+"]
Expand Down

0 comments on commit 5248305

Please sign in to comment.