Skip to content

Commit 0b2ba69

Browse files
committed
ENH: Rename MultiPath -> MultiObject
1 parent ab3ea2d commit 0b2ba69

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

nipype/interfaces/base/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
from .traits_extension import (
2020
traits, Undefined, TraitDictObject, TraitListObject, TraitError, isdefined,
21-
File, Directory, Str, DictStrStr, has_metadata, ImageFile, MultiPath,
21+
File, Directory, Str, DictStrStr, has_metadata, ImageFile,
22+
OutputMultiObject, InputMultiObject,
2223
OutputMultiPath, InputMultiPath)
2324

2425
from .support import (Bunch, InterfaceResult, load_template,

nipype/interfaces/base/traits_extension.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ def has_metadata(trait, metadata, value=None, recursive=True):
315315
return count > 0
316316

317317

318-
class MultiPath(traits.List):
319-
""" Abstract class - shared functionality of input and output MultiPath
318+
class MultiObject(traits.List):
319+
""" Abstract class - shared functionality of input and output MultiObject
320320
"""
321321

322322
def validate(self, object, name, value):
@@ -335,18 +335,18 @@ def validate(self, object, name, value):
335335
inner_trait = self.inner_traits()[0]
336336
if not isinstance(value, list) \
337337
or (isinstance(inner_trait.trait_type, traits.List) and
338-
not isinstance(inner_trait.trait_type, InputMultiPath) and
338+
not isinstance(inner_trait.trait_type, InputMultiObject) and
339339
not isinstance(value[0], list)):
340340
newvalue = [value]
341-
value = super(MultiPath, self).validate(object, name, newvalue)
341+
value = super(MultiObject, self).validate(object, name, newvalue)
342342

343343
if value:
344344
return value
345345

346346
self.error(object, name, value)
347347

348348

349-
class OutputMultiPath(MultiPath):
349+
class OutputMultiObject(MultiObject):
350350
""" Implements a user friendly traits that accepts one or more
351351
paths to files or directories. This is the output version which
352352
return a single string whenever possible (when it was set to a
@@ -358,9 +358,9 @@ class OutputMultiPath(MultiPath):
358358
359359
XXX This needs to be vetted by somebody who understands traits
360360
361-
>>> from nipype.interfaces.base import OutputMultiPath, TraitedSpec
361+
>>> from nipype.interfaces.base import OutputMultiObject, TraitedSpec
362362
>>> class A(TraitedSpec):
363-
... foo = OutputMultiPath(File(exists=False))
363+
... foo = OutputMultiObject(File(exists=False))
364364
>>> a = A()
365365
>>> a.foo
366366
<undefined>
@@ -392,7 +392,7 @@ def set(self, object, name, value):
392392
self.set_value(object, name, value)
393393

394394

395-
class InputMultiPath(MultiPath):
395+
class InputMultiObject(MultiObject):
396396
""" Implements a user friendly traits that accepts one or more
397397
paths to files or directories. This is the input version which
398398
always returns a list. Default value of this trait
@@ -403,9 +403,9 @@ class InputMultiPath(MultiPath):
403403
404404
XXX This needs to be vetted by somebody who understands traits
405405
406-
>>> from nipype.interfaces.base import InputMultiPath, TraitedSpec
406+
>>> from nipype.interfaces.base import InputMultiObject, TraitedSpec
407407
>>> class A(TraitedSpec):
408-
... foo = InputMultiPath(File(exists=False))
408+
... foo = InputMultiObject(File(exists=False))
409409
>>> a = A()
410410
>>> a.foo
411411
<undefined>
@@ -424,3 +424,6 @@ class InputMultiPath(MultiPath):
424424
425425
"""
426426
pass
427+
428+
InputMultiPath = InputMultiObject
429+
OutputMultiPath = OutputMultiObject

0 commit comments

Comments
 (0)