@@ -162,7 +162,7 @@ def template_update_single(
162
162
raise TypeError (
163
163
f"type of '{ field .name } ' is Path, consider using Union[Path, bool]"
164
164
)
165
- if inp_val_set is not attr .NOTHING and not isinstance (LazyField ):
165
+ if inp_val_set is not attr .NOTHING and not isinstance (inp_val_set , LazyField ):
166
166
inp_val_set = TypeParser (ty .Union .__getitem__ (OUTPUT_TEMPLATE_TYPES ))(
167
167
inp_val_set
168
168
)
@@ -202,16 +202,27 @@ def _template_formatting(field, inputs, inputs_dict_st):
202
202
Allowing for multiple input values used in the template as longs as
203
203
there is no more than one file (i.e. File, PathLike or string with extensions)
204
204
"""
205
- from .specs import MultiInputObj , MultiOutputFile
206
-
207
205
# if a template is a function it has to be run first with the inputs as the only arg
208
206
template = field .metadata ["output_file_template" ]
209
207
if callable (template ):
210
208
template = template (inputs )
211
209
212
210
# as default, we assume that keep_extension is True
213
- keep_extension = field .metadata .get ("keep_extension" , True )
211
+ if isinstance (template , (tuple , list )):
212
+ formatted = [
213
+ _string_template_formatting (field , t , inputs , inputs_dict_st )
214
+ for t in template
215
+ ]
216
+ else :
217
+ assert isinstance (template , str )
218
+ formatted = _string_template_formatting (field , template , inputs , inputs_dict_st )
219
+ return formatted
214
220
221
+
222
+ def _string_template_formatting (field , template , inputs , inputs_dict_st ):
223
+ from .specs import MultiInputObj , MultiOutputFile
224
+
225
+ keep_extension = field .metadata .get ("keep_extension" , True )
215
226
inp_fields = re .findall (r"{\w+}" , template )
216
227
inp_fields_fl = re .findall (r"{\w+:[0-9.]+f}" , template )
217
228
inp_fields += [re .sub (":[0-9.]+f" , "" , el ) for el in inp_fields_fl ]
0 commit comments