Skip to content

Commit 79d1024

Browse files
committed
Fixes MultipleSelectInterface
It doesn't derive from IdentityInterface anymore (caused node removal in workflows). Also applied improved dynamictraited interfaces checking in workflows.
1 parent 49853ac commit 79d1024

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

nipype/interfaces/utility.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ class MultipleSelectInputSpec(DynamicTraitedSpec):
557557
index = InputMultiPath(traits.Int, mandatory=True,
558558
desc='0-based indices of values to choose')
559559

560-
class MultipleSelectInterface(IdentityInterface):
560+
class MultipleSelectInterface(IOBase):
561561
"""
562562
Basic interface that demultiplexes lists generated by CollateInterface
563563
@@ -578,7 +578,7 @@ class MultipleSelectInterface(IdentityInterface):
578578
output_spec = DynamicTraitedSpec
579579

580580
def __init__(self, fields=None, mandatory_inputs=True, **inputs):
581-
super(IdentityInterface, self).__init__(**inputs)
581+
super(MultipleSelectInterface, self).__init__(**inputs)
582582
if fields is None or not fields:
583583
raise ValueError('Identity Interface fields must be a non-empty list')
584584
# Each input must be in the fields.
@@ -593,6 +593,14 @@ def __init__(self, fields=None, mandatory_inputs=True, **inputs):
593593
# the values after adding the traits.
594594
self.inputs.set(**inputs)
595595

596+
def _add_output_traits(self, base):
597+
undefined_traits = {}
598+
for key in self._fields:
599+
base.add_trait(key, traits.Any)
600+
undefined_traits[key] = Undefined
601+
base.trait_set(trait_change_notify=False, **undefined_traits)
602+
return base
603+
596604
def _list_outputs(self):
597605
#manual mandatory inputs check
598606
if self._fields and self._mandatory_inputs:

nipype/pipeline/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _check_outputs(self, parameter):
190190
return hasattr(self.outputs, parameter)
191191

192192
def _check_inputs(self, parameter):
193-
if hasattr(self.inputs,'_outputs'):
193+
if isinstance(self.inputs, DynamicTraitedSpec):
194194
return True
195195
return hasattr(self.inputs, parameter)
196196

0 commit comments

Comments
 (0)