@@ -30,9 +30,9 @@ def _compare_records(
3030 This handles normalizing record names, which will be relative to workflow
3131 step, so that they can be compared.
3232 """
33- srcfields = {cwl .shortname (field .name ): field .type_ for field in (src .fields or {})}
33+ srcfields = {cwl .shortname (field .name ): field .type for field in (src .fields or {})}
3434 sinkfields = {
35- cwl .shortname (field .name ): field .type_ for field in (sink .fields or {})
35+ cwl .shortname (field .name ): field .type for field in (sink .fields or {})
3636 }
3737 for key in sinkfields .keys ():
3838 if (
@@ -63,10 +63,10 @@ def _compare_type(type1: Any, type2: Any) -> bool:
6363 return _compare_type (type1 .items , type2 .items )
6464 elif isinstance (type1 , cwl .RecordSchema ) and isinstance (type2 , cwl .RecordSchema ):
6565 fields1 = {
66- cwl .shortname (field .name ): field .type_ for field in (type1 .fields or {})
66+ cwl .shortname (field .name ): field .type for field in (type1 .fields or {})
6767 }
6868 fields2 = {
69- cwl .shortname (field .name ): field .type_ for field in (type2 .fields or {})
69+ cwl .shortname (field .name ): field .type for field in (type2 .fields or {})
7070 }
7171 if fields1 .keys () != fields2 .keys ():
7272 return False
@@ -184,7 +184,7 @@ def check_types(
184184 return "exception"
185185 if linkMerge == "merge_nested" :
186186 return check_types (
187- cwl .ArraySchema (items = srctype , type_ = "array" ), sinktype , None , None
187+ cwl .ArraySchema (items = srctype , type = "array" ), sinktype , None , None
188188 )
189189 if linkMerge == "merge_flattened" :
190190 return check_types (merge_flatten_type (srctype ), sinktype , None , None )
@@ -212,7 +212,7 @@ def content_limit_respected_read(f: IO[bytes]) -> str:
212212def convert_stdstreams_to_files (clt : cwl .CommandLineTool ) -> None :
213213 """Convert stdin, stdout and stderr type shortcuts to files."""
214214 for out in clt .outputs :
215- if out .type_ == "stdout" :
215+ if out .type == "stdout" :
216216 if out .outputBinding is not None :
217217 raise ValidationException (
218218 "Not allowed to specify outputBinding when using stdout shortcut."
@@ -223,9 +223,9 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None:
223223 json_dumps (clt .save (), sort_keys = True ).encode ("utf-8" )
224224 ).hexdigest ()
225225 )
226- out .type_ = "File"
226+ out .type = "File"
227227 out .outputBinding = cwl .CommandOutputBinding (glob = clt .stdout )
228- elif out .type_ == "stderr" :
228+ elif out .type == "stderr" :
229229 if out .outputBinding is not None :
230230 raise ValidationException (
231231 "Not allowed to specify outputBinding when using stderr shortcut."
@@ -236,10 +236,10 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None:
236236 json_dumps (clt .save (), sort_keys = True ).encode ("utf-8" )
237237 ).hexdigest ()
238238 )
239- out .type_ = "File"
239+ out .type = "File"
240240 out .outputBinding = cwl .CommandOutputBinding (glob = clt .stderr )
241241 for inp in clt .inputs :
242- if inp .type_ == "stdin" :
242+ if inp .type == "stdin" :
243243 if inp .inputBinding is not None :
244244 raise ValidationException (
245245 "Not allowed to specify unputBinding when using stdin shortcut."
@@ -253,7 +253,7 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None:
253253 "$(inputs.%s.path)"
254254 % cast (str , inp .id ).rpartition ("#" )[2 ].split ("/" )[- 1 ]
255255 )
256- inp .type_ = "File"
256+ inp .type = "File"
257257
258258
259259def merge_flatten_type (src : Any ) -> Any :
@@ -262,7 +262,7 @@ def merge_flatten_type(src: Any) -> Any:
262262 return [merge_flatten_type (t ) for t in src ]
263263 if isinstance (src , cwl .ArraySchema ):
264264 return src
265- return cwl .ArraySchema (type_ = "array" , items = src )
265+ return cwl .ArraySchema (type = "array" , items = src )
266266
267267
268268def type_for_step_input (
@@ -280,9 +280,9 @@ def type_for_step_input(
280280 cast (str , step_input .id ).split ("#" )[- 1 ]
281281 == cast (str , in_ .id ).split ("#" )[- 1 ]
282282 ):
283- input_type = step_input .type_
283+ input_type = step_input .type
284284 if step .scatter is not None and in_ .id in aslist (step .scatter ):
285- input_type = cwl .ArraySchema (items = input_type , type_ = "array" )
285+ input_type = cwl .ArraySchema (items = input_type , type = "array" )
286286 return input_type
287287 return "Any"
288288
@@ -300,15 +300,15 @@ def type_for_step_output(
300300 output .id .split ("#" )[- 1 ].split ("/" )[- 1 ]
301301 == sourcename .split ("#" )[- 1 ].split ("/" )[- 1 ]
302302 ):
303- output_type = output .type_
303+ output_type = output .type
304304 if step .scatter is not None :
305305 if step .scatterMethod == "nested_crossproduct" :
306306 for _ in range (len (aslist (step .scatter ))):
307307 output_type = cwl .ArraySchema (
308- items = output_type , type_ = "array"
308+ items = output_type , type = "array"
309309 )
310310 else :
311- output_type = cwl .ArraySchema (items = output_type , type_ = "array" )
311+ output_type = cwl .ArraySchema (items = output_type , type = "array" )
312312 return output_type
313313 raise ValidationException (
314314 "param {} not found in {}." .format (
@@ -328,44 +328,42 @@ def type_for_source(
328328 scatter_context : List [Optional [Tuple [int , str ]]] = []
329329 params = param_for_source_id (process , sourcenames , parent , scatter_context )
330330 if not isinstance (params , list ):
331- new_type = params .type_
331+ new_type = params .type
332332 if scatter_context [0 ] is not None :
333333 if scatter_context [0 ][1 ] == "nested_crossproduct" :
334334 for _ in range (scatter_context [0 ][0 ]):
335- new_type = cwl .ArraySchema (items = new_type , type_ = "array" )
335+ new_type = cwl .ArraySchema (items = new_type , type = "array" )
336336 else :
337- new_type = cwl .ArraySchema (items = new_type , type_ = "array" )
337+ new_type = cwl .ArraySchema (items = new_type , type = "array" )
338338 if linkMerge == "merge_nested" :
339- new_type = cwl .ArraySchema (items = new_type , type_ = "array" )
339+ new_type = cwl .ArraySchema (items = new_type , type = "array" )
340340 elif linkMerge == "merge_flattened" :
341341 new_type = merge_flatten_type (new_type )
342342 return new_type
343343 new_type = []
344344 for p , sc in zip (params , scatter_context ):
345345 if isinstance (p , str ) and not any (_compare_type (t , p ) for t in new_type ):
346346 cur_type = p
347- elif hasattr (p , "type_" ) and not any (
348- _compare_type (t , p .type_ ) for t in new_type
349- ):
350- cur_type = p .type_
347+ elif hasattr (p , "type" ) and not any (_compare_type (t , p .type ) for t in new_type ):
348+ cur_type = p .type
351349 else :
352350 cur_type = None
353351 if cur_type is not None :
354352 if sc is not None :
355353 if sc [1 ] == "nested_crossproduct" :
356354 for _ in range (sc [0 ]):
357- cur_type = cwl .ArraySchema (items = cur_type , type_ = "array" )
355+ cur_type = cwl .ArraySchema (items = cur_type , type = "array" )
358356 else :
359- cur_type = cwl .ArraySchema (items = cur_type , type_ = "array" )
357+ cur_type = cwl .ArraySchema (items = cur_type , type = "array" )
360358 new_type .append (cur_type )
361359 if len (new_type ) == 1 :
362360 new_type = new_type [0 ]
363361 if linkMerge == "merge_nested" :
364- return cwl .ArraySchema (items = new_type , type_ = "array" )
362+ return cwl .ArraySchema (items = new_type , type = "array" )
365363 elif linkMerge == "merge_flattened" :
366364 return merge_flatten_type (new_type )
367365 elif isinstance (sourcenames , List ) and len (sourcenames ) > 1 :
368- return cwl .ArraySchema (items = new_type , type_ = "array" )
366+ return cwl .ArraySchema (items = new_type , type = "array" )
369367 else :
370368 return new_type
371369
0 commit comments