Skip to content

Commit a7cdc6b

Browse files
committed
removing str from sequences; checking this type at the evry beginning
1 parent 68d692a commit a7cdc6b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

nipype/interfaces/base.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,15 +2059,18 @@ class MultiPath(traits.List):
20592059
"""
20602060

20612061
def validate(self, object, name, value):
2062+
2063+
# want to treat range and other sequences (except str) as list
2064+
if not isinstance(value, str) and isinstance(value, collections.Sequence):
2065+
value = list(value)
2066+
20622067
if not isdefined(value) or \
20632068
(isinstance(value, list) and len(value) == 0):
20642069
return Undefined
2065-
newvalue = value
20662070

2067-
if isinstance(value, collections.Sequence):
2068-
newvalue = list(value)
2071+
newvalue = value
20692072

2070-
if not isinstance(value, collections.Sequence) \
2073+
if not isinstance(value, list) \
20712074
or (self.inner_traits() and
20722075
isinstance(self.inner_traits()[0].trait_type,
20732076
traits.List) and not

0 commit comments

Comments
 (0)