1717import cwl_utils .parser .cwl_v1_1_utils as utils
1818from cwl_utils .errors import JavascriptException , WorkflowException
1919from cwl_utils .expression import do_eval , interpolate
20- from cwl_utils .parser .cwl_v1_1_utils import (
21- AnyTypeSchema ,
22- BasicCommandInputTypeSchemas ,
23- BasicCommandOutputTypeSchemas ,
24- BasicInputTypeSchemas ,
25- BasicOutputTypeSchemas ,
26- CommandInputTypeSchemas ,
27- CommandOutputTypeSchemas ,
28- InputTypeSchemas ,
29- OutputTypeSchemas ,
30- )
20+ from cwl_utils .parser .utils import param_for_source_id
3121from cwl_utils .types import (
3222 CWLDirectoryType ,
3323 CWLFileType ,
@@ -68,7 +58,7 @@ def escape_expression_field(contents: str) -> str:
6858
6959
7060def _clean_type_ids (
71- cwltype : InputTypeSchemas | CommandOutputTypeSchemas ,
61+ cwltype : utils . InputTypeSchemas | utils . CommandOutputTypeSchemas ,
7262) -> None :
7363 if isinstance (cwltype , cwl .ArraySchema ):
7464 if is_sequence (cwltype .items ):
@@ -94,8 +84,8 @@ def _clean_type_ids(
9484
9585
9686def clean_type_ids (
97- cwltype : AnyTypeSchema ,
98- ) -> AnyTypeSchema :
87+ cwltype : utils . AnyTypeSchema ,
88+ ) -> utils . AnyTypeSchema :
9989 """Simplify type identifiers."""
10090 result = copy .deepcopy (cwltype )
10191 if is_sequence (result ):
@@ -180,8 +170,8 @@ def get_expression(
180170
181171
182172def _plain_input_schema_to_clt_input_schema (
183- input_type : BasicInputTypeSchemas ,
184- ) -> BasicCommandInputTypeSchemas :
173+ input_type : utils . BasicInputTypeSchemas ,
174+ ) -> utils . BasicCommandInputTypeSchemas :
185175 match input_type :
186176 case cwl .InputArraySchema ():
187177 return cwl .CommandInputArraySchema .fromDoc (
@@ -207,8 +197,8 @@ def _plain_input_schema_to_clt_input_schema(
207197
208198
209199def plain_input_schema_to_clt_input_schema (
210- input_type : InputTypeSchemas ,
211- ) -> CommandInputTypeSchemas :
200+ input_type : utils . InputTypeSchemas ,
201+ ) -> utils . CommandInputTypeSchemas :
212202 if is_sequence (input_type ):
213203 return [
214204 _plain_input_schema_to_clt_input_schema (input_type_item )
@@ -218,8 +208,8 @@ def plain_input_schema_to_clt_input_schema(
218208
219209
220210def _plain_input_schema_to_plain_output_schema (
221- input_type : BasicInputTypeSchemas ,
222- ) -> BasicOutputTypeSchemas :
211+ input_type : utils . BasicInputTypeSchemas ,
212+ ) -> utils . BasicOutputTypeSchemas :
223213 match input_type :
224214 case cwl .InputArraySchema ():
225215 return cwl .OutputArraySchema .fromDoc (
@@ -245,8 +235,8 @@ def _plain_input_schema_to_plain_output_schema(
245235
246236
247237def plain_input_schema_to_plain_output_schema (
248- input_type : InputTypeSchemas ,
249- ) -> OutputTypeSchemas :
238+ input_type : utils . InputTypeSchemas ,
239+ ) -> utils . OutputTypeSchemas :
250240 if is_sequence (input_type ):
251241 return [
252242 _plain_input_schema_to_plain_output_schema (input_type_item )
@@ -256,8 +246,8 @@ def plain_input_schema_to_plain_output_schema(
256246
257247
258248def _plain_output_type_to_clt_output_type (
259- output_type : BasicOutputTypeSchemas ,
260- ) -> BasicCommandOutputTypeSchemas :
249+ output_type : utils . BasicOutputTypeSchemas ,
250+ ) -> utils . BasicCommandOutputTypeSchemas :
261251 match output_type :
262252 case cwl .OutputArraySchema ():
263253 return cwl .CommandOutputArraySchema .fromDoc (
@@ -283,8 +273,8 @@ def _plain_output_type_to_clt_output_type(
283273
284274
285275def plain_output_type_to_clt_output_type (
286- output_type : OutputTypeSchemas ,
287- ) -> CommandOutputTypeSchemas :
276+ output_type : utils . OutputTypeSchemas ,
277+ ) -> utils . CommandOutputTypeSchemas :
288278 if is_sequence (output_type ):
289279 return [
290280 _plain_output_type_to_clt_output_type (output_type_item )
@@ -527,9 +517,9 @@ def generate_etool_from_expr(
527517 if self_type is None :
528518 self_type = target
529519 assert self_type is not None
530- new_type : InputTypeSchemas
520+ new_type : utils . InputTypeSchemas
531521 if is_sequence (self_type ):
532- new_type_list : MutableSequence [BasicInputTypeSchemas ] = []
522+ new_type_list : MutableSequence [utils . BasicInputTypeSchemas ] = []
533523 for entry in self_type :
534524 clean_type = clean_type_ids (entry .type_ )
535525 if is_sequence (clean_type ):
@@ -1647,7 +1637,7 @@ def traverse_CommandLineTool(
16471637 modified = True
16481638 inp_id = "_{}_glob" .format (outp .id .split ("#" )[- 1 ])
16491639 etool_id = f"_expression_{ step_id } { inp_id } "
1650- glob_target_type : CommandInputTypeSchemas = [
1640+ glob_target_type : utils . CommandInputTypeSchemas = [
16511641 "string" ,
16521642 cwl .CommandInputArraySchema ("string" , "array" ),
16531643 ]
@@ -2193,7 +2183,7 @@ def traverse_step(
21932183 ) = None
21942184 if inp .source :
21952185 input_source_id = []
2196- source_types : list [BasicInputTypeSchemas ] = []
2186+ source_types : list [utils . BasicInputTypeSchemas ] = []
21972187 for source in inp .source :
21982188 source_id = source .split ("#" )[- 1 ]
21992189 input_source_id .append (source_id )
@@ -2278,9 +2268,7 @@ def workflow_step_to_WorkflowInputParameters(
22782268 for inp in step_ins :
22792269 inp_id = inp .id .split ("#" )[- 1 ].split ("/" )[- 1 ]
22802270 if inp .source and inp_id != except_in_id :
2281- param = copy .deepcopy (
2282- utils .param_for_source_id (parent , sourcenames = inp .source )
2283- )
2271+ param = copy .deepcopy (param_for_source_id (parent , sourcenames = inp .source ))
22842272 if is_sequence (param ):
22852273 for p in param :
22862274 if not p .type_ :
0 commit comments