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):
1044
1044
True ,
1045
1045
usedefault = True ,
1046
1046
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
+ )
1047
1051
sort_filelist = traits .Bool (
1048
1052
mandatory = True , desc = 'Sort the filelist that matches the template' )
1049
1053
template = Str (
@@ -1242,8 +1246,11 @@ def _list_outputs(self):
1242
1246
if self .inputs .sort_filelist :
1243
1247
outfiles = human_order_sorted (outfiles )
1244
1248
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 ] = []
1247
1254
if len (outputs [key ]) == 0 :
1248
1255
outputs [key ] = None
1249
1256
elif len (outputs [key ]) == 1 :
You can’t perform that action at this time.
0 commit comments