File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1044,6 +1044,10 @@ class DataGrabberInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
10441044 True ,
10451045 usedefault = True ,
10461046 desc = 'Generate exception if list is empty for a given field' )
1047+ drop_blank_outputs = traits .Bool (
1048+ False , usedefault = True ,
1049+ desc = "Remove ``None`` entries from output lists"
1050+ )
10471051 sort_filelist = traits .Bool (
10481052 mandatory = True , desc = 'Sort the filelist that matches the template' )
10491053 template = Str (
@@ -1242,8 +1246,11 @@ def _list_outputs(self):
12421246 if self .inputs .sort_filelist :
12431247 outfiles = human_order_sorted (outfiles )
12441248 outputs [key ].append (list_to_filename (outfiles ))
1245- if any ([val is None for val in outputs [key ]]):
1246- outputs [key ] = []
1249+ if self .inputs .drop_blank_outputs :
1250+ outputs [key ] = [x for x in outputs [key ] if x is not None ]
1251+ else :
1252+ if any ([val is None for val in outputs [key ]]):
1253+ outputs [key ] = []
12471254 if len (outputs [key ]) == 0 :
12481255 outputs [key ] = None
12491256 elif len (outputs [key ]) == 1 :
You can’t perform that action at this time.
0 commit comments