Skip to content

Commit da04395

Browse files
committed
FIX: Patch dipy interface builder to work with newer traits
1 parent 991b663 commit da04395

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

nipype/interfaces/dipy/base.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,17 @@ def create_interface_specs(class_name, params=None, BaseClass=TraitedSpec):
162162
traits_type, is_mandatory = convert_to_traits_type(dipy_type, is_file)
163163
# print(name, dipy_type, desc, is_file, traits_type, is_mandatory)
164164
if BaseClass.__name__ == BaseInterfaceInputSpec.__name__:
165-
if len(p) > 3:
165+
if len(p) > 3 and p[3] is not None:
166+
default_value = p[3]
167+
if isinstance(traits_type, traits.List) and not isinstance(
168+
default_value, list
169+
):
170+
default_value = [default_value]
166171
attr[name] = traits_type(
167-
p[3], desc=desc[-1], usedefault=True, mandatory=is_mandatory
172+
default_value,
173+
desc=desc[-1],
174+
usedefault=True,
175+
mandatory=is_mandatory,
168176
)
169177
else:
170178
attr[name] = traits_type(desc=desc[-1], mandatory=is_mandatory)

0 commit comments

Comments
 (0)