Skip to content

Commit 8ccb727

Browse files
committed
BF: updated datagrabber to use infields only when available
1 parent 6a3c7d1 commit 8ccb727

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nipype/interfaces/io.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ def __init__(self, infields=None, outfields=None, **kwargs):
345345
See class examples for usage
346346
347347
"""
348+
if not outfields:
349+
outfields = ['outfiles']
348350
super(DataGrabber, self).__init__(**kwargs)
349351
undefined_traits = {}
350352
# used for mandatory inputs check
@@ -353,9 +355,6 @@ def __init__(self, infields=None, outfields=None, **kwargs):
353355
for key in infields:
354356
self.inputs.add_trait(key, traits.Any)
355357
undefined_traits[key] = Undefined
356-
if not outfields:
357-
outfields = ['outfiles']
358-
359358
# add ability to insert field specific templates
360359
self.inputs.add_trait('field_template',
361360
traits.Dict(traits.Enum(outfields),
@@ -365,7 +364,10 @@ def __init__(self, infields=None, outfields=None, **kwargs):
365364
self.inputs.template_args = {}
366365
for key in outfields:
367366
if not key in self.inputs.template_args:
368-
self.inputs.template_args[key] = [infields]
367+
if infields:
368+
self.inputs.template_args[key] = [infields]
369+
else:
370+
self.inputs.template_args[key] = []
369371

370372
self.inputs.trait_set(trait_change_notify=False, **undefined_traits)
371373

0 commit comments

Comments
 (0)