Skip to content

fix: some lgtm errors #2478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion nipype/algorithms/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ def _list_outputs(self):
return outputs


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

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

if not out_files:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if out_files is None

out_files = []

if len(out_files) != len(in_files):
for i, finname in enumerate(in_files):
fname, fext = op.splitext(op.basename(finname))
Expand Down
6 changes: 3 additions & 3 deletions nipype/interfaces/ants/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _format_arg(self, opt, spec, val):
if isdefined(self.inputs.save_posteriors):
retval += ",%s" % self.inputs.output_posteriors_name_template
return retval + "]"
return super(ANTSCommand, self)._format_arg(opt, spec, val)
return super(Atropos, self)._format_arg(opt, spec, val)

def _run_interface(self, runtime, correct_return_codes=[0]):
if self.inputs.initialization == "PriorProbabilityImages":
Expand Down Expand Up @@ -640,7 +640,7 @@ def _format_arg(self, opt, spec, val):
_, _, ext = split_filename(self.inputs.segmentation_priors[0])
retval = "-p nipype_priors/BrainSegmentationPrior%02d" + ext
return retval
return super(ANTSCommand, self)._format_arg(opt, spec, val)
return super(CorticalThickness, self)._format_arg(opt, spec, val)

def _run_interface(self, runtime, correct_return_codes=[0]):
priors_directory = os.path.join(os.getcwd(), "nipype_priors")
Expand Down Expand Up @@ -1066,7 +1066,7 @@ def _format_arg(self, opt, spec, val):
assert len(val) == self.inputs.modalities * len(self.inputs.warped_label_images), \
"Number of intensity images and label maps must be the same {0}!={1}".format(
len(val), len(self.inputs.warped_label_images))
return super(ANTSCommand, self)._format_arg(opt, spec, val)
return super(JointFusion, self)._format_arg(opt, spec, val)
return retval

def _list_outputs(self):
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/cmtk/nx.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def average_networks(in_files, ntwk_res_file, group_id):
current = ntwk.edge[edge[0]][edge[1]]
data = add_dicts_by_key(current, data)
ntwk.add_edge(edge[0], edge[1], **data)
nodes = list(nodes())
nodes = list(tmp.nodes())
for node in nodes:
data = {}
data = ntwk.nodes[node]
Expand Down
6 changes: 3 additions & 3 deletions nipype/interfaces/fsl/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ def _list_outputs(self):
outputs['bvars'] = self._gen_mesh_names('bvars', structures)
return outputs

def _gen_fname(self, name):
def _gen_fname(self, basename):
path, outname, ext = split_filename(self.inputs.out_file)

method = 'none'
Expand All @@ -2039,9 +2039,9 @@ def _gen_fname(self, name):
thres = '%.4f' % self.inputs.method_as_numerical_threshold
method = thres.replace('.', '')

if name == 'original_segmentations':
if basename == 'original_segmentations':
return op.abspath('%s_all_%s_origsegs.nii.gz' % (outname, method))
if name == 'segmentation_file':
if basename == 'segmentation_file':
return op.abspath('%s_all_%s_firstseg.nii.gz' % (outname, method))

return None
Expand Down