Skip to content

Commit 27b33ef

Browse files
authored
Merge pull request #2478 from mgxd/fix/lgtm
fix: some lgtm errors
2 parents f2aac9b + 5007c99 commit 27b33ef

24 files changed

+28
-555
lines changed

doc/users/nipypecmd.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This is especially useful when running Interfaces wrapping code that does not ha
1010
command line equivalents (nipy or SPM). Being able to run Nipype interfaces opens new
1111
possibilities such as inclusion of SPM processing steps in bash scripts.
1212

13-
To run Nipype Interafces you need to use the nipype_cmd tool that should already be installed.
13+
To run Nipype Interfaces you need to use the nipype_cmd tool that should already be installed.
1414
The tool allows you to list Interfaces available in a certain package:
1515

1616
.. testcode::
@@ -24,7 +24,6 @@ The tool allows you to list Interfaces available in a certain package:
2424
ComputeMask
2525
FitGLM
2626
EstimateContrast
27-
FmriRealign4d
2827

2928
After selecting a particular Interface you can learn what inputs it requires:
3029

doc/users/plugins.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ machinery.
103103

104104
.. note::
105105

106-
We provide backward compatibility with IPython_ versions earlier than
107-
0.10.1 using the IPythonX plugin. This plugin will be deprecated as of
108-
version 0.13 of Nipype.
109-
110106
Please read the IPython_ documentation to determine how to setup your cluster
111107
for distributed processing. This typically involves calling ipcluster.
112108

nipype/algorithms/misc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ def _list_outputs(self):
11841184
return outputs
11851185

11861186

1187-
def normalize_tpms(in_files, in_mask=None, out_files=[]):
1187+
def normalize_tpms(in_files, in_mask=None, out_files=None):
11881188
"""
11891189
Returns the input tissue probability maps (tpms, aka volume fractions)
11901190
normalized to sum up 1.0 at each voxel within the mask.
@@ -1195,6 +1195,9 @@ def normalize_tpms(in_files, in_mask=None, out_files=[]):
11951195

11961196
in_files = np.atleast_1d(in_files).tolist()
11971197

1198+
if out_files is None:
1199+
out_files = []
1200+
11981201
if len(out_files) != len(in_files):
11991202
for i, finname in enumerate(in_files):
12001203
fname, fext = op.splitext(op.basename(finname))

nipype/info.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ def get_nipype_gitversion():
120120
URL = 'http://nipy.org/nipype'
121121
DOWNLOAD_URL = 'http://github.com/nipy/nipype/archives/master'
122122
LICENSE = 'Apache License, 2.0'
123-
CLASSIFIERS = CLASSIFIERS
124123
AUTHOR = 'nipype developers'
125124
AUTHOR_EMAIL = 'neuroimaging@python.org'
126125
PLATFORMS = 'OS Independent'

nipype/interfaces/ants/registration.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,17 +1112,13 @@ def _get_outputfilenames(self, inverse=False):
11121112
output_filename = self.inputs.output_warped_image
11131113
if isinstance(output_filename, bool):
11141114
output_filename = '%s_Warped.nii.gz' % self.inputs.output_transform_prefix
1115-
else:
1116-
output_filename = output_filename
11171115
return output_filename
11181116
inv_output_filename = None
11191117
if isdefined(self.inputs.output_inverse_warped_image) and \
11201118
self.inputs.output_inverse_warped_image:
11211119
inv_output_filename = self.inputs.output_inverse_warped_image
11221120
if isinstance(inv_output_filename, bool):
11231121
inv_output_filename = '%s_InverseWarped.nii.gz' % self.inputs.output_transform_prefix
1124-
else:
1125-
inv_output_filename = inv_output_filename
11261122
return inv_output_filename
11271123

11281124
def _format_convergence(self, ii):

nipype/interfaces/ants/segmentation.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _format_arg(self, opt, spec, val):
143143
if isdefined(self.inputs.save_posteriors):
144144
retval += ",%s" % self.inputs.output_posteriors_name_template
145145
return retval + "]"
146-
return super(ANTSCommand, self)._format_arg(opt, spec, val)
146+
return super(Atropos, self)._format_arg(opt, spec, val)
147147

148148
def _run_interface(self, runtime, correct_return_codes=[0]):
149149
if self.inputs.initialization == "PriorProbabilityImages":
@@ -633,7 +633,7 @@ def _format_arg(self, opt, spec, val):
633633
_, _, ext = split_filename(self.inputs.segmentation_priors[0])
634634
retval = "-p nipype_priors/BrainSegmentationPrior%02d" + ext
635635
return retval
636-
return super(ANTSCommand, self)._format_arg(opt, spec, val)
636+
return super(CorticalThickness, self)._format_arg(opt, spec, val)
637637

638638
def _run_interface(self, runtime, correct_return_codes=[0]):
639639
priors_directory = os.path.join(os.getcwd(), "nipype_priors")
@@ -693,12 +693,6 @@ def _list_outputs(self):
693693
return outputs
694694

695695

696-
class antsCorticalThickness(CorticalThickness):
697-
DeprecationWarning(
698-
'This class has been replaced by CorticalThickness and will be removed in version 0.13'
699-
)
700-
701-
702696
class BrainExtractionInputSpec(ANTSCommandInputSpec):
703697
dimension = traits.Enum(
704698
3, 2, argstr='-d %d', usedefault=True, desc='image dimension (2 or 3)')
@@ -917,12 +911,6 @@ def _list_outputs(self):
917911
return outputs
918912

919913

920-
class antsBrainExtraction(BrainExtraction):
921-
DeprecationWarning(
922-
'This class has been replaced by BrainExtraction and will be removed in version 0.13'
923-
)
924-
925-
926914
class JointFusionInputSpec(ANTSCommandInputSpec):
927915
dimension = traits.Enum(
928916
3,
@@ -1059,7 +1047,7 @@ def _format_arg(self, opt, spec, val):
10591047
assert len(val) == self.inputs.modalities * len(self.inputs.warped_label_images), \
10601048
"Number of intensity images and label maps must be the same {0}!={1}".format(
10611049
len(val), len(self.inputs.warped_label_images))
1062-
return super(ANTSCommand, self)._format_arg(opt, spec, val)
1050+
return super(JointFusion, self)._format_arg(opt, spec, val)
10631051
return retval
10641052

10651053
def _list_outputs(self):

nipype/interfaces/ants/tests/test_auto_antsBrainExtraction.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

nipype/interfaces/ants/tests/test_auto_antsCorticalThickness.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

nipype/interfaces/base/specs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def _clean_container(self, objekt, undefinedval=None, skipundefined=False):
197197
if isinstance(objekt, tuple):
198198
out = tuple(out)
199199
else:
200+
out = None
200201
if isdefined(objekt):
201202
out = objekt
202203
else:
@@ -283,6 +284,7 @@ def _get_sorteddict(self,
283284
if isinstance(objekt, tuple):
284285
out = tuple(out)
285286
else:
287+
out = None
286288
if isdefined(objekt):
287289
if (hash_files and isinstance(objekt, (str, bytes))
288290
and os.path.isfile(objekt)):

nipype/interfaces/cmtk/cmtk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ def cmat(track_file,
214214
gp = nx.read_gpickle(resolution_network_file)
215215
elif ext == '.graphml':
216216
gp = nx.read_graphml(resolution_network_file)
217-
217+
else:
218+
raise TypeError("Unable to read file:", resolution_network_file)
218219
nROIs = len(gp.nodes())
219220

220221
# add node information from parcellation

nipype/interfaces/cmtk/nx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def average_networks(in_files, ntwk_res_file, group_id):
131131
current = ntwk.edge[edge[0]][edge[1]]
132132
data = add_dicts_by_key(current, data)
133133
ntwk.add_edge(edge[0], edge[1], **data)
134-
nodes = list(nodes())
134+
nodes = list(tmp.nodes())
135135
for node in nodes:
136136
data = {}
137137
data = ntwk.nodes[node]

nipype/interfaces/fsl/preprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ def _list_outputs(self):
20192019
outputs['bvars'] = self._gen_mesh_names('bvars', structures)
20202020
return outputs
20212021

2022-
def _gen_fname(self, name):
2022+
def _gen_fname(self, basename):
20232023
path, outname, ext = split_filename(self.inputs.out_file)
20242024

20252025
method = 'none'
@@ -2033,9 +2033,9 @@ def _gen_fname(self, name):
20332033
thres = '%.4f' % self.inputs.method_as_numerical_threshold
20342034
method = thres.replace('.', '')
20352035

2036-
if name == 'original_segmentations':
2036+
if basename == 'original_segmentations':
20372037
return op.abspath('%s_all_%s_origsegs.nii.gz' % (outname, method))
2038-
if name == 'segmentation_file':
2038+
if basename == 'segmentation_file':
20392039
return op.abspath('%s_all_%s_firstseg.nii.gz' % (outname, method))
20402040

20412041
return None

nipype/interfaces/fsl/tests/test_preprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,15 @@ def test_first_genfname():
615615
first.inputs.out_file = 'segment.nii'
616616
first.inputs.output_type = "NIFTI_GZ"
617617

618-
value = first._gen_fname(name='original_segmentations')
618+
value = first._gen_fname(basename='original_segmentations')
619619
expected_value = os.path.abspath('segment_all_fast_origsegs.nii.gz')
620620
assert value == expected_value
621621
first.inputs.method = 'none'
622-
value = first._gen_fname(name='original_segmentations')
622+
value = first._gen_fname(basename='original_segmentations')
623623
expected_value = os.path.abspath('segment_all_none_origsegs.nii.gz')
624624
assert value == expected_value
625625
first.inputs.method = 'auto'
626626
first.inputs.list_of_specific_structures = ['L_Hipp', 'R_Hipp']
627-
value = first._gen_fname(name='original_segmentations')
627+
value = first._gen_fname(basename='original_segmentations')
628628
expected_value = os.path.abspath('segment_all_none_origsegs.nii.gz')
629629
assert value == expected_value

nipype/interfaces/nipy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
from .model import FitGLM, EstimateContrast
3-
from .preprocess import ComputeMask, FmriRealign4d, SpaceTimeRealigner
3+
from .preprocess import ComputeMask, SpaceTimeRealigner
44
from .utils import Similarity

0 commit comments

Comments
 (0)