@@ -74,6 +74,11 @@ def pack_process(
74
74
75
75
76
76
def listify_everything (cwl : dict [str , Any ]) -> dict [str , Any ]:
77
+ """
78
+ Convert many CWL construct from their map to the list version.
79
+
80
+ See https://www.commonwl.org/v1.1/Workflow.html#map
81
+ """
77
82
for port in ["inputs" , "outputs" ]:
78
83
cwl [port ] = utils .normalize_to_list (
79
84
cwl .get (port , []), key_field = "id" , value_field = "type"
@@ -99,14 +104,8 @@ def listify_everything(cwl: dict[str, Any]) -> dict[str, Any]:
99
104
return cwl
100
105
101
106
102
- def dictify_requirements (cwl : dict [str , Any ]) -> dict [str , Any ]:
103
- cwl ["requirements" ] = utils .normalize_to_map (
104
- cwl .get ("requirements" , {}), key_field = "class"
105
- )
106
- return cwl
107
-
108
-
109
107
def normalize_sources (cwl : dict [str , Any ]) -> dict [str , Any ]:
108
+ """Normalize the steps and output of a CWL Workflow."""
110
109
if cwl .get ("class" ) != "Workflow" :
111
110
return cwl
112
111
@@ -147,6 +146,7 @@ def load_schemadefs(
147
146
base_url : urllib .parse .ParseResult ,
148
147
parent_user_defined_types : Optional [dict [str , Any ]] = None ,
149
148
) -> tuple [dict [str , Any ], dict [str , Any ]]:
149
+ """Internalize any SchemaDefRequirement, and remove it."""
150
150
user_defined_types = schemadef .build_user_defined_type_dict (cwl , base_url )
151
151
if parent_user_defined_types is not None :
152
152
user_defined_types .update (parent_user_defined_types )
@@ -198,6 +198,7 @@ def resolve_steps(
198
198
cwl_version : str ,
199
199
parent_user_defined_types : Optional [dict [str , Any ]] = None ,
200
200
) -> dict [str , Any ]:
201
+ """Load and pack all "run" sections of the workflow steps."""
201
202
if isinstance (cwl , str ):
202
203
raise RuntimeError (f"{ base_url .geturl ()} : Expecting a process, found a string" )
203
204
@@ -243,6 +244,7 @@ def resolve_steps(
243
244
244
245
245
246
def add_missing_requirements (cwl : dict [str , Any ]) -> dict [str , Any ]:
247
+ """Due to packing, we may need to add a "SubworkflowFeatureRequirement"."""
246
248
requirements = cwl .get ("requirements" , [])
247
249
present = {req ["class" ] for req in requirements }
248
250
@@ -263,6 +265,7 @@ def _add_req(_req_name: str) -> None:
263
265
264
266
265
267
def pack (cwl_path : str ) -> dict [str , Any ]:
268
+ """Pack a CWL document at the given path."""
266
269
sys .stderr .write (f"Packing { cwl_path } \n " )
267
270
file_path_url = urllib .parse .urlparse (cwl_path )
268
271
0 commit comments