diff --git a/cwl_utils/cite_extract.py b/cwl_utils/cite_extract.py index d35081d5..e7ff61c6 100755 --- a/cwl_utils/cite_extract.py +++ b/cwl_utils/cite_extract.py @@ -33,7 +33,7 @@ def main() -> int: def extract_software_reqs( - process: cwl.Process, + process: cwl.Process | cwl.WorkflowStep, ) -> Iterator[cwl.SoftwareRequirement]: """Return an iterator over any SoftwareRequirements found in the given process.""" if process.requirements: diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index 1446319a..8ec09e14 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_0_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_0_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -26,6 +37,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -56,33 +68,64 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if is_sequence(cwltype.items): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if is_sequence(result): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if is_sequence(field): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -137,6 +180,142 @@ def get_expression( return None +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_clt_input_schema(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_plain_output_schema(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: + if is_sequence(output_type): + return [ + _plain_output_type_to_clt_output_type(output_type_item) + for output_type_item in output_type + ] + if output_type is None: + return None + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_plain_input_paramater( + parameter: cwl.InputParameter | cwl.OutputParameter, +) -> cwl.InputParameter: + return cwl.InputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + + +def parameters_to_plain_input_paramaters( + parameters: Sequence[ + cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.InputParameter]: + return [parameter_to_plain_input_paramater(parameter) for parameter in parameters] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -152,7 +331,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -167,7 +346,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -330,52 +509,57 @@ def generate_etool_from_expr( | list[cwl.InputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.InputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type if t.type_] - elif self_type.type_: - new_type = clean_type_ids(self_type.type_) + assert self_type is not None + new_type: InputTypeSchemas + if is_sequence(self_type): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if is_sequence(clean_type): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: - raise WorkflowException(f"Don't know how to make type from {self_type!r}.") + new_type = clean_type_ids(self_type.type_) inputs.append( cwl.InputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, list) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable if not is_sequence(self_type) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, list) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, list) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -383,8 +567,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -413,18 +597,24 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -433,7 +623,11 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator ], ) -> list[str] | None: """ @@ -458,23 +652,35 @@ def replace_expr_with_etool( source: str | list[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -485,14 +691,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -523,26 +731,33 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -619,33 +834,22 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) - if param.secondaryFiles: - if get_expression(param.secondaryFiles, inputs, EMPTY_FILE): - raise SourceLine( - param.loadingOptions.original_doc, - "secondaryFiles", - raise_type=WorkflowException, - ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) - elif isinstance(param.secondaryFiles, MutableSequence): - for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry, inputs, EMPTY_FILE): - raise SourceLine( - param.loadingOptions.original_doc, - index2, - raise_type=WorkflowException, - ).makeError( - f"Entry {index}," - + TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1]) - ) + if param.secondaryFiles is not None and has_expression( + param.secondaryFiles + ): + raise SourceLine( + param.loadingOptions.original_doc, + "secondaryFiles", + raise_type=WorkflowException, + ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) return modified @@ -690,7 +894,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -711,7 +915,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -720,7 +926,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="long") + target = cwl.InputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -745,7 +951,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -766,18 +972,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -787,17 +993,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -807,7 +1015,7 @@ def process_workflow_reqs_and_hints( modified = True if is_file_or_directory(expr_result): target = cwl.InputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -818,38 +1026,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.InputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -859,24 +1067,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -885,10 +1093,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -903,14 +1113,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -921,15 +1135,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -941,32 +1159,39 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -986,6 +1211,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -995,6 +1221,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1002,7 +1229,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="string") + target = cwl.InputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1015,7 +1242,10 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" generated_envVar_reqs.append((etool_id, env_index)) @@ -1026,11 +1256,11 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="long") + target = cwl.InputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1055,7 +1285,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1068,15 +1298,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1084,15 +1317,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.InputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1109,31 +1342,41 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1149,14 +1392,14 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.InputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1164,22 +1407,26 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1194,26 +1441,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1222,13 +1483,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1242,7 +1505,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False @@ -1256,24 +1519,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1282,22 +1549,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1308,17 +1581,21 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1333,12 +1610,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1347,21 +1631,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.InputParameter(id=None, type_=glob_target_type) + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] + target = cwl.InputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1385,34 +1676,45 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_plain_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if is_sequence(orig_step_input.source): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1431,8 +1733,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -1460,12 +1762,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -1496,24 +1803,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -1529,7 +1845,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -1540,7 +1858,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -1548,7 +1866,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -1567,7 +1885,8 @@ def replace_step_clt_expr_with_etool( self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1581,8 +1900,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1590,9 +1910,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -1603,7 +1924,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1617,8 +1939,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1626,30 +1949,33 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), ) -> list[cwl.InputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.InputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -1657,17 +1983,18 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -1700,7 +2027,13 @@ def generate_etool_from_expr2( cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1714,8 +2047,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -1730,19 +2063,47 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.TimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1751,7 +2112,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_plain_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1773,43 +2134,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if is_sequence(scattered_source_type): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1825,31 +2172,23 @@ def traverse_step( | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.InputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.InputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if is_sequence(temp_type): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.InputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1865,9 +2204,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1884,6 +2225,7 @@ def traverse_step( inp.valueFrom = None inp.source = f"{etool_id}/result" # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -1909,35 +2251,35 @@ def traverse_step( def workflow_step_to_InputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> list[cwl.InputParameter | cwl.CommandOutputParameter]: - """Create InputParameters to match the given WorkflowStep inputs.""" + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str +) -> list[cwl.InputParameter]: + """Create ExpressionTool InputParameters to match the given WorkflowStep inputs.""" params = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( f"Don't know how to get type id for {p!r}." ) - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + new_param = parameter_to_plain_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: if not param.type_: raise WorkflowException( f"Don't know how to get type id for {param!r}." ) - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + new_param = parameter_to_plain_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params @@ -1948,14 +2290,16 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.InputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: ( cwl.InputParameter | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + | Sequence[cwl.InputParameter | cwl.CommandOutputParameter] | None ) = None, ) -> None: @@ -1989,7 +2333,7 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: @@ -1997,12 +2341,11 @@ def replace_step_valueFrom_expr_with_etool( if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2018,7 +2361,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2028,6 +2372,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2060,7 +2405,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/cwl_utils/cwl_v1_1_expression_refactor.py b/cwl_utils/cwl_v1_1_expression_refactor.py index 1bedf4c2..a3a25326 100755 --- a/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/cwl_utils/cwl_v1_1_expression_refactor.py @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_1_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_1_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -26,6 +37,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -45,7 +57,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" - output.outputBinding = cwl.CommandOutputBinding(stdout_path, None, None) + output.outputBinding = cwl.CommandOutputBinding(glob=stdout_path) if result: return result return process @@ -56,33 +68,64 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if is_sequence(cwltype.items): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if is_sequence(result): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if is_sequence(field): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -137,6 +180,140 @@ def get_expression( return None +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_clt_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_plain_output_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: + if is_sequence(output_type): + return [ + _plain_output_type_to_clt_output_type(output_type_item) + for output_type_item in output_type + ] + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_workflow_input_paramater( + parameter: cwl.InputParameter | cwl.OutputParameter, +) -> cwl.WorkflowInputParameter: + return cwl.WorkflowInputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + + +def parameters_to_workflow_input_paramaters( + parameters: Sequence[ + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.WorkflowInputParameter]: + return [ + parameter_to_workflow_input_paramater(parameter) for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -152,7 +329,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -167,7 +344,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -330,50 +507,57 @@ def generate_etool_from_expr( | list[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.WorkflowInputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type] + assert self_type is not None + new_type: InputTypeSchemas + if is_sequence(self_type): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if is_sequence(clean_type): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: new_type = clean_type_ids(self_type.type_) inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, list) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable if not is_sequence(self_type) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, list) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, list) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -381,8 +565,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -411,18 +595,24 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -431,7 +621,11 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator ], ) -> list[str] | None: """ @@ -456,23 +650,35 @@ def replace_expr_with_etool( source: str | list[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -483,14 +689,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -521,26 +729,33 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -617,18 +832,17 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) if param.secondaryFiles: - if hasattr(param.secondaryFiles, "pattern") and get_expression( - param.secondaryFiles.pattern, inputs, EMPTY_FILE + if hasattr(param.secondaryFiles, "pattern") and has_expression( + param.secondaryFiles.pattern ): raise SourceLine( param.loadingOptions.original_doc, @@ -637,7 +851,7 @@ def process_workflow_inputs_and_outputs( ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) elif isinstance(param.secondaryFiles, MutableSequence): for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry.pattern, inputs, EMPTY_FILE): + if has_expression(entry.pattern): raise SourceLine( param.loadingOptions.original_doc, index2, @@ -646,6 +860,7 @@ def process_workflow_inputs_and_outputs( f"Entry {index}," + TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1]) ) + return modified @@ -690,7 +905,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -711,7 +926,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -720,9 +937,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter( - id=None, type_="long" - ) + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -747,7 +962,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -768,18 +983,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -789,17 +1004,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -809,7 +1026,7 @@ def process_workflow_reqs_and_hints( modified = True if is_file_or_directory(expr_result): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -820,38 +1037,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -861,24 +1078,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -887,10 +1104,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -905,14 +1124,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -923,15 +1146,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -943,32 +1170,39 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -988,6 +1222,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -997,6 +1232,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1004,7 +1240,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="string") + target = cwl.WorkflowInputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1017,7 +1253,10 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" generated_envVar_reqs.append((etool_id, env_index)) @@ -1028,11 +1267,11 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="long") + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1057,7 +1296,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1070,15 +1309,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1086,15 +1328,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.WorkflowInputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1111,31 +1353,41 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1151,14 +1403,14 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.WorkflowInputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1166,22 +1418,26 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1196,26 +1452,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1224,13 +1494,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1244,7 +1516,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False @@ -1258,24 +1530,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1284,22 +1560,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1310,17 +1592,21 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1335,12 +1621,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1349,21 +1642,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.WorkflowInputParameter(id=None, type_=glob_target_type) + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] + target = cwl.WorkflowInputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1387,34 +1687,45 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_workflow_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if is_sequence(orig_step_input.source): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1433,8 +1744,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -1462,12 +1773,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -1498,24 +1814,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -1531,7 +1856,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -1542,7 +1869,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -1550,7 +1877,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -1563,13 +1890,14 @@ def replace_step_clt_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, - target: cwl.WorkflowInputParameter, + target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, replace_etool: bool, self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1583,8 +1911,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1592,9 +1921,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -1605,7 +1935,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1619,8 +1950,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1628,30 +1960,33 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), ) -> list[cwl.WorkflowInputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.WorkflowInputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -1659,17 +1994,18 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -1697,14 +2033,20 @@ def cltool_step_outputs_to_workflow_outputs( def generate_etool_from_expr2( expr: str, - target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, + target: cwl.WorkflowInputParameter | cwl.CommandInputParameter, inputs: Sequence[ cwl.WorkflowInputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1718,8 +2060,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -1734,19 +2076,47 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.ToolTimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1755,7 +2125,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1777,43 +2147,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if is_sequence(scattered_source_type): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1822,42 +2178,32 @@ def traverse_step( if not target: raise WorkflowException("target not found") input_source_id = None - source_type: None | ( - MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + source_type: ( + None + | MutableSequence[ + cwl.WorkflowInputParameter | cwl.CommandOutputParameter ] - | cwl.CommandInputParameter - | cwl.CommandOutputParameter | cwl.WorkflowInputParameter + | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.WorkflowInputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.WorkflowInputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if is_sequence(temp_type): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.WorkflowInputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1873,9 +2219,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1892,6 +2240,7 @@ def traverse_step( inp.valueFrom = None inp.source = f"{etool_id}/result" # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -1917,29 +2266,35 @@ def traverse_step( def workflow_step_to_WorkflowInputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> MutableSequence[ - cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter -]: + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str +) -> list[cwl.WorkflowInputParameter]: """Create WorkflowInputParameters to match the given WorkflowStep inputs.""" - params = [] + params: list[cwl.WorkflowInputParameter] = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if is_sequence(param): for p in param: - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + if not p.type_: + raise WorkflowException( + f"Don't know how to get type id for {p!r}." + ) + new_param = parameter_to_workflow_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + if not param.type_: + raise WorkflowException( + f"Don't know how to get type id for {param!r}." + ) + new_param = parameter_to_workflow_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params @@ -1950,15 +2305,17 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: None | ( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter - | MutableSequence[ + | Sequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter @@ -1995,22 +2352,19 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue wf_step_input.id = wf_step_input.id.split("/")[-1] if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2026,7 +2380,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2036,6 +2391,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2068,7 +2424,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/cwl_utils/cwl_v1_2_expression_refactor.py b/cwl_utils/cwl_v1_2_expression_refactor.py index 1fd73d74..634705b4 100755 --- a/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/cwl_utils/cwl_v1_2_expression_refactor.py @@ -6,7 +6,7 @@ import copy import hashlib import uuid -from collections.abc import Mapping, MutableSequence, Sequence +from collections.abc import MutableSequence, Sequence from contextlib import suppress from typing import Any, cast @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_2_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_2_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -25,6 +36,8 @@ CWLOutputType, CWLParameterContext, CWLRuntimeParameterContext, + is_file_or_directory, + is_sequence, ) @@ -44,7 +57,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" - output.outputBinding = cwl.CommandOutputBinding(stdout_path, None, None) + output.outputBinding = cwl.CommandOutputBinding(glob=stdout_path) if result: return result return process @@ -55,33 +68,66 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if is_sequence(cwltype.items): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.name: + cwltype.name = cwltype.name.split("/")[-1] + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if is_sequence(result): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if is_sequence(field): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -136,6 +182,178 @@ def get_expression( return None +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_clt_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_input_schema_to_plain_output_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_schema_to_plain_input_schema( + input_type: BasicOutputTypeSchemas, +) -> BasicInputTypeSchemas: + match input_type: + case cwl.OutputArraySchema(): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_output_schema_to_plain_input_schema( + input_type: OutputTypeSchemas, +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _plain_output_schema_to_plain_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_output_schema_to_plain_input_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: + if is_sequence(output_type): + return [ + _plain_output_type_to_clt_output_type(output_type_item) + for output_type_item in output_type + ] + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_workflow_input_paramater( + parameter: cwl.InputParameter | cwl.OutputParameter, +) -> cwl.WorkflowInputParameter: + return cwl.WorkflowInputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + + +def parameters_to_workflow_input_paramaters( + parameters: Sequence[ + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.WorkflowInputParameter]: + return [ + parameter_to_workflow_input_paramater(parameter) for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -151,7 +369,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -166,7 +384,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -326,53 +544,61 @@ def generate_etool_from_expr( self_type: None | ( cwl.WorkflowInputParameter | cwl.CommandInputParameter - | list[cwl.WorkflowInputParameter | cwl.CommandInputParameter] + | Sequence[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.WorkflowInputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type] + assert self_type is not None + new_type: InputTypeSchemas + if is_sequence(self_type): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if is_sequence(clean_type): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: new_type = clean_type_ids(self_type.type_) inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, list) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable if not is_sequence(self_type) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, list) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, list) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -380,8 +606,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -410,18 +636,28 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.ExpressionTool + | cwl.Operation + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -430,7 +666,12 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator + | cwl.Operation ], ) -> list[str] | None: """ @@ -452,26 +693,41 @@ def replace_expr_with_etool( name: str, workflow: cwl.Workflow, target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, - source: str | list[Any] | None, + source: str | Sequence[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -482,14 +738,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -520,26 +778,34 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.Operation ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -660,18 +926,17 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) if param.secondaryFiles: - if hasattr(param.secondaryFiles, "pattern") and get_expression( - param.secondaryFiles.pattern, inputs, EMPTY_FILE + if hasattr(param.secondaryFiles, "pattern") and has_expression( + param.secondaryFiles.pattern ): raise SourceLine( param.loadingOptions.original_doc, @@ -680,7 +945,7 @@ def process_workflow_inputs_and_outputs( ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) elif isinstance(param.secondaryFiles, MutableSequence): for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry.pattern, inputs, EMPTY_FILE): + if has_expression(entry.pattern): raise SourceLine( param.loadingOptions.original_doc, index2, @@ -709,26 +974,36 @@ def process_workflow_inputs_and_outputs( target_type = copy.deepcopy(param2.type_) if isinstance(target_type, cwl.OutputArraySchema): target_type.name = "" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) - if not isinstance(param2.outputSource, list): + target = cwl.WorkflowInputParameter( + id="", type_=plain_output_schema_to_plain_input_schema(target_type) + ) + assert param2.outputSource is not None + if not is_sequence(param2.outputSource): sources = param2.outputSource.split("#")[-1] else: sources = [s.split("#")[-1] for s in param2.outputSource] source_type_items = utils.type_for_source(workflow, sources) if isinstance(source_type_items, cwl.ArraySchema): - if isinstance(source_type_items.items, list): + if is_sequence(source_type_items.items): if "null" not in source_type_items.items: - source_type_items.items.append("null") + new_source_type_items_items = list(source_type_items.items) + new_source_type_items_items.append("null") + source_type_items.items = new_source_type_items_items elif source_type_items.items != "null": source_type_items.items = ["null", source_type_items.items] - elif isinstance(source_type_items, list): + source_type_items = cwl.CommandInputArraySchema.fromDoc( + source_type_items.save(), + source_type_items.loadingOptions.baseuri, + source_type_items.loadingOptions, + ) + elif is_sequence(source_type_items): if "null" not in source_type_items: - source_type_items.append("null") + new_source_type_items = list(source_type_items) + new_source_type_items.append("null") + source_type_items = new_source_type_items elif source_type_items != "null": source_type_items = ["null", source_type_items] - source_type = cwl.CommandInputParameter( - id=None, type_=source_type_items - ) + source_type = cwl.CommandInputParameter(id="", type_=source_type_items) replace_expr_with_etool( expression, etool_id, @@ -786,7 +1061,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -807,7 +1082,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -816,9 +1093,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter( - id=None, type_="long" - ) + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -843,7 +1118,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -864,18 +1139,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -885,17 +1160,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -903,16 +1180,9 @@ def process_workflow_reqs_and_hints( resources={}, ) modified = True - if ( - isinstance(expr_result, Mapping) - and "class" in expr_result - and ( - expr_result["class"] - in ("File", "Directory") - ) - ): + if is_file_or_directory(expr_result): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -923,38 +1193,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -964,24 +1234,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -990,10 +1260,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -1008,14 +1280,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -1026,15 +1302,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -1046,32 +1326,43 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1091,6 +1382,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -1100,6 +1392,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1107,7 +1400,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="string") + target = cwl.WorkflowInputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1120,7 +1413,10 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" generated_envVar_reqs.append((etool_id, env_index)) @@ -1131,11 +1427,11 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="long") + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1160,7 +1456,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1173,15 +1469,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1189,15 +1488,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.WorkflowInputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1214,31 +1513,41 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1254,14 +1563,14 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.WorkflowInputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1269,22 +1578,26 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1299,26 +1612,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1327,13 +1654,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1347,7 +1676,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False @@ -1361,24 +1690,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1387,22 +1720,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1413,17 +1752,21 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1438,12 +1781,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1452,21 +1802,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.WorkflowInputParameter(id=None, type_=glob_target_type) + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] + target = cwl.WorkflowInputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1490,34 +1847,45 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_workflow_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if is_sequence(orig_step_input.source): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1536,8 +1904,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -1565,12 +1933,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -1601,24 +1974,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -1634,7 +2016,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -1645,7 +2029,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -1653,7 +2037,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -1666,13 +2050,14 @@ def replace_step_clt_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, - target: cwl.WorkflowInputParameter, + target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, replace_etool: bool, self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1686,8 +2071,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1695,9 +2081,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -1708,7 +2095,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1722,8 +2110,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1731,30 +2120,37 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), ) -> list[cwl.WorkflowInputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.WorkflowInputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -1762,17 +2158,18 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -1800,14 +2197,21 @@ def cltool_step_outputs_to_workflow_outputs( def generate_etool_from_expr2( expr: str, - target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, + target: cwl.WorkflowInputParameter | cwl.CommandInputParameter, inputs: Sequence[ cwl.WorkflowInputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.Operation + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1821,8 +2225,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -1837,19 +2241,49 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator + | cwl.Operation ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.Loop + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.ToolTimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1858,7 +2292,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1880,43 +2314,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if is_sequence(scattered_source_type): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1925,42 +2345,32 @@ def traverse_step( if not target: raise WorkflowException("target not found") input_source_id = None - source_type: None | ( - MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + source_type: ( + None + | MutableSequence[ + cwl.WorkflowInputParameter | cwl.CommandOutputParameter ] - | cwl.CommandInputParameter - | cwl.CommandOutputParameter | cwl.WorkflowInputParameter + | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.WorkflowInputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.WorkflowInputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if is_sequence(temp_type): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.WorkflowInputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1976,9 +2386,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1994,15 +2406,8 @@ def traverse_step( ) inp.valueFrom = None inp.source = f"{etool_id}/result" - if step.when: - expression = get_expression(string=step.when, inputs=inputs, self=None) - if expression: - modified = True - replace_step_when_expr_with_etool( - expression, parent, step, original_step_ins, replace_etool - ) - # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -2028,29 +2433,35 @@ def traverse_step( def workflow_step_to_WorkflowInputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> MutableSequence[ - cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter -]: + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str +) -> list[cwl.WorkflowInputParameter]: """Create WorkflowInputParameters to match the given WorkflowStep inputs.""" - params = [] + params: list[cwl.WorkflowInputParameter] = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if is_sequence(param): for p in param: - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + if not p.type_: + raise WorkflowException( + f"Don't know how to get type id for {p!r}." + ) + new_param = parameter_to_workflow_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + if not param.type_: + raise WorkflowException( + f"Don't know how to get type id for {param!r}." + ) + new_param = parameter_to_workflow_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params @@ -2061,15 +2472,21 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: None | ( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter - | MutableSequence[ + | Sequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter @@ -2106,22 +2523,19 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue wf_step_input.id = wf_step_input.id.split("/")[-1] if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2137,7 +2551,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2147,72 +2562,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) - - -def replace_step_when_expr_with_etool( - expr: str, - workflow: cwl.Workflow, - step: cwl.WorkflowStep, - original_step_ins: list[cwl.WorkflowStepInput], - replace_etool: bool, -) -> None: - """Replace a WorkflowStep level 'when' expression with a sibling ExpressionTool step.""" - if not step.id: - raise WorkflowException(f"Missing id from {step}.") - etool_id = "_when_expression_{}".format(step.id.split("#")[-1]) - etool_inputs = workflow_step_to_WorkflowInputParameters( - original_step_ins, workflow, "" - ) - temp_etool = generate_etool_from_expr2( - expr, - cwl.WorkflowInputParameter(id=None, type_="boolean"), - etool_inputs, - None, - None, - [workflow, step], - ) - if replace_etool: - processes: list[ - (cwl.Workflow | cwl.CommandLineTool | cwl.ExpressionTool | cwl.WorkflowStep) - ] = [ - workflow, - step, - ] - cltool = etool_to_cltool(temp_etool, find_expressionLib(processes)) - etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool - else: - etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) - for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue - wf_step_input.id = wf_step_input.id.split("/")[-1] - if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if x.id and not x.id.startswith("_")] - scatter = copy.deepcopy(step.scatter) - if isinstance(scatter, str): - scatter = [scatter] - if isinstance(scatter, MutableSequence): - for index, entry in enumerate(scatter): - scatter[index] = entry.split("/")[-1] - scatter = step.scatter - workflow.steps.append( - cwl.WorkflowStep( - id=etool_id, - in_=wf_step_inputs, - out=[cwl.WorkflowStepOutput("result")], - run=etool, - scatter=scatter, - scatterMethod=step.scatterMethod, - ) - ) - step.when = "$(inputs._when)" - step.in_.append(cwl.WorkflowStepInput(id="_when", source=f"{etool_id}/result")) + workflow.steps = new_steps def traverse_workflow( @@ -2245,7 +2595,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/cwl_utils/docker_extract.py b/cwl_utils/docker_extract.py index f67163d0..6fa7528d 100755 --- a/cwl_utils/docker_extract.py +++ b/cwl_utils/docker_extract.py @@ -102,7 +102,9 @@ def extract_docker_requirements( yield req -def extract_docker_reqs(process: cwl.Process) -> Iterator[cwl.DockerRequirement]: +def extract_docker_reqs( + process: cwl.Process | cwl.WorkflowStep, +) -> Iterator[cwl.DockerRequirement]: """For the given process, extract the DockerRequirement(s).""" if process.requirements: for req in process.requirements: diff --git a/cwl_utils/inputs_schema_gen.py b/cwl_utils/inputs_schema_gen.py index 3f7304d5..24de43e3 100644 --- a/cwl_utils/inputs_schema_gen.py +++ b/cwl_utils/inputs_schema_gen.py @@ -6,17 +6,20 @@ """Generate JSON Schema from CWL inputs object.""" import argparse +import hashlib import json import logging import sys +from collections.abc import Sequence from contextlib import suppress from copy import deepcopy from importlib.resources import files from pathlib import Path -from typing import Any, TypeGuard +from typing import Any, TypeGuard, cast from urllib.parse import urlparse import requests +from schema_salad.utils import json_dumps from cwl_utils.loghandler import _logger as _cwlutilslogger from cwl_utils.parser import ( @@ -27,6 +30,7 @@ InputEnumSchema, InputRecordSchema, InputRecordSchemaTypes, + SchemaDefRequirement, Workflow, WorkflowInputParameter, cwl_v1_0, @@ -34,6 +38,7 @@ cwl_v1_2, load_document_by_uri, ) +from cwl_utils.types import is_sequence from cwl_utils.utils import ( get_value_from_uri, is_local_uri, @@ -252,7 +257,11 @@ def generate_json_schema_property_from_input_parameter( """ # Get the input name and documentation for description input_name = get_value_from_uri(str(input_parameter.id)) - doc = input_parameter.doc + doc = ( + "\n".join(input_parameter.doc) + if is_sequence(input_parameter.doc) + else input_parameter.doc + ) required = get_is_required_from_input_parameter(input_parameter) return JSONSchemaProperty( @@ -263,27 +272,27 @@ def generate_json_schema_property_from_input_parameter( ) -def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any]: - """ - Given a schema, generate a JSON schema definition. +def generate_definition_from_schema( + schema: InputRecordSchema | InputArraySchema | InputEnumSchema, +) -> dict[str, Any]: + """Given a schema, generate a JSON schema definition.""" + # TODO: handle InputArraySchema & InputEnumSchema (from SchemaDefRequirement.types) - :param schema: - :return: - """ # Sanitise each field of the schema sanitised_fields = {} - if schema.fields is None: - return {} + if isinstance(schema, InputRecordSchema): + if schema.fields is None: + return {} - for field in schema.fields: - sanitised_fields.update( - { - get_value_from_uri(field.name): sanitise_schema_field( - {"type": field.type_} - ) - } - ) + for field in schema.fields: + sanitised_fields.update( + { + get_value_from_uri(field.name): sanitise_schema_field( + {"type": field.type_} + ) + } + ) # Generate JSON properties property_list = [] @@ -316,8 +325,17 @@ def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any] ) property_list.append(prop) + if not isinstance(schema, cwl_v1_0.InputArraySchema) or hasattr(schema, "name"): + schema_name = to_pascal_case(get_value_from_uri(str(schema.name))) + else: + schema_name = ( + "AnonymousInputArraySchema" + + hashlib.sha1( # nosec + json_dumps(schema.save()).encode("utf-8") + ).hexdigest() + ) return { - to_pascal_case(get_value_from_uri(str(schema.name))): { + schema_name: { "type": "object", "properties": {prop.name: prop.type_dict for prop in property_list}, "required": [prop.name for prop in property_list if prop.required], @@ -325,7 +343,7 @@ def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any] } -def cwl_to_jsonschema(cwl_obj: Workflow | CommandLineTool) -> Any: +def cwl_to_jsonschema(cwl_obj: Workflow | CommandLineTool) -> dict[str, object]: """ cwl_obj: A CWL Object. @@ -386,11 +404,9 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: return input_record_schema - complex_schema_values: list[InputRecordSchema] = list( - map( - get_complex_schema_values, - complex_schema_keys, - ) + complex_schema_values: map[InputRecordSchema] = map( + get_complex_schema_values, + complex_schema_keys, ) # Load in all $imports to be referred by complex input types @@ -403,20 +419,21 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: if cwl_obj.requirements is not None: with suppress(StopIteration): - schema_def_requirement = next( - filter( - lambda requirement_iter: requirement_iter.class_ - == "SchemaDefRequirement", - cwl_obj.requirements, - ) + schema_def_requirement = cast( + SchemaDefRequirement, + next( + filter( + lambda requirement_iter: requirement_iter.class_ + == "SchemaDefRequirement", + cwl_obj.requirements, + ) + ), ) workflow_schema_definitions_list.extend( - list( - map( - generate_definition_from_schema, - schema_def_requirement.types, - ) + map( + generate_definition_from_schema, + schema_def_requirement.types, ) ) @@ -429,7 +446,7 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: properties = list( map( generate_json_schema_property_from_input_parameter, - cwl_obj.inputs, + cast(Sequence[WorkflowInputParameter], cwl_obj.inputs), ) ) diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index 6e105072..dff3cdb3 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -4,7 +4,7 @@ from abc import ABC from collections.abc import MutableMapping, MutableSequence from pathlib import Path -from typing import Any, Optional, TypeAlias, cast +from typing import Any, Optional, TypeAlias, cast, TypeVar from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -31,23 +31,37 @@ class NoType(ABC): InputRecordField: TypeAlias = ( cwl_v1_0.InputRecordField | cwl_v1_1.InputRecordField | cwl_v1_2.InputRecordField ) -"""Type union for a CWL v1.x InputRecordSchema object.""" +"""Type union for a CWL v1.x InputRecordField object.""" InputSchema: TypeAlias = ( cwl_v1_0.InputSchema | cwl_v1_1.InputSchema | cwl_v1_2.InputSchema ) """Type union for a CWL v1.x InputSchema object.""" OutputParameter: TypeAlias = ( - cwl_v1_0.OutputParameter | cwl_v1_1.OutputParameter | cwl_v1_2.OutputParameter + cwl_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.WorkflowOutputParameter + | cwl_v1_1.OutputParameter + | cwl_v1_2.OutputParameter ) """Type union for a CWL v1.x OutputParameter object.""" OutputArraySchema: TypeAlias = ( cwl_v1_0.OutputArraySchema | cwl_v1_1.OutputArraySchema | cwl_v1_2.OutputArraySchema ) """Type union for a CWL v1.x OutputArraySchema object.""" +OutputArraySchemaTypes = ( + cwl_v1_0.OutputArraySchema, + cwl_v1_1.OutputArraySchema, + cwl_v1_2.OutputArraySchema, +) OutputEnumSchema: TypeAlias = ( cwl_v1_0.OutputEnumSchema | cwl_v1_1.OutputEnumSchema | cwl_v1_2.OutputEnumSchema ) """Type union for a CWL v1.x OutputEnumSchema object.""" +OutputEnumSchemaTypes = ( + cwl_v1_0.OutputEnumSchema, + cwl_v1_1.OutputEnumSchema, + cwl_v1_2.OutputEnumSchema, +) OutputRecordField: TypeAlias = ( cwl_v1_0.OutputRecordField | cwl_v1_1.OutputRecordField | cwl_v1_2.OutputRecordField ) @@ -58,6 +72,11 @@ class NoType(ABC): | cwl_v1_2.OutputRecordSchema ) """Type union for a CWL v1.x OutputRecordSchema object.""" +OutputRecordSchemaTypes = ( + cwl_v1_0.OutputRecordSchema, + cwl_v1_1.OutputRecordSchema, + cwl_v1_2.OutputRecordSchema, +) OutputSchema: TypeAlias = ( cwl_v1_0.OutputSchema | cwl_v1_1.OutputSchema | cwl_v1_2.OutputSchema ) @@ -97,6 +116,12 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepOutput ) """Type union for a CWL v1.x WorkflowStepOutput object.""" +Operation: TypeAlias = cwl_v1_2.Operation +"""Type union for a CWL v1.x Operation object.""" +OperationInputParameter: TypeAlias = cwl_v1_2.OperationInputParameter +"""Type union for a CWL v1.x OperationInputParameter object.""" +OperationOutputParameter: TypeAlias = cwl_v1_2.OperationOutputParameter +"""Type union for a CWL v1.x OperationOutputParameter object.""" CommandLineTool: TypeAlias = ( cwl_v1_0.CommandLineTool | cwl_v1_1.CommandLineTool | cwl_v1_2.CommandLineTool ) @@ -138,6 +163,17 @@ class NoType(ABC): | cwl_v1_2.CommandOutputRecordField ) """Type union for a CWL v1.x CommandOutputRecordField object.""" +CommandOutputRecordSchema: TypeAlias = ( + cwl_v1_0.CommandOutputRecordSchema + | cwl_v1_1.CommandOutputRecordSchema + | cwl_v1_2.CommandOutputRecordSchema +) +CommandOutputRecordSchemaTypes = ( + cwl_v1_0.CommandOutputRecordSchema, + cwl_v1_1.CommandOutputRecordSchema, + cwl_v1_2.CommandOutputRecordSchema, +) +"""Type Union for a CWL v1.x CommandOutputRecordSchema object.""" ExpressionTool: TypeAlias = ( cwl_v1_0.ExpressionTool | cwl_v1_1.ExpressionTool | cwl_v1_2.ExpressionTool ) @@ -214,7 +250,8 @@ class NoType(ABC): cwl_v1_1.InputRecordSchema, cwl_v1_2.InputRecordSchema, ) -"""Type Union for a CWL v1.x RecordSchema object.""" +"""Type Union for a CWL v1.x InputRecordSchema object.""" + File: TypeAlias = cwl_v1_0.File | cwl_v1_1.File | cwl_v1_2.File """Type Union for a CWL v1.x File object.""" SecondaryFileSchema: TypeAlias = ( @@ -225,20 +262,18 @@ class NoType(ABC): """Type Union for a CWL v1.x Directory object.""" Dirent: TypeAlias = cwl_v1_0.Dirent | cwl_v1_1.Dirent | cwl_v1_2.Dirent """Type Union for a CWL v1.x Dirent object.""" -LoadContents: TypeAlias = ( - cwl_v1_1.CommandInputParameter - | cwl_v1_2.CommandInputParameter - | cwl_v1_1.CommandOutputBinding - | cwl_v1_2.CommandOutputBinding - | cwl_v1_1.InputRecordField - | cwl_v1_2.InputRecordField - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_1.WorkflowStepInput - | cwl_v1_2.WorkflowStepInput -) +LoadContents: TypeAlias = cwl_v1_1.LoadContents | cwl_v1_2.LoadContents """Type Union for a CWL v1.x LoadContents object.""" -_Loader: TypeAlias = cwl_v1_0._Loader | cwl_v1_1._Loader | cwl_v1_2._Loader +SchemaDefRequirement: TypeAlias = ( + cwl_v1_0.SchemaDefRequirement + | cwl_v1_1.SchemaDefRequirement + | cwl_v1_2.SchemaDefRequirement +) +"""Type Union for a CWL v1.x SchemaDefRequirement object.""" +__T = TypeVar("__T", covariant=True) +_Loader: TypeAlias = ( + cwl_v1_0._Loader[__T] | cwl_v1_1._Loader[__T] | cwl_v1_2._Loader[__T] +) """Type union for a CWL v1.x _Loader.""" diff --git a/cwl_utils/parser/cwl_v1_0.py b/cwl_utils/parser/cwl_v1_0.py index 7f3110dd..02fe801e 100644 --- a/cwl_utils/parser/cwl_v1_0.py +++ b/cwl_utils/parser/cwl_v1_0.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import i32, i64, mypyc_attr +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,31 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) +S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +65,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +94,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +136,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +216,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@mypyc_attr(native_class=True) +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +227,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,12 +239,12 @@ def save( def load_field( - val: Union[str, dict[str, str]], - fieldtype: "_Loader", + val: Any | None, + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, -) -> Any: + lc: Any | None = None, +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -251,7 +267,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -328,7 +346,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -367,7 +385,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -428,34 +446,37 @@ def expand_url( return url -class _Loader: +@mypyc_attr(native_class=True) +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: - pass + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: ... -class _AnyLoader(_Loader): +@mypyc_attr(native_class=True) +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: +@mypyc_attr(native_class=True) +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -463,9 +484,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -474,8 +495,9 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +@mypyc_attr(native_class=True) +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -483,9 +505,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -531,13 +553,14 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +@mypyc_attr(native_class=True) +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + values: _Loader[T], + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +572,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -574,7 +597,8 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +@mypyc_attr(native_class=True) +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -584,19 +608,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> E: if doc in self.symbols: - return doc + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +@mypyc_attr(native_class=True) +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -604,75 +629,77 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +@mypyc_attr(native_class=True) +class _RecordLoader(_Loader[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +710,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -701,7 +728,8 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +@mypyc_attr(native_class=True) +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -710,23 +738,25 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: +@mypyc_attr(native_class=True) +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -734,9 +764,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: errors: Final = [] if lc is None: @@ -811,14 +841,15 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +@mypyc_attr(native_class=True) +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +862,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -879,8 +911,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: +@mypyc_attr(native_class=True) +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +923,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +932,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +944,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,9 +958,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -949,8 +982,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: +@mypyc_attr(native_class=True) +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,9 +994,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -989,12 +1023,12 @@ def load( def _document_load( - loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + loader: _Loader[T], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1059,11 +1093,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1151,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,37 +1202,14 @@ def parser_info() -> str: return "org.w3id.cwl.v1_0" -class Documented(Saveable): - pass - - -class RecordField(Documented): +@mypyc_attr(native_class=True) +class RecordField(Saveable): """ A field of a record. """ name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1228,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1273,14 +1284,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1376,7 +1387,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,13 +1412,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1422,7 +1433,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1441,16 +1452,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1468,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1491,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1594,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1654,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1669,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +@mypyc_attr(native_class=True) +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1702,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1745,14 +1758,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1849,7 +1861,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1880,7 +1892,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1895,7 +1907,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -1913,16 +1925,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1941,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +@mypyc_attr(native_class=True) +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1964,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2068,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2127,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2142,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2164,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2268,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2327,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2342,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + + +@mypyc_attr(native_class=True) +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2364,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2468,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2527,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2542,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +@mypyc_attr(native_class=True) +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2564,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2668,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2727,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2742,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2770,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2809,14 +2826,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2912,7 +2929,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,13 +2954,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2958,7 +2975,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -2977,16 +2994,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +3010,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3033,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3136,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,9 +3196,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Record_name, + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -3250,43 +3289,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3331,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3689,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3872,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3985,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4001,6 +4040,7 @@ def save( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4035,7 +4075,7 @@ class Directory(Saveable): the same Directory. When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigend. + first and have local values of `path` assigned. Directory objects in CommandLineTool output must provide either a `location` URI or a `path` property in the context of the tool execution @@ -4049,29 +4089,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4111,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4323,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,50 +4399,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) - - -class SchemaBase(Saveable): - pass - - -class Parameter(SchemaBase): - """ - Define an input or output parameter to a process. - - """ - - pass - - -class InputBinding(Saveable): - pass - - -class OutputBinding(Saveable): - pass - - -class InputSchema(SchemaBase): - pass - - -class OutputSchema(SchemaBase): - pass - - -class InputRecordField(CWLRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4435,11 +4416,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) + + +@mypyc_attr(native_class=True) +class InputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): @@ -4461,8 +4451,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4517,14 +4507,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -4714,7 +4704,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4739,15 +4729,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, inputBinding=inputBinding, label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -4762,7 +4752,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -4792,20 +4782,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "inputBinding", "label"]) - - -class InputRecordSchema(CWLRecordSchema, InputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4815,10 +4800,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + self.inputBinding = inputBinding self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) + + +@mypyc_attr(native_class=True) +class InputRecordSchema(CWLRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): @@ -4839,8 +4834,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4895,14 +4890,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5045,7 +5039,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5070,14 +5064,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5092,7 +5086,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5115,21 +5109,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5139,11 +5126,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +@mypyc_attr(native_class=True) +class InputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5167,8 +5160,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5223,14 +5216,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5421,7 +5413,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5454,7 +5446,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5469,7 +5461,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -5498,18 +5490,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "inputBinding"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5519,11 +5508,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class InputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): return bool( @@ -5543,8 +5540,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5741,7 +5738,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5813,20 +5810,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "inputBinding"]) - - -class OutputRecordField(CWLRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5836,10 +5827,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ - self.outputBinding = outputBinding + self.label = label + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -5860,8 +5860,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5916,14 +5916,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6066,7 +6066,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6091,14 +6091,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6113,7 +6113,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6139,17 +6139,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "outputBinding"]) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6159,10 +6156,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ - self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + +@mypyc_attr(native_class=True) +class OutputRecordSchema(CWLRecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): return bool( @@ -6181,8 +6186,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6331,7 +6336,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6396,21 +6401,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6420,11 +6417,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) + + +@mypyc_attr(native_class=True) +class OutputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -6448,8 +6450,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6504,14 +6506,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -6702,7 +6703,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6735,7 +6736,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6750,7 +6751,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -6779,18 +6780,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "outputBinding"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6800,11 +6798,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.outputBinding = outputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class OutputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): return bool( @@ -6824,8 +6830,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7022,7 +7028,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7094,25 +7100,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "outputBinding"]) - - -class InputParameter(Parameter): - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - inputBinding: Optional[Any] = None, - default: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7122,15 +7117,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.inputBinding = inputBinding - self.default = default + self.items = items self.type_ = type_ + self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class InputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputParameter): @@ -7168,8 +7167,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7224,14 +7223,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -7608,7 +7607,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7633,11 +7632,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -7645,7 +7644,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -7660,7 +7659,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -7711,35 +7710,19 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "inputBinding", - "default", - "type", - ] - ) - - -class OutputParameter(Parameter): - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | None | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7753,9 +7736,30 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding + self.id = id self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "inputBinding", + "default", + "type", + ] + ) + + +@mypyc_attr(native_class=True) +class OutputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputParameter): @@ -7789,8 +7793,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7845,14 +7849,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -8135,7 +8139,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8160,17 +8164,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -8185,7 +8189,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -8228,7 +8232,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -8241,33 +8273,8 @@ def save( ) -class ProcessRequirement(Saveable): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -class Process(Saveable): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - pass - - -class InlineJavascriptRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression @@ -8275,23 +8282,6 @@ class InlineJavascriptRequirement(ProcessRequirement): """ - def __init__( - self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib - def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): return bool( @@ -8309,8 +8299,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8380,7 +8370,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8446,10 +8436,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -class SchemaDefRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8461,23 +8469,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8492,8 +8483,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8564,7 +8555,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8627,23 +8618,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8653,8 +8632,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + + +@mypyc_attr(native_class=True) +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8672,8 +8663,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8776,7 +8767,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8836,10 +8827,29 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) -class CommandLineBinding(InputBinding): +@mypyc_attr(native_class=True) +class CommandLineBinding(Saveable): """ When listed under `inputBinding` in the input schema, the term @@ -8879,34 +8889,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -8939,8 +8921,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9276,7 +9258,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9373,7 +9355,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | i32 = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9386,7 +9396,8 @@ def save( ) -class CommandOutputBinding(OutputBinding): +@mypyc_attr(native_class=True) +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9401,26 +9412,6 @@ class CommandOutputBinding(OutputBinding): """ - def __init__( - self, - glob: Optional[Any] = None, - loadContents: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.glob = glob - self.loadContents = loadContents - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9439,8 +9430,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9588,7 +9579,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9659,21 +9650,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["glob", "loadContents", "outputEval"]) - - -class CommandInputRecordField(InputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + glob: None | Sequence[str] | str = None, + loadContents: None | bool = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9683,11 +9666,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.glob = glob + self.loadContents = loadContents + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) + + +@mypyc_attr(native_class=True) +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9709,8 +9697,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9765,14 +9753,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -9962,7 +9950,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9987,15 +9975,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, inputBinding=inputBinding, label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10010,7 +9998,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10040,20 +10028,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "inputBinding", "label"]) - - -class CommandInputRecordSchema(InputRecordSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10063,10 +10046,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + self.inputBinding = inputBinding self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputRecordSchema(InputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): @@ -10087,8 +10080,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10143,14 +10136,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10293,7 +10285,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10318,14 +10310,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10340,7 +10332,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -10363,21 +10355,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class CommandInputEnumSchema(InputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10387,11 +10372,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +@mypyc_attr(native_class=True) +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): @@ -10415,8 +10406,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10471,14 +10462,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -10669,7 +10659,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10702,7 +10692,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10717,7 +10707,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -10746,18 +10736,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "inputBinding"]) - - -class CommandInputArraySchema(InputArraySchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10767,11 +10754,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputArraySchema(InputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -10791,8 +10786,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10989,7 +10984,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11061,20 +11056,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11084,10 +11073,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ - self.outputBinding = outputBinding + self.label = label + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11108,8 +11106,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11164,14 +11162,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -11314,7 +11312,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11339,14 +11337,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11361,7 +11359,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -11387,20 +11385,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "outputBinding"]) - - -class CommandOutputRecordSchema(OutputRecordSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11410,10 +11402,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputRecordSchema(OutputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): @@ -11434,8 +11435,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11490,14 +11491,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -11640,7 +11640,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11665,14 +11665,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11687,7 +11687,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11710,21 +11710,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11734,11 +11727,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.outputBinding = outputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +@mypyc_attr(native_class=True) +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -11762,8 +11761,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11818,14 +11817,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -12016,7 +12014,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12049,7 +12047,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12064,7 +12062,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -12093,18 +12091,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "outputBinding"]) - - -class CommandOutputArraySchema(OutputArraySchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12114,11 +12109,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.outputBinding = outputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputArraySchema(OutputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): return bool( @@ -12138,8 +12141,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12336,7 +12339,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12408,29 +12411,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "outputBinding"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - inputBinding: Optional[Any] = None, - default: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12440,15 +12428,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.inputBinding = inputBinding - self.default = default + self.items = items self.type_ = type_ + self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -12486,8 +12482,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12542,14 +12538,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -12926,7 +12922,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12951,11 +12947,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -12963,7 +12959,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -12978,7 +12974,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -13029,40 +13025,19 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "inputBinding", - "default", - "type", - ] - ) - - -class CommandOutputParameter(OutputParameter): - """ - An output parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | None | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13076,11 +13051,35 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding + self.id = id self.format = format + self.inputBinding = inputBinding + self.default = default self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "inputBinding", + "default", + "type", + ] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputParameter(OutputParameter): + """ + An output parameter for a CommandLineTool. + """ + + id: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -13115,8 +13114,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13171,14 +13170,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -13508,7 +13507,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13533,18 +13532,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13559,7 +13558,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -13606,7 +13605,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | None | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -13620,7 +13649,8 @@ def save( ) -class CommandLineTool(Process): +@mypyc_attr(native_class=True) +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -13628,53 +13658,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -13727,8 +13710,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13783,14 +13766,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -14514,7 +14496,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14558,7 +14540,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14573,7 +14555,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -14666,7 +14648,54 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -14689,7 +14718,8 @@ def save( ) -class DockerRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](http://docker.com) container, and specifies how to fetch or build @@ -14727,33 +14757,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -14786,8 +14789,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15092,7 +15095,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15198,7 +15201,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -15211,30 +15241,14 @@ def save( ) -class SoftwareRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -15249,8 +15263,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15321,7 +15335,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15384,17 +15398,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15404,10 +15412,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +@mypyc_attr(native_class=True) +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -15426,8 +15438,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15576,7 +15588,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15640,25 +15652,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) - - -class Dirent(Saveable): - """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. - - """ - def __init__( self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15668,9 +15668,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +@mypyc_attr(native_class=True) +class Dirent(Saveable): + """ + Define a file or subdirectory that must be placed in the designated output + directory prior to executing the command line tool. May be the result of + executing an expression, such as building a configuration file from a + template. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): @@ -15690,8 +15703,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15840,7 +15853,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15908,19 +15921,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15930,8 +15937,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +@mypyc_attr(native_class=True) +class InitialWorkDirRequirement(Saveable): + """ + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -15947,8 +15964,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16019,7 +16036,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16082,21 +16099,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16106,8 +16113,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +@mypyc_attr(native_class=True) +class EnvVarRequirement(Saveable): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -16123,8 +16141,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16195,7 +16213,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16258,25 +16276,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) - - -class ShellCommandRequirement(ProcessRequirement): - """ - Modify the behavior of CommandLineTool to generate a single string - containing a shell command line. Each item in the argument list must be - joined into a string separated by single spaces and quoted to prevent - intepretation by the shell, unless `CommandLineBinding` for that argument - contains `shellQuote: false`. If `shellQuote: false` is specified, the - argument is joined into the command string without quoting, which allows - the use of shell metacharacters such as `|` for pipes. - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16286,24 +16290,41 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef - def __eq__(self, other: Any) -> bool: - if isinstance(other, ShellCommandRequirement): - return bool(self.class_ == other.class_) - return False + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) - def __hash__(self) -> int: - return hash((self.class_)) - @classmethod +@mypyc_attr(native_class=True) +class ShellCommandRequirement(Saveable): + """ + Modify the behavior of CommandLineTool to generate a single string + containing a shell command line. Each item in the argument list must be + joined into a string separated by single spaces and quoted to prevent + interpretation by the shell, unless `CommandLineBinding` for that argument + contains `shellQuote: false`. If `shellQuote: false` is specified, the + argument is joined into the command string without quoting, which allows + the use of shell metacharacters such as `|` for pipes. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ShellCommandRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod def fromDoc( cls, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16326,7 +16347,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16382,10 +16403,26 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -16410,37 +16447,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -16477,8 +16483,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16506,7 +16512,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -16600,7 +16606,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -16647,7 +16653,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -16741,7 +16747,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -16788,7 +16794,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -16835,7 +16841,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -16877,7 +16883,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16987,7 +16993,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | i32 | str = None, + coresMax: None | i32 | str = None, + ramMin: None | i32 | str = None, + ramMax: None | i32 | str = None, + tmpdirMin: None | i32 | str = None, + tmpdirMax: None | i32 | str = None, + outdirMin: None | i32 | str = None, + outdirMax: None | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -17002,39 +17039,10 @@ def save( ) +@mypyc_attr(native_class=True) class ExpressionToolOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): return bool( @@ -17069,8 +17077,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17125,14 +17133,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -17462,7 +17470,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17487,18 +17495,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -17513,7 +17521,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -17560,7 +17568,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -17574,7 +17612,8 @@ def save( ) -class ExpressionTool(Process): +@mypyc_attr(native_class=True) +class ExpressionTool(Saveable): """ Execute an expression as a Workflow step. @@ -17582,39 +17621,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -17653,8 +17659,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17709,14 +17715,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -18112,7 +18117,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18149,7 +18154,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18164,7 +18169,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -18220,7 +18225,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -18236,6 +18274,7 @@ def save( ) +@mypyc_attr(native_class=True) class WorkflowOutputParameter(OutputParameter): """ Describe an output parameter of a workflow. The parameter must be @@ -18246,40 +18285,6 @@ class WorkflowOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): return bool( @@ -18318,8 +18323,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18374,14 +18379,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -18805,7 +18810,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18830,11 +18835,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, outputSource=outputSource, @@ -18843,7 +18848,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18858,7 +18863,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -18912,7 +18917,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -18928,11 +18967,8 @@ def save( ) -class Sink(Saveable): - pass - - -class WorkflowStepInput(Sink): +@mypyc_attr(native_class=True) +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input @@ -18978,30 +19014,6 @@ class WorkflowStepInput(Sink): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.source = source - self.linkMerge = linkMerge - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -19024,8 +19036,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19080,14 +19092,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -19276,7 +19288,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19301,15 +19313,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, source=source, linkMerge=linkMerge, - id=id, default=default, valueFrom=valueFrom, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19324,7 +19336,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -19350,25 +19362,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["source", "linkMerge", "id", "default", "valueFrom"]) - - -class WorkflowStepOutput(Saveable): - """ - Associate an output parameter of the underlying process with a workflow - parameter. The workflow parameter (given in the `id` field) be may be used - as a `source` to connect with input parameters of other workflow steps, or - with an output parameter of the process. - - """ - - id: str - def __init__( self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19378,24 +19380,45 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.source = source + self.linkMerge = linkMerge + self.id = id + self.default = default + self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepOutput): - return bool(self.id == other.id) - return False + attrs: ClassVar[Collection[str]] = frozenset( + ["source", "linkMerge", "id", "default", "valueFrom"] + ) - def __hash__(self) -> int: - return hash((self.id)) - @classmethod +@mypyc_attr(native_class=True) +class WorkflowStepOutput(Saveable): + """ + Associate an output parameter of the underlying process with a workflow + parameter. The workflow parameter (given in the `id` field) be may be used + as a `source` to connect with input parameters of other workflow steps, or + with an output parameter of the process. + + """ + + id: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, WorkflowStepOutput): + return bool(self.id == other.id) + return False + + def __hash__(self) -> int: + return hash((self.id)) + + @classmethod def fromDoc( cls, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19450,15 +19473,15 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + else: + baseuri = id + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19485,7 +19508,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19500,7 +19523,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -19511,9 +19534,26 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) +@mypyc_attr(native_class=True) class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the @@ -19576,40 +19616,6 @@ class WorkflowStep(Saveable): id: str - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -19648,8 +19654,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19704,14 +19710,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("in") is None: raise ValidationException("missing required field `in`", None, []) @@ -20138,7 +20144,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20176,7 +20182,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20191,7 +20197,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.in_ is not None: r["in"] = save( @@ -20239,7 +20245,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + label: None | str = None, + doc: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "in", @@ -20255,7 +20295,8 @@ def save( ) -class Workflow(Process): +@mypyc_attr(native_class=True) +class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a @@ -20275,7 +20316,7 @@ class Workflow(Process): The `source` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fufilled, the step is ready to + data links inbound to a given step are fulfilled, the step is ready to execute. ## Workflow success and failure @@ -20307,39 +20348,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -20378,8 +20386,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20434,14 +20442,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -20837,7 +20844,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20874,7 +20881,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20889,7 +20896,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -20942,7 +20949,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -20958,28 +20998,14 @@ def save( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -20994,8 +21020,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21018,7 +21044,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21074,20 +21100,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21097,7 +21113,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class ScatterFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -21113,8 +21140,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21137,7 +21164,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21193,20 +21220,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21216,7 +21233,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -21232,8 +21260,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21256,7 +21284,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21312,20 +21340,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21335,7 +21353,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -21351,8 +21380,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21375,7 +21404,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21431,15 +21460,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class LoadListingRequirement(ProcessRequirement): def __init__( self, - loadListing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21449,9 +21473,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.class_: Final[str] = "StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +@mypyc_attr(native_class=True) +class LoadListingRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): return bool( @@ -21468,8 +21496,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21540,7 +21568,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21606,15 +21634,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class InplaceUpdateRequirement(ProcessRequirement): def __init__( self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: LoadListingEnum, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21624,9 +21648,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.class_: Final[str] = "LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + +@mypyc_attr(native_class=True) +class InplaceUpdateRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -21644,8 +21673,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21716,7 +21745,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21782,15 +21811,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) - - -class Secrets(ProcessRequirement): def __init__( self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21800,9 +21825,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) + +@mypyc_attr(native_class=True) +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -21817,8 +21847,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21889,7 +21919,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21951,23 +21981,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class TimeLimit(ProcessRequirement): - """ - Set an upper limit on the execution time of a CommandLineTool or - ExpressionTool. A tool execution which exceeds the time limit may - be preemptively terminated and considered failed. May also be - used by batch systems to make scheduling decisions. - - """ - def __init__( self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21977,8 +21995,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "TimeLimit" - self.timelimit = timelimit + self.class_: Final[str] = "Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +@mypyc_attr(native_class=True) +class TimeLimit(Saveable): + """ + Set an upper limit on the execution time of a CommandLineTool or + ExpressionTool. A tool execution which exceeds the time limit may + be preemptively terminated and considered failed. May also be + used by batch systems to make scheduling decisions. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, TimeLimit): @@ -21996,8 +22027,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "TimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22068,7 +22099,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22134,10 +22165,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) + def __init__( + self, + timelimit: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "TimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) -class WorkReuse(ProcessRequirement): +@mypyc_attr(native_class=True) +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same @@ -22151,23 +22200,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -22184,8 +22216,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22256,7 +22288,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22322,34 +22354,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) - - -class NetworkAccess(ProcessRequirement): - """ - Indicate whether a process requires outgoing IPv4/IPv6 network - access. Choice of IPv4 or IPv6 is implementation and site - specific, correct tools must support both. - - If `networkAccess` is false or not specified, tools must not - assume network access, except for localhost (the loopback device). - - If `networkAccess` is true, the tool must be able to make outgoing - connections to network resources. Resources may be on a private - subnet or the public Internet. However, implementations and sites - may apply their own security policies to restrict what is - accessible by the tool. - - Enabling network access does not imply a publicly routable IP - address or the ability to accept inbound connections. - - """ - def __init__( self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -22359,8 +22368,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess + self.class_: Final[str] = "WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) + + +@mypyc_attr(native_class=True) +class NetworkAccess(Saveable): + """ + Indicate whether a process requires outgoing IPv4/IPv6 network + access. Choice of IPv4 or IPv6 is implementation and site + specific, correct tools must support both. + + If `networkAccess` is false or not specified, tools must not + assume network access, except for localhost (the loopback device). + + If `networkAccess` is true, the tool must be able to make outgoing + connections to network resources. Resources may be on a private + subnet or the public Internet. However, implementations and sites + may apply their own security policies to restrict what is + accessible by the tool. + + Enabling network access does not imply a publicly routable IP + address or the ability to accept inbound connections. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): @@ -22379,8 +22412,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22451,7 +22484,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22517,25 +22550,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -22545,16 +22564,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) + + +@mypyc_attr(native_class=True) +class ProcessGenerator(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -22594,8 +22612,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22650,14 +22668,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -22728,7 +22745,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_OutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -23053,7 +23070,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23090,7 +23107,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23105,7 +23122,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -23157,7 +23174,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -23173,29 +23223,13 @@ def save( ) -class MPIRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -23212,8 +23246,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23284,7 +23318,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23350,23 +23384,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23376,11 +23398,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +@mypyc_attr(native_class=True) +class CUDARequirement(Saveable): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -23410,8 +23439,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23624,7 +23653,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23714,23 +23743,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23740,9 +23760,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + +@mypyc_attr(native_class=True) +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -23757,8 +23793,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23829,7 +23865,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23892,10 +23928,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShmSize" + self.shmSize = shmSize + + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -23987,16 +24040,6 @@ def save( "deep_listing": "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", "float": "http://www.w3.org/2001/XMLSchema#float", @@ -24015,9 +24058,8 @@ def save( "string": "http://www.w3.org/2001/XMLSchema#string", "union": "https://w3id.org/cwl/salad#union", "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -24109,16 +24151,6 @@ def save( "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", "http://www.w3.org/2001/XMLSchema#float": "float", @@ -24137,16 +24169,19 @@ def save( "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/salad#union": "union", "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -24172,17 +24207,23 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -24201,74 +24242,119 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, - ) +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None ) -CWLInputFileLoader = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - ), - "CWLVersion", +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) + ) +) +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True) +CWLInputFileLoader: Final[_Loader[Mapping[str, CWLObjectType | None]]] = ( + map_of_union_of_None_type_or_CWLObjectTypeLoader ) +CWLVersion: TypeAlias = Literal["v1.0"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.0",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ -ExpressionLoader = _ExpressionLoader(str) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -InputParameterLoader = _RecordLoader(InputParameter, None, None) -OutputParameterLoader = _RecordLoader(OutputParameter, None, None) -InlineJavascriptRequirementLoader = _RecordLoader( - InlineJavascriptRequirement, None, None +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +InputParameterLoader: Final[_Loader[InputParameter]] = _RecordLoader( + InputParameter, None, None +) +OutputParameterLoader: Final[_Loader[OutputParameter]] = _RecordLoader( + OutputParameter, None, None +) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) +) +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None +) +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) +) +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None +) +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( + CommandInputArraySchema, None, None ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdoutLoader = _EnumLoader(("stdout",), "stdout") +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) +) +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) +) +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None +) +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None +) +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24312,7 +24398,8 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24356,20 +24443,39 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( - ExpressionToolOutputParameter, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None +) +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None +) +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None +) +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) +) +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None ) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None +) +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None +) +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -24379,10 +24485,19 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -24393,38 +24508,68 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( - SubworkflowFeatureRequirement, None, None +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) +) +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) +) +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) +) +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( - MultipleInputFeatureRequirement, None, None +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) ) -StepInputExpressionRequirementLoader = _RecordLoader( - StepInputExpressionRequirement, None, None +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +TimeLimitLoader: Final[_Loader[TimeLimit]] = _RecordLoader(TimeLimit, None, None) +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None ) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -SecretsLoader = _RecordLoader(Secrets, None, None) -TimeLimitLoader = _RecordLoader(TimeLimit, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None +) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24435,10 +24580,41 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24450,51 +24626,110 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24503,10 +24738,23 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24516,73 +24764,104 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( None_type, array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( - Directory_classLoader, False, True, None, None +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( + ("Directory",), "Directory_class" ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( + _URILoader(Directory_classLoader, False, True, None, None) +) +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader = _ArrayLoader( - union_of_strtype_or_ExpressionLoader +array_of_union_of_strtype_or_ExpressionLoader: Final[_Loader[Sequence[str]]] = ( + _ArrayLoader(union_of_strtype_or_ExpressionLoader) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -24590,13 +24869,15 @@ def save( array_of_union_of_strtype_or_ExpressionLoader, ) ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24605,10 +24886,25 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24618,35 +24914,65 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24655,10 +24981,27 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24668,35 +25011,65 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -24704,14 +25077,28 @@ def save( ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | None + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24722,30 +25109,74 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | None + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -array_of_InputParameterLoader = _ArrayLoader(InputParameterLoader) -idmap_inputs_array_of_InputParameterLoader = _IdMapLoader( - array_of_InputParameterLoader, "id", "type" +array_of_InputParameterLoader: Final[_Loader[Sequence[InputParameter]]] = _ArrayLoader( + InputParameterLoader +) +idmap_inputs_array_of_InputParameterLoader: Final[_Loader[Sequence[InputParameter]]] = ( + _IdMapLoader(array_of_InputParameterLoader, "id", "type") ) -array_of_OutputParameterLoader = _ArrayLoader(OutputParameterLoader) -idmap_outputs_array_of_OutputParameterLoader = _IdMapLoader( - array_of_OutputParameterLoader, "id", "type" +array_of_OutputParameterLoader: Final[_Loader[Sequence[OutputParameter]]] = ( + _ArrayLoader(OutputParameterLoader) ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +idmap_outputs_array_of_OutputParameterLoader: Final[ + _Loader[Sequence[OutputParameter]] +] = _IdMapLoader(array_of_OutputParameterLoader, "id", "type") +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24770,21 +25201,126 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24810,60 +25346,159 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -InlineJavascriptRequirement_classLoader = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[CWLVersion | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] +InlineJavascriptRequirement_classLoader: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) + ) ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[SchemaDefRequirement_class] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) +union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( + Final[_Loader[InputArraySchema | InputEnumSchema | InputRecordSchema]] +) = _UnionLoader( ( - None_type, - array_of_strtype, + InputRecordSchemaLoader, + InputEnumSchemaLoader, + InputArraySchemaLoader, ) ) -SchemaDefRequirement_classLoader = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" -) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None +array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: Final[ + _Loader[Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema]] +] = _ArrayLoader( + union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader ) -union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = ( - _UnionLoader( - ( - InputRecordSchemaLoader, - InputEnumSchemaLoader, - InputArraySchemaLoader, - ) +union_of_None_type_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( + ( + None_type, + inttype, ) ) -array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = _ArrayLoader( - union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader -) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -24871,7 +25506,15 @@ def save( array_of_strtype, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24880,10 +25523,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24893,31 +25561,73 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24926,10 +25636,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24939,31 +25674,81 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | None + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24974,12 +25759,46 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | None + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | None + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24992,72 +25811,110 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | None + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( - CommandLineTool_classLoader, False, True, None, None -) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[CommandLineTool_class] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( - DockerRequirement_classLoader, False, True, None, None -) -SoftwareRequirement_classLoader = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[DockerRequirement_class] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[SoftwareRequirement_class] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True -) -InitialWorkDirRequirement_classLoader = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" -) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None -) -union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader = _UnionLoader( +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] +InitialWorkDirRequirement_classLoader: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) +union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( + Final[_Loader[Directory | Dirent | File | str]] +) = _UnionLoader( ( FileLoader, DirectoryLoader, @@ -25066,39 +25923,61 @@ def save( ExpressionLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: Final[ + _Loader[Sequence[Directory | Dirent | File | str]] +] = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader ) -union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader: Final[ + _Loader[Sequence[Directory | Dirent | File | str] | str] +] = _UnionLoader( ( array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader, strtype, ExpressionLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None -) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[EnvVarRequirement_class] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -ShellCommandRequirement_classLoader = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") ) -ResourceRequirement_classLoader = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[ShellCommandRequirement_class] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( - ResourceRequirement_classLoader, False, True, None, None +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[ResourceRequirement_class] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( + ( + None_type, + inttype, + inttype, + strtype, + ExpressionLoader, + ) ) -union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( ( None_type, inttype, @@ -25106,7 +25985,19 @@ def save( ExpressionLoader, ) ) -union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | None + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25117,67 +26008,94 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | None + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( - ExpressionTool_classLoader, False, True, None, None -) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( - ExpressionToolOutputParameterLoader +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" -) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None -) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[ExpressionTool_class] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None -) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -25186,64 +26104,96 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None -) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[None | ScatterMethod] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( - Workflow_classLoader, False, True, None, None +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] +ScatterFeatureRequirement_classLoader: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None -) -StepInputExpressionRequirement_classLoader = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] +StepInputExpressionRequirement_classLoader: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -LoadListingEnumLoader = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -25251,42 +26201,50 @@ def save( ), "LoadListingEnum", ) -union_of_LoadListingEnumLoader = _UnionLoader((LoadListingEnumLoader,)) -uri_array_of_strtype_False_False_0_None = _URILoader( +union_of_LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _UnionLoader( + (LoadListingEnumLoader,) +) +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_strtype = _UnionLoader( +union_of_inttype_or_strtype: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, strtype, ) ) -union_of_booltype_or_strtype = _UnionLoader( +union_of_booltype_or_strtype: Final[_Loader[bool | str]] = _UnionLoader( ( booltype, strtype, ) ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype = _UnionLoader( - ( - strtype, - array_of_strtype, +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) ) ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( + _UnionLoader( + ( + None_type, + inttype, + ExpressionLoader, + ) ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25294,10 +26252,20 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | ProcessGenerator + | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25311,6 +26279,7 @@ def save( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -25319,12 +26288,48 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" +) + +Documented: TypeAlias = RecordField +Parameter: TypeAlias = InputParameter | OutputParameter +InputBinding: TypeAlias = CommandLineBinding +OutputBinding: TypeAlias = CommandOutputBinding +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse +) +Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +Sink: TypeAlias = WorkflowStepInput +SchemaBase: TypeAlias = InputSchema | OutputSchema | Parameter def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -25341,9 +26346,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -25361,7 +26366,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -25382,7 +26387,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index af1df11b..ec33287e 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -2,10 +2,10 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence, Mapping from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, TypeAlias, TypeVar from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ import cwl_utils.parser.cwl_v1_0 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,38 +25,79 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) - -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | cwl.CWLType +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | cwl.CWLType +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - return False - return True + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) def _compare_type(type1: Any, type2: Any) -> bool: @@ -144,45 +186,15 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - type_dict: dict[str, Any], + src_dict: Mapping[str, cwl.InputParameter | cwl.WorkflowStepOutput], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + type_dict: Mapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -195,9 +207,9 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if is_sequence(sourceField): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -205,7 +217,7 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -213,45 +225,17 @@ def check_all_types( srcs_of_sink = [src_dict[parm_id]] linkMerge = None for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], type_dict[sink.id], linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append(SrcSink(src, sink, linkMerge, None)) return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - if linkMerge is None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - if linkMerge == "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), sinktype, None, None - ) - if linkMerge == "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -355,57 +339,62 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.inputs: - for step_input in step_run.inputs: - if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ - if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.0" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for step_output in step_run.outputs: - if ( - step_output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = step_output.type_ - if step.scatter is not None: - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" - ) - else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.0" + ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.0" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -415,33 +404,52 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -450,35 +458,61 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - return cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - return merge_flatten_type(new_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - return cwl.ArraySchema(items=new_type, type_="array") - return new_type + return cwl.OutputArraySchema( + items=final_type, + type_="array", + ) + return final_type def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.InputParameter - | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter + | MutableSequence[ + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter + ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] - params: MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] = [] + params: MutableSequence[ + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter + ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): for param in process.inputs: @@ -518,26 +552,25 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if isinstance(step.scatter, str): - scatter_context.append( - ( - 1, - step.scatterMethod - or "dotproduct", + match step.scatter: + case str(): + scatter_context.append( + ( + 1, + step.scatterMethod + or "dotproduct", + ) ) - ) - elif isinstance( - step.scatter, MutableSequence - ): - scatter_context.append( - ( - len(step.scatter), - step.scatterMethod - or "dotproduct", + case Sequence(): + scatter_context.append( + ( + len(step.scatter), + step.scatterMethod + or "dotproduct", + ) ) - ) - else: - scatter_context.append(None) + case _: + scatter_context.append(None) if len(params) == 1: return params[0] elif len(params) > 1: diff --git a/cwl_utils/parser/cwl_v1_1.py b/cwl_utils/parser/cwl_v1_1.py index 744cba7f..91bd39bc 100644 --- a/cwl_utils/parser/cwl_v1_1.py +++ b/cwl_utils/parser/cwl_v1_1.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import i32, i64, mypyc_attr +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,31 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) +S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +65,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +94,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +136,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +216,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@mypyc_attr(native_class=True) +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +227,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,12 +239,12 @@ def save( def load_field( - val: Union[str, dict[str, str]], - fieldtype: "_Loader", + val: Any | None, + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, -) -> Any: + lc: Any | None = None, +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -251,7 +267,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -328,7 +346,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -367,7 +385,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -428,34 +446,37 @@ def expand_url( return url -class _Loader: +@mypyc_attr(native_class=True) +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: - pass + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: ... -class _AnyLoader(_Loader): +@mypyc_attr(native_class=True) +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: +@mypyc_attr(native_class=True) +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -463,9 +484,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -474,8 +495,9 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +@mypyc_attr(native_class=True) +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -483,9 +505,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -531,13 +553,14 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +@mypyc_attr(native_class=True) +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + values: _Loader[T], + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +572,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -574,7 +597,8 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +@mypyc_attr(native_class=True) +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -584,19 +608,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> E: if doc in self.symbols: - return doc + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +@mypyc_attr(native_class=True) +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -604,75 +629,77 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +@mypyc_attr(native_class=True) +class _RecordLoader(_Loader[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +710,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -701,7 +728,8 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +@mypyc_attr(native_class=True) +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -710,23 +738,25 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: +@mypyc_attr(native_class=True) +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -734,9 +764,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: errors: Final = [] if lc is None: @@ -811,14 +841,15 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +@mypyc_attr(native_class=True) +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +862,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -879,8 +911,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: +@mypyc_attr(native_class=True) +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +923,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +932,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +944,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,9 +958,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -949,8 +982,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: +@mypyc_attr(native_class=True) +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,9 +994,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -989,12 +1023,12 @@ def load( def _document_load( - loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + loader: _Loader[T], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1059,11 +1093,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1151,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,37 +1202,14 @@ def parser_info() -> str: return "org.w3id.cwl.v1_1" -class Documented(Saveable): - pass - - -class RecordField(Documented): +@mypyc_attr(native_class=True) +class RecordField(Saveable): """ A field of a record. """ name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1228,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1273,14 +1284,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1376,7 +1387,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,13 +1412,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1422,7 +1433,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1441,16 +1452,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1468,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1491,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1594,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1654,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1669,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +@mypyc_attr(native_class=True) +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1702,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1745,14 +1758,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1849,7 +1861,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1880,7 +1892,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1895,7 +1907,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -1913,16 +1925,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1941,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +@mypyc_attr(native_class=True) +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1964,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2068,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2127,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2142,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2164,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2268,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2327,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2342,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + + +@mypyc_attr(native_class=True) +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2364,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2468,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2527,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2542,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +@mypyc_attr(native_class=True) +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2564,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2668,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2727,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2742,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2770,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2809,14 +2826,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2912,7 +2929,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,13 +2954,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2958,7 +2975,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -2977,16 +2994,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +3010,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3033,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3136,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,9 +3196,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Record_name, + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -3250,43 +3289,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3331,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3689,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3872,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3985,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4001,6 +4040,7 @@ def save( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4035,7 +4075,7 @@ class Directory(Saveable): the same Directory. When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigend. + first and have local values of `path` assigned. Directory objects in CommandLineTool output must provide either a `location` URI or a `path` property in the context of the tool execution @@ -4049,29 +4089,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4111,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4323,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,52 +4399,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) - - -class Labeled(Saveable): - pass - - -class Identified(Saveable): - pass - - -class IdentifierRequired(Identified): - pass - - -class LoadContents(Saveable): - pass - - -class FieldBase(Labeled): - pass - - -class InputFormat(Saveable): - pass - - -class OutputFormat(Saveable): - pass - - -class Parameter(FieldBase, Documented, IdentifierRequired): - """ - Define an input or output parameter to a process. - - """ - - pass - - -class InputBinding(Saveable): def __init__( self, - loadContents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4437,8 +4416,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) + +@mypyc_attr(native_class=True) +class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): return bool(self.loadContents == other.loadContents) @@ -4453,8 +4443,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4508,7 +4498,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4566,37 +4556,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) - - -class IOSchema(Labeled, Documented): - pass - - -class InputSchema(IOSchema): - pass - - -class OutputSchema(IOSchema): - pass - - -class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4606,15 +4570,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents - self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + + +@mypyc_attr(native_class=True) +class InputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): @@ -4652,8 +4615,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4708,14 +4671,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -5093,7 +5056,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5118,8 +5081,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5130,7 +5093,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5145,7 +5108,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -5199,7 +5162,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -5214,33 +5209,10 @@ def save( ) -class InputRecordSchema(CWLRecordSchema, InputSchema): +@mypyc_attr(native_class=True) +class InputRecordSchema(CWLRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): return bool( @@ -5261,8 +5233,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5317,14 +5289,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5514,7 +5485,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5539,15 +5510,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5562,7 +5533,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5589,21 +5560,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5613,11 +5578,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class InputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5613,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5695,14 +5669,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5893,7 +5866,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5926,7 +5899,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5941,7 +5914,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -5967,21 +5940,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5991,11 +5958,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class InputArraySchema(CWLArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +5993,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6073,14 +6049,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -6271,7 +6246,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6296,15 +6271,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6319,7 +6294,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -6345,23 +6320,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6371,13 +6338,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6385,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6467,14 +6441,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6758,7 +6732,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6783,8 +6757,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6793,7 +6767,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6808,7 +6782,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6848,23 +6822,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6874,11 +6842,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordSchema(CWLRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6879,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6956,14 +6935,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -7153,7 +7131,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7178,15 +7156,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7201,7 +7179,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -7228,21 +7206,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7252,11 +7224,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class OutputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7259,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7334,14 +7315,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -7532,7 +7512,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7565,7 +7545,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7580,7 +7560,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -7606,21 +7586,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7630,11 +7604,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class OutputArraySchema(CWLArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7639,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7712,14 +7695,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -7910,7 +7892,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7935,15 +7917,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7958,7 +7940,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -7984,56 +7966,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class InputParameter(Parameter, InputFormat, LoadContents): - pass - - -class OutputParameter(Parameter, OutputFormat): - pass - - -class ProcessRequirement(Saveable): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -class Process(Identified, Labeled, Documented): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - pass - - -class InlineJavascriptRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support inline Javascript expressions. - If this requirement is not present, the workflow platform must not perform expression - interpolatation. - - """ - def __init__( self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8043,8 +7984,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class InlineJavascriptRequirement(Saveable): + """ + Indicates that the workflow platform must support inline Javascript expressions. + If this requirement is not present, the workflow platform must not perform expression + interpolatation. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): @@ -8063,8 +8021,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8134,7 +8092,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8200,14 +8158,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) - + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib -class CommandInputSchema(Saveable): - pass + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -class SchemaDefRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8219,23 +8191,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8250,8 +8205,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8322,7 +8277,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8385,16 +8340,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) - - -class SecondaryFileSchema(Saveable): def __init__( self, - pattern: Any, - required: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8404,9 +8354,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + +@mypyc_attr(native_class=True) +class SecondaryFileSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): return bool( @@ -8423,8 +8378,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SecondaryFileSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8526,7 +8481,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8586,21 +8541,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["pattern", "required"]) - - -class LoadListingRequirement(ProcessRequirement): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - def __init__( self, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + pattern: str, + required: None | bool | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8610,8 +8556,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.pattern = pattern + self.required = required + + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) + + +@mypyc_attr(native_class=True) +class LoadListingRequirement(Saveable): + """ + Specify the desired behavior for loading the `listing` field of + a Directory object for use by expressions. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): @@ -8629,8 +8586,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8700,7 +8657,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8766,23 +8723,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: LoadListingEnum | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8792,8 +8737,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + + +@mypyc_attr(native_class=True) +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8811,8 +8768,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8915,7 +8872,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8975,9 +8932,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) +@mypyc_attr(native_class=True) class CommandLineBinding(InputBinding): """ @@ -9018,34 +8994,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -9078,8 +9026,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9415,7 +9363,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9512,7 +9460,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | i32 | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9525,7 +9501,8 @@ def save( ) -class CommandOutputBinding(LoadContents): +@mypyc_attr(native_class=True) +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9540,28 +9517,6 @@ class CommandOutputBinding(LoadContents): """ - def __init__( - self, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - glob: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9581,8 +9536,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9777,7 +9732,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9856,30 +9811,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents", "loadListing", "glob", "outputEval"]) - - -class CommandLineBindable(Saveable): - pass - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9889,16 +9828,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents self.loadListing = loadListing - self.inputBinding = inputBinding + self.glob = glob + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9938,8 +9880,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9994,14 +9936,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -10426,7 +10368,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10451,8 +10393,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10464,7 +10406,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10479,7 +10421,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10540,7 +10482,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -10556,37 +10532,10 @@ def save( ) -class CommandInputRecordSchema( - InputRecordSchema, CommandInputSchema, CommandLineBindable -): +@mypyc_attr(native_class=True) +class CommandInputRecordSchema(InputRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): return bool( @@ -10617,8 +10566,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10673,14 +10622,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10917,7 +10865,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10942,16 +10890,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10966,7 +10914,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11000,22 +10948,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11025,13 +10967,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputEnumSchema(InputEnumSchema): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11062,8 +11013,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11118,14 +11069,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -11363,7 +11313,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11397,7 +11347,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11412,7 +11362,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -11445,24 +11395,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc", "inputBinding"]) - - -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11472,13 +11414,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputArraySchema(InputArraySchema): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11502,8 +11453,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11558,14 +11509,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -11803,7 +11753,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11828,16 +11778,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11852,7 +11802,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -11885,24 +11835,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11912,14 +11854,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11955,8 +11904,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12011,14 +11960,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -12349,7 +12298,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12374,8 +12323,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12385,7 +12334,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12400,7 +12349,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -12447,32 +12396,18 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "outputBinding", - ] - ) - - -class CommandOutputRecordSchema(OutputRecordSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12482,11 +12417,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "outputBinding", + ] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputRecordSchema(OutputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): @@ -12508,8 +12464,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12564,14 +12520,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -12761,7 +12716,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12786,15 +12741,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12809,7 +12764,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -12836,21 +12791,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12860,11 +12809,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12886,8 +12844,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12942,14 +12900,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -13140,7 +13097,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13173,7 +13130,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13188,7 +13145,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -13214,21 +13171,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class CommandOutputArraySchema(OutputArraySchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13238,11 +13189,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13264,8 +13224,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13320,14 +13280,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -13518,7 +13477,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13543,15 +13502,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13566,7 +13525,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -13592,31 +13551,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13626,17 +13569,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputParameter(Saveable): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13678,8 +13628,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13734,14 +13684,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14213,7 +14163,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14238,11 +14188,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14252,7 +14202,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14267,7 +14217,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14332,7 +14282,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14349,43 +14335,14 @@ def save( ) -class CommandOutputParameter(OutputParameter): +@mypyc_attr(native_class=True) +class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. """ id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -14420,8 +14377,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14476,14 +14433,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14814,7 +14771,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14839,18 +14796,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14865,7 +14822,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14912,7 +14869,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14926,7 +14913,8 @@ def save( ) -class CommandLineTool(Process): +@mypyc_attr(native_class=True) +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -14934,53 +14922,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -15033,8 +14974,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15089,14 +15030,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -15820,7 +15760,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15864,7 +15804,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15879,7 +15819,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -15972,7 +15912,54 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -15995,7 +15982,8 @@ def save( ) -class DockerRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](http://docker.com) or Docker-compatible (such as @@ -16051,33 +16039,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -16110,8 +16071,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16416,7 +16377,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16522,7 +16483,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -16535,30 +16523,14 @@ def save( ) -class SoftwareRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -16573,8 +16545,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16645,7 +16617,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16708,17 +16680,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16728,10 +16694,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + + +@mypyc_attr(native_class=True) +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16750,8 +16720,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16900,7 +16870,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16964,25 +16934,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) - - -class Dirent(Saveable): - """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. - - """ - def __init__( self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16992,9 +16950,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +@mypyc_attr(native_class=True) +class Dirent(Saveable): + """ + Define a file or subdirectory that must be placed in the designated output + directory prior to executing the command line tool. May be the result of + executing an expression, such as building a configuration file from a + template. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): @@ -17014,8 +16985,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17164,7 +17135,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17232,19 +17203,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17254,8 +17219,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +@mypyc_attr(native_class=True) +class InitialWorkDirRequirement(Saveable): + """ + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17271,8 +17246,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17343,7 +17318,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17406,21 +17381,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17430,8 +17395,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +@mypyc_attr(native_class=True) +class EnvVarRequirement(Saveable): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17447,8 +17423,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17519,7 +17495,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17582,25 +17558,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) - - -class ShellCommandRequirement(ProcessRequirement): - """ - Modify the behavior of CommandLineTool to generate a single string - containing a shell command line. Each item in the argument list must be - joined into a string separated by single spaces and quoted to prevent - intepretation by the shell, unless `CommandLineBinding` for that argument - contains `shellQuote: false`. If `shellQuote: false` is specified, the - argument is joined into the command string without quoting, which allows - the use of shell metacharacters such as `|` for pipes. - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17610,7 +17572,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) + + +@mypyc_attr(native_class=True) +class ShellCommandRequirement(Saveable): + """ + Modify the behavior of CommandLineTool to generate a single string + containing a shell command line. Each item in the argument list must be + joined into a string separated by single spaces and quoted to prevent + interpretation by the shell, unless `CommandLineBinding` for that argument + contains `shellQuote: false`. If `shellQuote: false` is specified, the + argument is joined into the command string without quoting, which allows + the use of shell metacharacters such as `|` for pipes. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ShellCommandRequirement): @@ -17626,8 +17605,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17650,7 +17629,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17706,10 +17685,26 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -17734,37 +17729,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -17801,8 +17765,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17830,7 +17794,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -17877,7 +17841,7 @@ def fromDoc( try: coresMax = load_field( _doc.get("coresMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMax") @@ -17924,7 +17888,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -17971,7 +17935,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -18018,7 +17982,7 @@ def fromDoc( try: tmpdirMin = load_field( _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMin") @@ -18065,7 +18029,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -18112,7 +18076,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -18159,7 +18123,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -18201,7 +18165,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18311,7 +18275,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | i32 | str = None, + coresMax: None | i32 | str = None, + ramMin: None | i32 | str = None, + ramMax: None | i32 | str = None, + tmpdirMin: None | i32 | str = None, + tmpdirMax: None | i32 | str = None, + outdirMin: None | i32 | str = None, + outdirMax: None | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -18326,12 +18321,13 @@ def save( ) -class WorkReuse(ProcessRequirement): +@mypyc_attr(native_class=True) +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same results), control whether to enable or disable the reuse behavior - for a particular tool or step (to accomodate situations where that + for a particular tool or step (to accommodate situations where that assumption is incorrect). A reused step is not executed but instead returns the same output as the original execution. @@ -18340,23 +18336,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -18373,8 +18352,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18445,7 +18424,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18511,10 +18490,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) + def __init__( + self, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) -class NetworkAccess(ProcessRequirement): +@mypyc_attr(native_class=True) +class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site @@ -18529,28 +18526,11 @@ class NetworkAccess(ProcessRequirement): may apply their own security policies to restrict what is accessible by the tool. - Enabling network access does not imply a publically routable IP + Enabling network access does not imply a publicly routable IP address or the ability to accept inbound connections. """ - def __init__( - self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess - def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): return bool( @@ -18568,8 +18548,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18640,7 +18620,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18706,10 +18686,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) + def __init__( + self, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) -class InplaceUpdateRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class InplaceUpdateRequirement(Saveable): """ If `inplaceUpdate` is true, then an implementation supporting this @@ -18727,7 +18725,7 @@ class InplaceUpdateRequirement(ProcessRequirement): read-only in every step. Workflow steps which modify a file must produce the modified file - as output. Downstream steps which futher process the file must + as output. Downstream steps which further process the file must use the output of previous steps, and not refer to a common input (this is necessary for both ordering and correctness). @@ -18744,23 +18742,6 @@ class InplaceUpdateRequirement(ProcessRequirement): """ - def __init__( - self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -18778,8 +18759,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18850,7 +18831,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18916,10 +18897,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) + def __init__( + self, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) -class ToolTimeLimit(ProcessRequirement): +@mypyc_attr(native_class=True) +class ToolTimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool. A CommandLineTool whose execution duration exceeds the time @@ -18931,23 +18930,6 @@ class ToolTimeLimit(ProcessRequirement): """ - def __init__( - self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ToolTimeLimit" - self.timelimit = timelimit - def __eq__(self, other: Any) -> bool: if isinstance(other, ToolTimeLimit): return bool( @@ -18964,8 +18946,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ToolTimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18994,7 +18976,7 @@ def fromDoc( timelimit = load_field( _doc.get("timelimit"), - union_of_inttype_or_ExpressionLoader, + union_of_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("timelimit") @@ -19036,7 +19018,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19102,23 +19084,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) - - -class ExpressionToolOutputParameter(OutputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + timelimit: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19128,13 +19098,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ + self.class_: Final[str] = "ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +@mypyc_attr(native_class=True) +class ExpressionToolOutputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19168,8 +19140,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19224,14 +19196,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -19515,7 +19487,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19540,17 +19512,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19565,7 +19537,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -19605,29 +19577,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -class WorkflowInputParameter(InputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19641,13 +19601,18 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.id = id self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default self.type_ = type_ - self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + ) + + +@mypyc_attr(native_class=True) +class WorkflowInputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19689,8 +19654,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19745,14 +19710,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -20224,7 +20189,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20249,11 +20214,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20263,7 +20228,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20278,7 +20243,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -20343,7 +20308,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -20360,7 +20361,8 @@ def save( ) -class ExpressionTool(Process): +@mypyc_attr(native_class=True) +class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has @@ -20374,39 +20376,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -20445,8 +20414,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20501,14 +20470,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -20904,7 +20872,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20941,7 +20909,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20956,7 +20924,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -21012,7 +20980,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21028,7 +21029,8 @@ def save( ) -class WorkflowOutputParameter(OutputParameter): +@mypyc_attr(native_class=True) +class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that @@ -21039,38 +21041,6 @@ class WorkflowOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): return bool( @@ -21107,8 +21077,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21163,14 +21133,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -21548,7 +21518,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21573,11 +21543,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21585,7 +21555,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21600,7 +21570,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -21647,7 +21617,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -21662,17 +21664,14 @@ def save( ) -class Sink(Saveable): - pass - - -class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): +@mypyc_attr(native_class=True) +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input parameters of the process specified by the `run` field. Only input parameters declared by the target process will be passed through at runtime to the process - though additonal parameters may be specified (for use within `valueFrom` + though additional parameters may be specified (for use within `valueFrom` expressions for instance) - unconnected or unused parameters do not represent an error condition. @@ -21716,36 +21715,6 @@ class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - label: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.source = source - self.linkMerge = linkMerge - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -21780,8 +21749,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21836,14 +21805,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -22173,7 +22142,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22209,7 +22178,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22224,7 +22193,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -22268,7 +22237,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.source = source + self.linkMerge = linkMerge + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "source", @@ -22282,7 +22281,8 @@ def save( ) -class WorkflowStepOutput(IdentifierRequired): +@mypyc_attr(native_class=True) +class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the `id` field) be may be used @@ -22297,22 +22297,6 @@ class WorkflowStepOutput(IdentifierRequired): id: str - def __init__( - self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepOutput): return bool(self.id == other.id) @@ -22327,8 +22311,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22383,15 +22367,15 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + else: + baseuri = id + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22418,7 +22402,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22433,7 +22417,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -22444,10 +22428,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) -class WorkflowStep(IdentifierRequired, Labeled, Documented): +@mypyc_attr(native_class=True) +class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as `CommandLineTool` or another @@ -22509,40 +22510,6 @@ class WorkflowStep(IdentifierRequired, Labeled, Documented): id: str - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -22581,8 +22548,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22637,14 +22604,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -23073,7 +23040,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23111,7 +23078,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23126,7 +23093,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -23174,27 +23141,62 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "id", - "label", - "doc", - "in", - "out", - "requirements", - "hints", - "run", - "scatter", - "scatterMethod", - ] - ) - - -class Workflow(Process): - """ - A workflow describes a set of **steps** and the **dependencies** between - those steps. When a step produces output that will be consumed by a - second step, the first step is a dependency of the second step. + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "label", + "doc", + "in", + "out", + "requirements", + "hints", + "run", + "scatter", + "scatterMethod", + ] + ) + + +@mypyc_attr(native_class=True) +class Workflow(Saveable): + """ + A workflow describes a set of **steps** and the **dependencies** between + those steps. When a step produces output that will be consumed by a + second step, the first step is a dependency of the second step. When there is a dependency, the workflow engine must execute the preceding step and wait for it to successfully produce output before executing the @@ -23210,7 +23212,7 @@ class Workflow(Process): The `source` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fufilled, the step is ready to + data links inbound to a given step are fulfilled, the step is ready to execute. ## Workflow success and failure @@ -23242,39 +23244,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -23313,8 +23282,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23369,14 +23338,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -23772,7 +23740,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23809,7 +23777,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23824,7 +23792,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -23877,7 +23845,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23893,28 +23894,14 @@ def save( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -23929,8 +23916,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23953,7 +23940,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24009,20 +23996,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24032,7 +24009,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class ScatterFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -24048,8 +24036,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24072,7 +24060,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24128,20 +24116,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24151,7 +24129,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24167,8 +24156,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24191,7 +24180,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24247,20 +24236,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24270,7 +24249,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -24286,8 +24276,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24310,7 +24300,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24366,15 +24356,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class Secrets(ProcessRequirement): def __init__( self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24384,9 +24369,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +@mypyc_attr(native_class=True) +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -24401,8 +24390,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24473,7 +24462,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24535,25 +24524,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24563,16 +24538,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +@mypyc_attr(native_class=True) +class ProcessGenerator(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -24612,8 +24586,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24668,14 +24642,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -24792,7 +24765,7 @@ def fromDoc( inputs = load_field( _doc.get("inputs"), - idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader, + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, lc=_doc.get("inputs") @@ -24840,7 +24813,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -25073,7 +25046,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25110,7 +25083,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25125,7 +25098,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -25177,7 +25150,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -25193,29 +25199,13 @@ def save( ) -class MPIRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -25232,8 +25222,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25304,7 +25294,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25370,23 +25360,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25396,11 +25374,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +@mypyc_attr(native_class=True) +class CUDARequirement(Saveable): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -25430,8 +25415,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25644,7 +25629,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25734,23 +25719,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25760,9 +25736,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + + +@mypyc_attr(native_class=True) +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -25777,8 +25769,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25849,7 +25841,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25912,10 +25904,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShmSize" + self.shmSize = shmSize + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { + +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -26018,16 +26027,6 @@ def save( "deep_listing": "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", "float": "http://www.w3.org/2001/XMLSchema#float", @@ -26046,12 +26045,9 @@ def save( "stdout": "https://w3id.org/cwl/cwl#stdout", "string": "http://www.w3.org/2001/XMLSchema#string", "union": "https://w3id.org/cwl/salad#union", - "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", "v1.1": "https://w3id.org/cwl/cwl#v1.1", - "v1.1.0-dev1": "https://w3id.org/cwl/cwl#v1.1.0-dev1", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -26154,16 +26150,6 @@ def save( "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", "http://www.w3.org/2001/XMLSchema#float": "float", @@ -26182,19 +26168,20 @@ def save( "https://w3id.org/cwl/cwl#stdout": "stdout", "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/salad#union": "union", - "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", "https://w3id.org/cwl/cwl#v1.1": "v1.1", - "https://w3id.org/cwl/cwl#v1.1.0-dev1": "v1.1.0-dev1", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -26220,17 +26207,23 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -26249,54 +26242,114 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None +) +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None +) +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None +) +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "None", None, None) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) +) +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None +) +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None +) +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "None", None, None +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( - InlineJavascriptRequirement, None, None +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -ToolTimeLimitLoader = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( - SubworkflowFeatureRequirement, None, None +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( - MultipleInputFeatureRequirement, None, None +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( + ShellCommandRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( - StepInputExpressionRequirement, None, None +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None ) -SecretsLoader = _RecordLoader(Secrets, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None +) +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) +) +ToolTimeLimitLoader: Final[_Loader[ToolTimeLimit]] = _RecordLoader( + ToolTimeLimit, None, None +) +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) +) +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) +) +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) +) +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26321,46 +26374,146 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - "v1.1.0-dev1", - "v1.1", - ), - "CWLVersion", -) +CWLInputFileLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +CWLVersion: TypeAlias = Literal["v1.1"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.1",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26376,31 +26529,79 @@ def save( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) -InputBindingLoader = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader = _EnumLoader(("stdin",), "stdin") +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) +InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( + InputBinding, None, None +) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +SecondaryFileSchemaLoader: Final[_Loader[SecondaryFileSchema]] = _RecordLoader( + SecondaryFileSchema, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None +) +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) +) +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None +) +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) +) +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) +) +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None +) +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None +) +stdin: TypeAlias = Literal["stdin"] +stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -26422,7 +26623,8 @@ def save( stdin: ${inputs.an_input_name.path} ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26466,7 +26668,8 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26510,15 +26713,24 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( - ExpressionToolOutputParameter, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None +) +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +WorkflowInputParameterLoader: Final[_Loader[WorkflowInputParameter]] = _RecordLoader( + WorkflowInputParameter, None, None +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None +) +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -26528,10 +26740,19 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -26542,19 +26763,37 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None +) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26565,10 +26804,41 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26580,51 +26850,110 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26633,10 +26962,23 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26646,57 +26988,85 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( None_type, array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -26704,34 +27074,45 @@ def save( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( - Directory_classLoader, False, True, None, None +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( + ("Directory",), "Directory_class" ) -union_of_None_type_or_booltype = _UnionLoader( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( + _URILoader(Directory_classLoader, False, True, None, None) +) +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( - ( - None_type, - LoadListingEnumLoader, +union_of_None_type_or_LoadListingEnumLoader: Final[_Loader[LoadListingEnum | None]] = ( + _UnionLoader( + ( + None_type, + LoadListingEnumLoader, + ) ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( + _ArrayLoader(SecondaryFileSchemaLoader) +) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final[_Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]]] +) = _UnionLoader( ( None_type, SecondaryFileSchemaLoader, array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: Final[ + _Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -26739,7 +27120,9 @@ def save( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -26747,24 +27130,32 @@ def save( ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26773,10 +27164,25 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26786,29 +27192,57 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26817,10 +27251,27 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26830,69 +27281,198 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = _UnionLoader( +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[CommandInputParameter | WorkflowInputParameter] +] = _UnionLoader( ( CommandInputParameterLoader, WorkflowInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = ( - _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) -) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = _IdMapLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter | WorkflowInputParameter]] +] = _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter | WorkflowInputParameter]] +] = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter + ] +] = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, WorkflowOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | WorkflowOutputParameter + ] + ] +] = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | WorkflowOutputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26918,84 +27498,188 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -InlineJavascriptRequirement_classLoader = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" -) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_array_of_strtype = _UnionLoader( - ( - None_type, - array_of_strtype, +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[CWLVersion | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] +InlineJavascriptRequirement_classLoader: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) ) ) -SchemaDefRequirement_classLoader = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None -) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[SchemaDefRequirement_class] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] +] = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema + ] + ] +] = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final[ + _Loader[None | bool | str] +] = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( - ("LoadListingRequirement",), "LoadListingRequirement_class" +LoadListingRequirement_class: TypeAlias = Literal["LoadListingRequirement"] +LoadListingRequirement_classLoader: Final[_Loader[LoadListingRequirement_class]] = ( + _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( - LoadListingRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, +uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ + _Loader[LoadListingRequirement_class] +] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( + _UnionLoader( + ( + None_type, + inttype, + ExpressionLoader, + ) ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -27003,19 +27687,29 @@ def save( array_of_strtype, ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final[_Loader[None | str]] = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27024,10 +27718,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27037,31 +27756,73 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27070,10 +27831,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27083,37 +27869,89 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | stdin + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -27124,12 +27962,45 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | stdin + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -27141,72 +28012,109 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( - CommandLineTool_classLoader, False, True, None, None -) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[CommandLineTool_class] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( - DockerRequirement_classLoader, False, True, None, None +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[DockerRequirement_class] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -SoftwareRequirement_classLoader = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[SoftwareRequirement_class] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None -) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True -) -InitialWorkDirRequirement_classLoader = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" -) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader = _UnionLoader( +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] +InitialWorkDirRequirement_classLoader: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) +union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: Final[ + _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] +] = _UnionLoader( ( None_type, FileLoader, @@ -27216,133 +28124,189 @@ def save( ExpressionLoader, ) ) -array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + ] +] = _ArrayLoader( union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader ) -union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader = _UnionLoader( +union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + | str + ] +] = _UnionLoader( ( array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader, ExpressionLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None -) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" -) -ShellCommandRequirement_classLoader = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[EnvVarRequirement_class] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ResourceRequirement_classLoader = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( - ResourceRequirement_classLoader, False, True, None, None +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[ShellCommandRequirement_class] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( - WorkReuse_classLoader, False, True, None, None -) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[ResourceRequirement_class] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( ( - booltype, + None_type, + inttype, + inttype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( - NetworkAccess_classLoader, False, True, None, None -) -InplaceUpdateRequirement_classLoader = _EnumLoader( - ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" -) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( - InplaceUpdateRequirement_classLoader, False, True, None, None +WorkReuse_class: TypeAlias = Literal["WorkReuse"] +WorkReuse_classLoader: Final[_Loader[WorkReuse_class]] = _EnumLoader( + ("WorkReuse",), "WorkReuse_class" ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( - ToolTimeLimit_classLoader, False, True, None, None +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[WorkReuse_class]] = ( + _URILoader(WorkReuse_classLoader, False, True, None, None) ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( ( - inttype, + booltype, ExpressionLoader, ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( - ( - None_type, - InputBindingLoader, - ) +NetworkAccess_class: TypeAlias = Literal["NetworkAccess"] +NetworkAccess_classLoader: Final[_Loader[NetworkAccess_class]] = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( - ExpressionTool_classLoader, False, True, None, None +uri_NetworkAccess_classLoader_False_True_None_None: Final[ + _Loader[NetworkAccess_class] +] = _URILoader(NetworkAccess_classLoader, False, True, None, None) +InplaceUpdateRequirement_class: TypeAlias = Literal["InplaceUpdateRequirement"] +InplaceUpdateRequirement_classLoader: Final[_Loader[InplaceUpdateRequirement_class]] = ( + _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") ) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( - array_of_WorkflowInputParameterLoader, "id", "type" +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ + _Loader[InplaceUpdateRequirement_class] +] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) +ToolTimeLimit_class: TypeAlias = Literal["ToolTimeLimit"] +ToolTimeLimit_classLoader: Final[_Loader[ToolTimeLimit_class]] = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( - ExpressionToolOutputParameterLoader +uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ + _Loader[ToolTimeLimit_class] +] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) +union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( + _UnionLoader( + ( + inttype, + inttype, + ExpressionLoader, + ) + ) ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" +union_of_None_type_or_InputBindingLoader: Final[_Loader[InputBinding | None]] = ( + _UnionLoader( + ( + None_type, + InputBindingLoader, + ) + ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[ExpressionTool_class] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _ArrayLoader(WorkflowInputParameterLoader) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _IdMapLoader(array_of_WorkflowInputParameterLoader, "id", "type") +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None -) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -27351,73 +28315,114 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None -) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[None | ScatterMethod] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( - Workflow_classLoader, False, True, None, None +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] +ScatterFeatureRequirement_classLoader: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None -) -StepInputExpressionRequirement_classLoader = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] +StepInputExpressionRequirement_classLoader: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None = _URILoader( +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( - strtype, - array_of_strtype, + inttype, + ExpressionLoader, ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) + ) +) +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27425,10 +28430,20 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | ProcessGenerator + | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27442,6 +28457,7 @@ def save( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -27450,12 +28466,70 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" +) + +Sink: TypeAlias = WorkflowStepInput +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +InputParameter: TypeAlias = CommandInputParameter | WorkflowInputParameter +OutputParameter: TypeAlias = ( + CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter +) +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse +) +Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +CommandInputSchema: TypeAlias = ( + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema +) +CommandLineBindable: TypeAlias = ( + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordField + | CommandInputRecordSchema +) +IOSchema: TypeAlias = InputSchema | OutputSchema +LoadContents: TypeAlias = ( + CommandOutputBinding | InputParameter | InputRecordField | WorkflowStepInput +) +InputFormat: TypeAlias = InputParameter | InputRecordField +OutputFormat: TypeAlias = OutputParameter | OutputRecordField +Parameter: TypeAlias = InputParameter | OutputParameter +Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep +IdentifierRequired: TypeAlias = ( + Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput +) +FieldBase: TypeAlias = InputRecordField | OutputRecordField | Parameter +Identified: TypeAlias = IdentifierRequired | Process +Labeled: TypeAlias = FieldBase | IOSchema | Process | WorkflowStep | WorkflowStepInput def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -27472,9 +28546,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -27492,7 +28566,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -27513,7 +28587,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 62265819..c64bb9ec 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -2,10 +2,10 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence, Mapping from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, TypeAlias, TypeVar from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ import cwl_utils.parser.cwl_v1_1 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,38 +25,86 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) - -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | cwl.stdin | Sequence[BasicInputTypeSchemas] +) +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | cwl.CWLType +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | cwl.stdin | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas | cwl.stderr | cwl.stdout | Sequence[BasicOutputTypeSchemas] +) +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | cwl.CWLType +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas + | cwl.stdout + | cwl.stderr + | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - return False - return True + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) def _compare_type(type1: Any, type2: Any) -> bool: @@ -144,45 +193,15 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - type_dict: dict[str, Any], + src_dict: Mapping[str, cwl.WorkflowInputParameter | cwl.WorkflowStepOutput], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + type_dict: Mapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -195,9 +214,9 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if is_sequence(sourceField): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -205,7 +224,7 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -213,45 +232,17 @@ def check_all_types( srcs_of_sink = [src_dict[parm_id]] linkMerge = None for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], type_dict[sink.id], linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append(SrcSink(src, sink, linkMerge, None)) return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - if linkMerge is None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - if linkMerge == "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), sinktype, None, None - ) - if linkMerge == "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -307,8 +298,7 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: ) else: clt.stdin = ( - "$(inputs.%s.path)" - % cast(str, inp.id).rpartition("#")[2].split("/")[-1] + "$(inputs.%s.path)" % inp.id.rpartition("#")[2].split("/")[-1] ) inp.type_ = "File" @@ -371,57 +361,62 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.inputs: - for step_input in step_run.inputs: - if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ - if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.1" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = output.type_ - if step.scatter is not None: - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" - ) - else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.1" + ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.1" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -431,33 +426,52 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -466,44 +480,60 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - return cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - return merge_flatten_type(new_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - return cwl.ArraySchema(items=new_type, type_="array") - else: - return new_type + return cwl.OutputArraySchema( + items=final_type, + type_="array", + ) + return final_type def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): @@ -544,8 +574,8 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if scatter_context is not None: - if isinstance(step.scatter, str): + match step.scatter: + case str(): scatter_context.append( ( 1, @@ -553,9 +583,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -563,7 +591,7 @@ def param_for_source_id( or "dotproduct", ) ) - else: + case _: scatter_context.append(None) if len(params) == 1: return params[0] diff --git a/cwl_utils/parser/cwl_v1_2.py b/cwl_utils/parser/cwl_v1_2.py index 85f744fc..61b6b602 100644 --- a/cwl_utils/parser/cwl_v1_2.py +++ b/cwl_utils/parser/cwl_v1_2.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import i32, i64, mypyc_attr +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,31 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) +S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +65,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +94,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +136,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +216,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@mypyc_attr(native_class=True) +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +227,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,12 +239,12 @@ def save( def load_field( - val: Union[str, dict[str, str]], - fieldtype: "_Loader", + val: Any | None, + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, -) -> Any: + lc: Any | None = None, +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -251,7 +267,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -328,7 +346,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -367,7 +385,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -428,34 +446,37 @@ def expand_url( return url -class _Loader: +@mypyc_attr(native_class=True) +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: - pass + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: ... -class _AnyLoader(_Loader): +@mypyc_attr(native_class=True) +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: +@mypyc_attr(native_class=True) +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -463,9 +484,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -474,8 +495,9 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +@mypyc_attr(native_class=True) +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -483,9 +505,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -531,13 +553,14 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +@mypyc_attr(native_class=True) +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + values: _Loader[T], + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +572,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -574,7 +597,8 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +@mypyc_attr(native_class=True) +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -584,19 +608,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> E: if doc in self.symbols: - return doc + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +@mypyc_attr(native_class=True) +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -604,75 +629,77 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +@mypyc_attr(native_class=True) +class _RecordLoader(_Loader[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +710,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -701,7 +728,8 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +@mypyc_attr(native_class=True) +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -710,23 +738,25 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: +@mypyc_attr(native_class=True) +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -734,9 +764,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: errors: Final = [] if lc is None: @@ -811,14 +841,15 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +@mypyc_attr(native_class=True) +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +862,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -879,8 +911,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: +@mypyc_attr(native_class=True) +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +923,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +932,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +944,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,9 +958,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -949,8 +982,9 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: +@mypyc_attr(native_class=True) +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,9 +994,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -989,12 +1023,12 @@ def load( def _document_load( - loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + loader: _Loader[T], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1059,11 +1093,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, -) -> tuple[Any, LoadingOptions]: + addl_metadata_fields: MutableSequence[str] | None = None, +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1151,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,37 +1202,14 @@ def parser_info() -> str: return "org.w3id.cwl.v1_2" -class Documented(Saveable): - pass - - -class RecordField(Documented): +@mypyc_attr(native_class=True) +class RecordField(Saveable): """ A field of a record. """ name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1228,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1273,14 +1284,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1376,7 +1387,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,13 +1412,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1422,7 +1433,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1441,16 +1452,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1468,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1491,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1594,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1654,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1669,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +@mypyc_attr(native_class=True) +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1702,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1745,14 +1758,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1849,7 +1861,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1880,7 +1892,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1895,7 +1907,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -1913,16 +1925,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1941,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +@mypyc_attr(native_class=True) +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1964,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2068,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2127,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2142,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2164,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2268,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2327,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2342,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + +@mypyc_attr(native_class=True) +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2364,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2468,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2527,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2542,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +@mypyc_attr(native_class=True) +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2564,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2668,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2727,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2742,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2770,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2809,14 +2826,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2912,7 +2929,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,13 +2954,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2958,7 +2975,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -2977,16 +2994,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +3010,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3033,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3136,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,9 +3196,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Record_name, + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -3250,43 +3289,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3331,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3689,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3872,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3985,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4001,6 +4040,7 @@ def save( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4049,29 +4089,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4111,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4323,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,63 +4399,36 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing - -class Labeled(Saveable): - pass - - -class Identified(Saveable): - pass - - -class IdentifierRequired(Identified): - pass - - -class LoadContents(Saveable): - pass - - -class FieldBase(Labeled): - pass - - -class InputFormat(Saveable): - pass - - -class OutputFormat(Saveable): - pass - - -class Parameter(FieldBase, Documented, IdentifierRequired): - """ - Define an input or output parameter to a process. - - """ - - pass + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@mypyc_attr(native_class=True) class InputBinding(Saveable): - def __init__( - self, - loadContents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): return bool(self.loadContents == other.loadContents) @@ -4453,8 +4443,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4508,7 +4498,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4566,37 +4556,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) - - -class IOSchema(Labeled, Documented): - pass - - -class InputSchema(IOSchema): - pass - - -class OutputSchema(IOSchema): - pass - - -class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4606,15 +4570,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents - self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + + +@mypyc_attr(native_class=True) +class InputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): @@ -4652,8 +4615,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4708,14 +4671,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -5093,7 +5056,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5118,8 +5081,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5130,7 +5093,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5145,7 +5108,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -5199,7 +5162,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -5214,33 +5209,10 @@ def save( ) -class InputRecordSchema(CWLRecordSchema, InputSchema): +@mypyc_attr(native_class=True) +class InputRecordSchema(CWLRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): return bool( @@ -5261,8 +5233,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5317,14 +5289,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5514,7 +5485,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5539,15 +5510,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5562,7 +5533,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5589,21 +5560,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5613,11 +5578,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class InputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5613,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5695,14 +5669,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5893,7 +5866,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5926,7 +5899,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5941,7 +5914,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -5967,21 +5940,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5991,11 +5958,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class InputArraySchema(CWLArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +5993,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6073,14 +6049,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -6271,7 +6246,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6296,15 +6271,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6319,7 +6294,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -6345,23 +6320,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6371,13 +6338,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6385,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6467,14 +6441,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6758,7 +6732,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6783,8 +6757,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6793,7 +6767,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6808,7 +6782,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6848,23 +6822,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6874,11 +6842,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordSchema(CWLRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6879,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6956,14 +6935,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -7153,7 +7131,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7178,15 +7156,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7201,7 +7179,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -7228,21 +7206,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7252,11 +7224,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class OutputEnumSchema(EnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7259,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7334,14 +7315,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -7532,7 +7512,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7565,7 +7545,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7580,7 +7560,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -7606,21 +7586,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7630,11 +7604,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class OutputArraySchema(CWLArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7639,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7712,14 +7695,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -7910,7 +7892,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7935,15 +7917,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7958,7 +7940,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -7984,56 +7966,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class InputParameter(Parameter, InputFormat, LoadContents): - pass - - -class OutputParameter(Parameter, OutputFormat): - pass - - -class ProcessRequirement(Saveable): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -class Process(Identified, Labeled, Documented): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - pass - - -class InlineJavascriptRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support inline Javascript expressions. - If this requirement is not present, the workflow platform must not perform expression - interpolation. - - """ - def __init__( self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8043,8 +7984,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class InlineJavascriptRequirement(Saveable): + """ + Indicates that the workflow platform must support inline Javascript expressions. + If this requirement is not present, the workflow platform must not perform expression + interpolation. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): @@ -8063,8 +8021,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8134,7 +8092,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8200,14 +8158,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) - + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib -class CommandInputSchema(Saveable): - pass + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -class SchemaDefRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8224,23 +8196,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8255,8 +8210,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8327,7 +8282,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8390,9 +8345,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) + def __init__( + self, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) +@mypyc_attr(native_class=True) class SecondaryFileSchema(Saveable): """ Secondary files are specified using the following micro-DSL for secondary files: @@ -8411,24 +8384,6 @@ class SecondaryFileSchema(Saveable): """ - def __init__( - self, - pattern: Any, - required: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required - def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): return bool( @@ -8445,8 +8400,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SecondaryFileSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8548,7 +8503,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8608,21 +8563,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["pattern", "required"]) - - -class LoadListingRequirement(ProcessRequirement): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - def __init__( self, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + pattern: str, + required: None | bool | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8632,8 +8578,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.pattern = pattern + self.required = required + + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) + + +@mypyc_attr(native_class=True) +class LoadListingRequirement(Saveable): + """ + Specify the desired behavior for loading the `listing` field of + a Directory object for use by expressions. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): @@ -8651,8 +8608,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8722,7 +8679,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8788,23 +8745,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: LoadListingEnum | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8814,8 +8759,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + + +@mypyc_attr(native_class=True) +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8833,8 +8790,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8937,7 +8894,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8997,9 +8954,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) +@mypyc_attr(native_class=True) class CommandLineBinding(InputBinding): """ @@ -9040,34 +9016,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -9100,8 +9048,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9437,7 +9385,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9534,7 +9482,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | i32 | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9547,7 +9523,8 @@ def save( ) -class CommandOutputBinding(LoadContents): +@mypyc_attr(native_class=True) +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9562,28 +9539,6 @@ class CommandOutputBinding(LoadContents): """ - def __init__( - self, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - glob: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9603,8 +9558,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9799,7 +9754,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9878,30 +9833,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents", "loadListing", "glob", "outputEval"]) - - -class CommandLineBindable(Saveable): - pass - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9911,16 +9850,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents self.loadListing = loadListing - self.inputBinding = inputBinding + self.glob = glob + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9960,8 +9902,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10016,14 +9958,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -10448,7 +10390,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10473,8 +10415,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10486,7 +10428,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10501,7 +10443,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10562,7 +10504,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -10578,37 +10554,10 @@ def save( ) -class CommandInputRecordSchema( - InputRecordSchema, CommandInputSchema, CommandLineBindable -): +@mypyc_attr(native_class=True) +class CommandInputRecordSchema(InputRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): return bool( @@ -10639,8 +10588,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10695,14 +10644,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10939,7 +10887,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10964,16 +10912,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10988,7 +10936,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11022,22 +10970,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11047,13 +10989,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputEnumSchema(InputEnumSchema): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11084,8 +11035,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11140,14 +11091,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -11385,7 +11335,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11419,7 +11369,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11434,7 +11384,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -11467,24 +11417,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc", "inputBinding"]) - - -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11494,13 +11436,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputArraySchema(InputArraySchema): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11524,8 +11475,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11580,14 +11531,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -11825,7 +11775,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11850,16 +11800,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11874,7 +11824,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -11907,24 +11857,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11934,14 +11876,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11977,8 +11926,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12033,14 +11982,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -12371,7 +12320,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12396,8 +12345,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - doc=doc, name=name, + doc=doc, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12407,7 +12356,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12422,7 +12371,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -12469,7 +12418,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -12483,33 +12462,10 @@ def save( ) +@mypyc_attr(native_class=True) class CommandOutputRecordSchema(OutputRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): return bool( @@ -12530,8 +12486,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12586,14 +12542,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -12783,7 +12738,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12808,15 +12763,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12831,7 +12786,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -12858,21 +12813,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Record_name, + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12882,11 +12831,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12908,8 +12866,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12964,14 +12922,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -13162,7 +13119,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13195,7 +13152,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13210,7 +13167,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -13236,21 +13193,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class CommandOutputArraySchema(OutputArraySchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13260,11 +13211,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13286,8 +13246,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13342,14 +13302,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -13540,7 +13499,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13565,15 +13524,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13588,7 +13547,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -13614,31 +13573,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13648,17 +13591,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputParameter(Saveable): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13700,8 +13650,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13756,14 +13706,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14235,7 +14185,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14260,11 +14210,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14274,7 +14224,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14289,7 +14239,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14354,7 +14304,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14371,43 +14357,14 @@ def save( ) -class CommandOutputParameter(OutputParameter): +@mypyc_attr(native_class=True) +class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. """ id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -14442,8 +14399,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14498,14 +14455,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14836,7 +14793,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14861,18 +14818,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14887,7 +14844,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14934,7 +14891,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14948,7 +14935,8 @@ def save( ) -class CommandLineTool(Process): +@mypyc_attr(native_class=True) +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -14956,55 +14944,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -15059,8 +14998,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15115,14 +15054,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -15893,7 +15831,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15938,7 +15876,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15953,7 +15891,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -16049,7 +15987,56 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -16073,7 +16060,8 @@ def save( ) -class DockerRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](https://docker.com) or Docker-compatible (such as @@ -16129,33 +16117,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -16188,8 +16149,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16494,7 +16455,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16600,7 +16561,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -16613,30 +16601,14 @@ def save( ) -class SoftwareRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -16651,8 +16623,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16723,7 +16695,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16786,17 +16758,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16806,10 +16772,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +@mypyc_attr(native_class=True) +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16828,8 +16798,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16978,7 +16948,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17042,9 +17012,30 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) + def __init__( + self, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) +@mypyc_attr(native_class=True) class Dirent(Saveable): """ Define a file or subdirectory that must be staged to a particular @@ -17058,26 +17049,6 @@ class Dirent(Saveable): """ - def __init__( - self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable - def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): return bool( @@ -17096,8 +17067,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17246,7 +17217,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17314,20 +17285,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. - Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17337,8 +17301,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +@mypyc_attr(native_class=True) +class InitialWorkDirRequirement(Saveable): + """ + Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. + Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17354,8 +17329,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17426,7 +17401,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17489,21 +17464,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17513,8 +17478,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +@mypyc_attr(native_class=True) +class EnvVarRequirement(Saveable): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17530,8 +17506,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17602,7 +17578,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17665,10 +17641,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) + def __init__( + self, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) -class ShellCommandRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the `arguments` list must @@ -17680,21 +17674,6 @@ class ShellCommandRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, ShellCommandRequirement): return bool(self.class_ == other.class_) @@ -17709,8 +17688,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17733,7 +17712,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17789,10 +17768,26 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -17822,37 +17817,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -17889,8 +17853,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17918,7 +17882,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -17965,7 +17929,7 @@ def fromDoc( try: coresMax = load_field( _doc.get("coresMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMax") @@ -18012,7 +17976,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -18059,7 +18023,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -18106,7 +18070,7 @@ def fromDoc( try: tmpdirMin = load_field( _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMin") @@ -18153,7 +18117,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -18200,7 +18164,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -18247,7 +18211,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -18289,7 +18253,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18399,7 +18363,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | float | i32 | str = None, + coresMax: None | float | i32 | str = None, + ramMin: None | float | i32 | str = None, + ramMax: None | float | i32 | str = None, + tmpdirMin: None | float | i32 | str = None, + tmpdirMax: None | float | i32 | str = None, + outdirMin: None | float | i32 | str = None, + outdirMax: None | float | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -18414,7 +18409,8 @@ def save( ) -class WorkReuse(ProcessRequirement): +@mypyc_attr(native_class=True) +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same @@ -18428,23 +18424,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -18461,8 +18440,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18533,7 +18512,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18599,10 +18578,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) + def __init__( + self, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) -class NetworkAccess(ProcessRequirement): +@mypyc_attr(native_class=True) +class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site @@ -18622,23 +18619,6 @@ class NetworkAccess(ProcessRequirement): """ - def __init__( - self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess - def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): return bool( @@ -18656,8 +18636,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18728,7 +18708,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18794,10 +18774,28 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) + def __init__( + self, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) -class InplaceUpdateRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class InplaceUpdateRequirement(Saveable): """ If `inplaceUpdate` is true, then an implementation supporting this @@ -18832,23 +18830,6 @@ class InplaceUpdateRequirement(ProcessRequirement): """ - def __init__( - self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -18866,8 +18847,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18938,7 +18919,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19004,26 +18985,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) - - -class ToolTimeLimit(ProcessRequirement): - """ - Set an upper limit on the execution time of a CommandLineTool. - A CommandLineTool whose execution duration exceeds the time - limit may be preemptively terminated and considered failed. - May also be used by batch systems to make scheduling decisions. - The execution duration excludes external operations, such as - staging of files, pulling a docker image etc, and only counts - wall-time for the execution of the command line itself. - - """ - def __init__( self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19033,8 +18999,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ToolTimeLimit" - self.timelimit = timelimit + self.class_: Final[str] = "InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) + + +@mypyc_attr(native_class=True) +class ToolTimeLimit(Saveable): + """ + Set an upper limit on the execution time of a CommandLineTool. + A CommandLineTool whose execution duration exceeds the time + limit may be preemptively terminated and considered failed. + May also be used by batch systems to make scheduling decisions. + The execution duration excludes external operations, such as + staging of files, pulling a docker image etc, and only counts + wall-time for the execution of the command line itself. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ToolTimeLimit): @@ -19052,8 +19034,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ToolTimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19082,7 +19064,7 @@ def fromDoc( timelimit = load_field( _doc.get("timelimit"), - union_of_inttype_or_ExpressionLoader, + union_of_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("timelimit") @@ -19124,7 +19106,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19190,23 +19172,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) - - -class ExpressionToolOutputParameter(OutputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + timelimit: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19216,13 +19186,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ + self.class_: Final[str] = "ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +@mypyc_attr(native_class=True) +class ExpressionToolOutputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19256,8 +19228,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19312,14 +19284,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -19603,7 +19575,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19628,17 +19600,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19653,7 +19625,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -19693,29 +19665,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -class WorkflowInputParameter(InputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19729,13 +19689,18 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.id = id self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default self.type_ = type_ - self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + ) + + +@mypyc_attr(native_class=True) +class WorkflowInputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19777,8 +19742,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19833,14 +19798,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -20312,7 +20277,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20337,11 +20302,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20351,7 +20316,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20366,7 +20331,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -20431,7 +20396,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -20448,7 +20449,8 @@ def save( ) -class ExpressionTool(Process): +@mypyc_attr(native_class=True) +class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has @@ -20462,41 +20464,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -20537,8 +20504,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20593,14 +20560,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -21043,7 +21009,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21081,7 +21047,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21096,7 +21062,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -21155,7 +21121,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21172,7 +21173,8 @@ def save( ) -class WorkflowOutputParameter(OutputParameter): +@mypyc_attr(native_class=True) +class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that @@ -21186,40 +21188,6 @@ class WorkflowOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - pickValue: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.pickValue = pickValue - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): return bool( @@ -21258,8 +21226,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21314,14 +21282,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -21746,7 +21714,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21771,11 +21739,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21784,7 +21752,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21799,7 +21767,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -21850,7 +21818,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.pickValue = pickValue + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -21866,11 +21868,8 @@ def save( ) -class Sink(Saveable): - pass - - -class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): +@mypyc_attr(native_class=True) +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input @@ -21985,38 +21984,6 @@ class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - pickValue: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - label: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.source = source - self.linkMerge = linkMerge - self.pickValue = pickValue - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -22053,8 +22020,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22109,14 +22076,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -22493,7 +22460,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22530,7 +22497,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22545,7 +22512,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -22593,7 +22560,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.source = source + self.linkMerge = linkMerge + self.pickValue = pickValue + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "source", @@ -22608,7 +22607,8 @@ def save( ) -class WorkflowStepOutput(IdentifierRequired): +@mypyc_attr(native_class=True) +class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the `id` field) be may be used @@ -22623,22 +22623,6 @@ class WorkflowStepOutput(IdentifierRequired): id: str - def __init__( - self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepOutput): return bool(self.id == other.id) @@ -22653,8 +22637,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22709,15 +22693,15 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + else: + baseuri = id + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22744,7 +22728,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22759,7 +22743,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -22770,10 +22754,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) -class WorkflowStep(IdentifierRequired, Labeled, Documented): +@mypyc_attr(native_class=True) +class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as `CommandLineTool` or another @@ -22859,42 +22860,6 @@ class WorkflowStep(IdentifierRequired, Labeled, Documented): id: str - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - when: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.when = when - self.scatter = scatter - self.scatterMethod = scatterMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -22935,8 +22900,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22991,14 +22956,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -23474,7 +23439,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23513,7 +23478,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23528,7 +23493,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -23580,7 +23545,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + when: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.when = when + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23597,7 +23598,8 @@ def save( ) -class Workflow(Process): +@mypyc_attr(native_class=True) +class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a @@ -23655,41 +23657,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -23730,8 +23697,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23786,14 +23753,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -24236,7 +24202,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24274,7 +24240,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24289,7 +24255,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -24345,7 +24311,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -24362,28 +24363,14 @@ def save( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -24398,8 +24385,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24422,7 +24409,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24478,20 +24465,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24501,7 +24478,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class ScatterFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -24517,8 +24505,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24541,7 +24529,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24597,20 +24585,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24620,7 +24598,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24636,8 +24625,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24660,7 +24649,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24716,20 +24705,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24739,7 +24718,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -24755,8 +24745,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24779,7 +24769,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24835,31 +24825,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class OperationInputParameter(InputParameter): - """ - Describe an input parameter of an operation. - - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24869,16 +24838,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ + self.class_: Final[str] = "StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class OperationInputParameter(Saveable): + """ + Describe an input parameter of an operation. + + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OperationInputParameter): @@ -24918,8 +24890,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OperationInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24974,14 +24946,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -25406,7 +25378,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25431,11 +25403,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -25444,7 +25416,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25459,7 +25431,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -25517,7 +25489,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -25533,7 +25539,8 @@ def save( ) -class OperationOutputParameter(OutputParameter): +@mypyc_attr(native_class=True) +class OperationOutputParameter(Saveable): """ Describe an output parameter of an operation. @@ -25541,34 +25548,6 @@ class OperationOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, OperationOutputParameter): return bool( @@ -25601,8 +25580,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OperationOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25657,14 +25636,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -25948,7 +25927,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25973,17 +25952,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25998,7 +25977,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -26038,12 +26017,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) -class Operation(Process): +@mypyc_attr(native_class=True) +class Operation(Saveable): """ This record describes an abstract operation. It is a potential step of a workflow that has not yet been bound to a concrete @@ -26057,39 +26065,6 @@ class Operation(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "Operation" - def __eq__(self, other: Any) -> bool: if isinstance(other, Operation): return bool( @@ -26128,8 +26103,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Operation": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -26184,14 +26159,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -26586,7 +26560,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -26623,7 +26597,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -26638,7 +26612,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -26690,7 +26664,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[OperationInputParameter], + outputs: Sequence[OperationOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "Operation" + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -26706,24 +26713,8 @@ def save( ) -class Secrets(ProcessRequirement): - def __init__( - self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets - +@mypyc_attr(native_class=True) +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -26738,8 +26729,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -26810,7 +26801,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -26872,26 +26863,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -26901,17 +26877,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +@mypyc_attr(native_class=True) +class ProcessGenerator(Saveable): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -26953,8 +26927,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -27009,14 +26983,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -27133,7 +27106,7 @@ def fromDoc( inputs = load_field( _doc.get("inputs"), - idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader, + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, lc=_doc.get("inputs") @@ -27181,7 +27154,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -27461,7 +27434,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -27499,7 +27472,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -27514,7 +27487,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -27569,7 +27542,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -27586,29 +27594,13 @@ def save( ) -class MPIRequirement(ProcessRequirement): +@mypyc_attr(native_class=True) +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -27625,8 +27617,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -27697,7 +27689,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -27763,23 +27755,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: i32 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -27789,11 +27769,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +@mypyc_attr(native_class=True) +class CUDARequirement(Saveable): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -27823,8 +27810,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28037,7 +28024,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28127,7 +28114,30 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "cudaComputeCapability", @@ -28138,35 +28148,10 @@ def save( ) +@mypyc_attr(native_class=True) class LoopInput(Saveable): id: str - def __init__( - self, - default: Optional[Any] = None, - id: Optional[Any] = None, - linkMerge: Optional[Any] = None, - loopSource: Optional[Any] = None, - pickValue: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.default = default - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.linkMerge = linkMerge - self.loopSource = loopSource - self.pickValue = pickValue - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, LoopInput): return bool( @@ -28197,8 +28182,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoopInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28253,14 +28238,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id default = None if "default" in _doc: try: @@ -28496,7 +28480,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28521,8 +28505,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - default=default, id=id, + default=default, linkMerge=linkMerge, loopSource=loopSource, pickValue=pickValue, @@ -28530,7 +28514,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -28545,7 +28529,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.default is not None: r["default"] = save( @@ -28575,12 +28559,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + default: Any | None = None, + id: None | str = None, + linkMerge: LinkMergeMethod | None = None, + loopSource: None | Sequence[str] | str = None, + pickValue: None | PickValueMethod = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.default = default + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.linkMerge = linkMerge + self.loopSource = loopSource + self.pickValue = pickValue + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] ) -class Loop(ProcessRequirement): +@mypyc_attr(native_class=True) +class Loop(Saveable): """ Prototype to enable workflow-level looping of a step. @@ -28597,27 +28608,6 @@ class Loop(ProcessRequirement): """ - def __init__( - self, - loop: Any, - loopWhen: Any, - outputMethod: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Loop" - self.loop = loop - self.loopWhen = loopWhen - self.outputMethod = outputMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, Loop): return bool( @@ -28637,8 +28627,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Loop": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28805,7 +28795,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28881,15 +28871,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loop", "loopWhen", "outputMethod"]) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loop: Sequence[LoopInput], + loopWhen: str, + outputMethod: LoopOutputModes, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -28899,9 +28887,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "Loop" + self.loop = loop + self.loopWhen = loopWhen + self.outputMethod = outputMethod + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "loop", "loopWhen", "outputMethod"] + ) + + +@mypyc_attr(native_class=True) +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -28916,8 +28913,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28988,7 +28985,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -29051,10 +29048,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShmSize" + self.shmSize = shmSize + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { + +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -29165,16 +29179,6 @@ def save( "deep_listing": "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "first_non_null": "https://w3id.org/cwl/cwl#PickValueMethod/first_non_null", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", @@ -29196,18 +29200,9 @@ def save( "string": "http://www.w3.org/2001/XMLSchema#string", "the_only_non_null": "https://w3id.org/cwl/cwl#PickValueMethod/the_only_non_null", "union": "https://w3id.org/cwl/salad#union", - "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", - "v1.1": "https://w3id.org/cwl/cwl#v1.1", - "v1.1.0-dev1": "https://w3id.org/cwl/cwl#v1.1.0-dev1", "v1.2": "https://w3id.org/cwl/cwl#v1.2", - "v1.2.0-dev1": "https://w3id.org/cwl/cwl#v1.2.0-dev1", - "v1.2.0-dev2": "https://w3id.org/cwl/cwl#v1.2.0-dev2", - "v1.2.0-dev3": "https://w3id.org/cwl/cwl#v1.2.0-dev3", - "v1.2.0-dev4": "https://w3id.org/cwl/cwl#v1.2.0-dev4", - "v1.2.0-dev5": "https://w3id.org/cwl/cwl#v1.2.0-dev5", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -29318,16 +29313,6 @@ def save( "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#PickValueMethod/first_non_null": "first_non_null", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", @@ -29349,25 +29334,20 @@ def save( "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/cwl#PickValueMethod/the_only_non_null": "the_only_non_null", "https://w3id.org/cwl/salad#union": "union", - "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", - "https://w3id.org/cwl/cwl#v1.1": "v1.1", - "https://w3id.org/cwl/cwl#v1.1.0-dev1": "v1.1.0-dev1", "https://w3id.org/cwl/cwl#v1.2": "v1.2", - "https://w3id.org/cwl/cwl#v1.2.0-dev1": "v1.2.0-dev1", - "https://w3id.org/cwl/cwl#v1.2.0-dev2": "v1.2.0-dev2", - "https://w3id.org/cwl/cwl#v1.2.0-dev3": "v1.2.0-dev3", - "https://w3id.org/cwl/cwl#v1.2.0-dev4": "v1.2.0-dev4", - "https://w3id.org/cwl/cwl#v1.2.0-dev5": "v1.2.0-dev5", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -29393,17 +29373,23 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -29422,55 +29408,116 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None +) +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None +) +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None +) +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "None", None, None) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) +) +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None +) +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None +) +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None +) +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None +) +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) +) +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None +) +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( + ShellCommandRequirement, None, None ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "None", None, None +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( - InlineJavascriptRequirement, None, None +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -ToolTimeLimitLoader = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( - SubworkflowFeatureRequirement, None, None +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( - MultipleInputFeatureRequirement, None, None +ToolTimeLimitLoader: Final[_Loader[ToolTimeLimit]] = _RecordLoader( + ToolTimeLimit, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( - StepInputExpressionRequirement, None, None +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) ) -SecretsLoader = _RecordLoader(Secrets, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -LoopLoader = _RecordLoader(Loop, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _UnionLoader( +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) +) +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) +) +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +LoopLoader: Final[_Loader[Loop]] = _RecordLoader(Loop, None, None) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -29496,52 +29543,150 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - "v1.1.0-dev1", - "v1.1", - "v1.2.0-dev1", - "v1.2.0-dev2", - "v1.2.0-dev3", - "v1.2.0-dev4", - "v1.2.0-dev5", - "v1.2", - ), - "CWLVersion", -) +CWLInputFileLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +CWLVersion: TypeAlias = Literal["v1.2"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.2",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -29557,31 +29702,79 @@ def save( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) -InputBindingLoader = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader = _EnumLoader(("stdin",), "stdin") +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) +InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( + InputBinding, None, None +) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +SecondaryFileSchemaLoader: Final[_Loader[SecondaryFileSchema]] = _RecordLoader( + SecondaryFileSchema, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None +) +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) +) +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None +) +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) +) +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) +) +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None +) +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None +) +stdin: TypeAlias = Literal["stdin"] +stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -29603,7 +29796,8 @@ def save( stdin: $(inputs.an_input_name.path) ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29651,7 +29845,8 @@ def save( (e.g. `echo a && echo b`) `stdout` must include the output of every command. """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29695,15 +29890,24 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( - ExpressionToolOutputParameter, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None +) +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) +) +WorkflowInputParameterLoader: Final[_Loader[WorkflowInputParameter]] = _RecordLoader( + WorkflowInputParameter, None, None +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -29713,7 +29917,10 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -PickValueMethodLoader = _EnumLoader( +PickValueMethod: TypeAlias = Literal[ + "first_non_null", "the_only_non_null", "all_non_null" +] +PickValueMethodLoader: Final[_Loader[PickValueMethod]] = _EnumLoader( ( "first_non_null", "the_only_non_null", @@ -29724,10 +29931,19 @@ def save( """ Picking non-null values among inbound data links, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -29738,23 +29954,45 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -OperationInputParameterLoader = _RecordLoader(OperationInputParameter, None, None) -OperationOutputParameterLoader = _RecordLoader(OperationOutputParameter, None, None) -OperationLoader = _RecordLoader(Operation, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -LoopInputLoader = _RecordLoader(LoopInput, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +OperationInputParameterLoader: Final[_Loader[OperationInputParameter]] = _RecordLoader( + OperationInputParameter, None, None +) +OperationOutputParameterLoader: Final[_Loader[OperationOutputParameter]] = ( + _RecordLoader(OperationOutputParameter, None, None) +) +OperationLoader: Final[_Loader[Operation]] = _RecordLoader(Operation, None, None) +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None +) +LoopInputLoader: Final[_Loader[LoopInput]] = _RecordLoader(LoopInput, None, None) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29765,10 +30003,41 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29780,51 +30049,110 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | MapSchema + | PrimitiveType + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29833,10 +30161,23 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29846,57 +30187,85 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( None_type, array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -29904,34 +30273,45 @@ def save( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) +) +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( + ("Directory",), "Directory_class" ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( - Directory_classLoader, False, True, None, None +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( + _URILoader(Directory_classLoader, False, True, None, None) ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( - ( - None_type, - LoadListingEnumLoader, +union_of_None_type_or_LoadListingEnumLoader: Final[_Loader[LoadListingEnum | None]] = ( + _UnionLoader( + ( + None_type, + LoadListingEnumLoader, + ) ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( + _ArrayLoader(SecondaryFileSchemaLoader) +) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final[_Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]]] +) = _UnionLoader( ( None_type, SecondaryFileSchemaLoader, array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: Final[ + _Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -29939,7 +30319,9 @@ def save( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -29947,24 +30329,32 @@ def save( ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29973,10 +30363,25 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29986,29 +30391,57 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Sequence[ + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30017,10 +30450,27 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30030,44 +30480,91 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _UnionLoader( +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[CommandInputParameter | OperationInputParameter | WorkflowInputParameter] +] = _UnionLoader( ( CommandInputParameterLoader, WorkflowInputParameterLoader, OperationInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _ArrayLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandInputParameter | OperationInputParameter | WorkflowInputParameter + ] + ] +] = _ArrayLoader( union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader ) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _IdMapLoader( +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandInputParameter | OperationInputParameter | WorkflowInputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] +] = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, @@ -30075,26 +30572,126 @@ def save( OperationOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] + ] +] = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -30121,87 +30718,194 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -union_of_None_type_or_array_of_strtype = _UnionLoader( - ( - None_type, - array_of_strtype, +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[CWLVersion | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) ) ) -uri_union_of_None_type_or_array_of_strtype_True_False_None_None = _URILoader( - union_of_None_type_or_array_of_strtype, True, False, None, None -) -InlineJavascriptRequirement_classLoader = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" -) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None +uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, True, False, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] +InlineJavascriptRequirement_classLoader: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[InlineJavascriptRequirement_class] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) -SchemaDefRequirement_classLoader = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" -) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None -) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[SchemaDefRequirement_class] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] +] = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema + ] + ] +] = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final[ + _Loader[None | bool | str] +] = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( - ("LoadListingRequirement",), "LoadListingRequirement_class" +LoadListingRequirement_class: TypeAlias = Literal["LoadListingRequirement"] +LoadListingRequirement_classLoader: Final[_Loader[LoadListingRequirement_class]] = ( + _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( - LoadListingRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, +uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ + _Loader[LoadListingRequirement_class] +] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( + _UnionLoader( + ( + None_type, + inttype, + ExpressionLoader, + ) ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -30209,19 +30913,29 @@ def save( array_of_strtype, ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final[_Loader[None | str]] = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30230,10 +30944,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30243,31 +30982,73 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30276,10 +31057,35 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30289,37 +31095,89 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | stdin + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -30330,12 +31188,45 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Sequence[ + CWLType + | CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | str + ] + | stdin + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -30347,72 +31238,109 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Sequence[ + CWLType + | CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | str + ] + | stderr + | stdout + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( - CommandLineTool_classLoader, False, True, None, None +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" -) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[CommandLineTool_class] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( - DockerRequirement_classLoader, False, True, None, None +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[DockerRequirement_class] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -SoftwareRequirement_classLoader = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[SoftwareRequirement_class] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None -) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True -) -InitialWorkDirRequirement_classLoader = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" -) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] +InitialWorkDirRequirement_classLoader: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[InitialWorkDirRequirement_class] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) +union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] +] = _UnionLoader( ( None_type, DirentLoader, @@ -30422,147 +31350,200 @@ def save( array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + ] +] = _ArrayLoader( union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader ) -union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + | str + ] +] = _UnionLoader( ( ExpressionLoader, array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None -) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[EnvVarRequirement_class] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -ShellCommandRequirement_classLoader = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") ) -ResourceRequirement_classLoader = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[ShellCommandRequirement_class] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( - ResourceRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader = _UnionLoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[ResourceRequirement_class] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final[ + _Loader[None | float | i32 | str] +] = _UnionLoader( ( None_type, inttype, + inttype, floattype, ExpressionLoader, ) ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( - WorkReuse_classLoader, False, True, None, None +WorkReuse_class: TypeAlias = Literal["WorkReuse"] +WorkReuse_classLoader: Final[_Loader[WorkReuse_class]] = _EnumLoader( + ("WorkReuse",), "WorkReuse_class" +) +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[WorkReuse_class]] = ( + _URILoader(WorkReuse_classLoader, False, True, None, None) ) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( - NetworkAccess_classLoader, False, True, None, None +NetworkAccess_class: TypeAlias = Literal["NetworkAccess"] +NetworkAccess_classLoader: Final[_Loader[NetworkAccess_class]] = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" ) -InplaceUpdateRequirement_classLoader = _EnumLoader( - ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" +uri_NetworkAccess_classLoader_False_True_None_None: Final[ + _Loader[NetworkAccess_class] +] = _URILoader(NetworkAccess_classLoader, False, True, None, None) +InplaceUpdateRequirement_class: TypeAlias = Literal["InplaceUpdateRequirement"] +InplaceUpdateRequirement_classLoader: Final[_Loader[InplaceUpdateRequirement_class]] = ( + _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") ) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( - InplaceUpdateRequirement_classLoader, False, True, None, None +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ + _Loader[InplaceUpdateRequirement_class] +] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) +ToolTimeLimit_class: TypeAlias = Literal["ToolTimeLimit"] +ToolTimeLimit_classLoader: Final[_Loader[ToolTimeLimit_class]] = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( - ToolTimeLimit_classLoader, False, True, None, None -) -union_of_inttype_or_ExpressionLoader = _UnionLoader( - ( - inttype, - ExpressionLoader, +uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ + _Loader[ToolTimeLimit_class] +] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) +union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( + _UnionLoader( + ( + inttype, + inttype, + ExpressionLoader, + ) ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( - ( - None_type, - InputBindingLoader, +union_of_None_type_or_InputBindingLoader: Final[_Loader[InputBinding | None]] = ( + _UnionLoader( + ( + None_type, + InputBindingLoader, + ) ) ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( - ExpressionTool_classLoader, False, True, None, None -) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( - array_of_WorkflowInputParameterLoader, "id", "type" -) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( - ExpressionToolOutputParameterLoader +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" -) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None -) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[ExpressionTool_class] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _ArrayLoader(WorkflowInputParameterLoader) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _IdMapLoader(array_of_WorkflowInputParameterLoader, "id", "type") +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) -union_of_None_type_or_PickValueMethodLoader = _UnionLoader( - ( - None_type, - PickValueMethodLoader, +union_of_None_type_or_PickValueMethodLoader: Final[_Loader[None | PickValueMethod]] = ( + _UnionLoader( + ( + None_type, + PickValueMethodLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" -) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str + ] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -30572,102 +31553,155 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str + ] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None -) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[None | ScatterMethod] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( - Workflow_classLoader, False, True, None, None +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[SubworkflowFeatureRequirement_class] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] +ScatterFeatureRequirement_classLoader: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[ScatterFeatureRequirement_class] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None -) -StepInputExpressionRequirement_classLoader = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[MultipleInputFeatureRequirement_class] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] +StepInputExpressionRequirement_classLoader: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[StepInputExpressionRequirement_class] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +Operation_class: TypeAlias = Literal["Operation"] +Operation_classLoader: Final[_Loader[Operation_class]] = _EnumLoader( + ("Operation",), "Operation_class" ) -Operation_classLoader = _EnumLoader(("Operation",), "Operation_class") -uri_Operation_classLoader_False_True_None_None = _URILoader( - Operation_classLoader, False, True, None, None +uri_Operation_classLoader_False_True_None_None: Final[_Loader[Operation_class]] = ( + _URILoader(Operation_classLoader, False, True, None, None) ) -array_of_OperationInputParameterLoader = _ArrayLoader(OperationInputParameterLoader) -idmap_inputs_array_of_OperationInputParameterLoader = _IdMapLoader( - array_of_OperationInputParameterLoader, "id", "type" +array_of_OperationInputParameterLoader: Final[ + _Loader[Sequence[OperationInputParameter]] +] = _ArrayLoader(OperationInputParameterLoader) +idmap_inputs_array_of_OperationInputParameterLoader: Final[ + _Loader[Sequence[OperationInputParameter]] +] = _IdMapLoader(array_of_OperationInputParameterLoader, "id", "type") +array_of_OperationOutputParameterLoader: Final[ + _Loader[Sequence[OperationOutputParameter]] +] = _ArrayLoader(OperationOutputParameterLoader) +idmap_outputs_array_of_OperationOutputParameterLoader: Final[ + _Loader[Sequence[OperationOutputParameter]] +] = _IdMapLoader(array_of_OperationOutputParameterLoader, "id", "type") +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -array_of_OperationOutputParameterLoader = _ArrayLoader(OperationOutputParameterLoader) -idmap_outputs_array_of_OperationOutputParameterLoader = _IdMapLoader( - array_of_OperationOutputParameterLoader, "id", "type" -) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None = _URILoader( +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( - strtype, - array_of_strtype, + inttype, + ExpressionLoader, + ) +) +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) ) ) -union_of_None_type_or_Any_type = _UnionLoader( +union_of_None_type_or_Any_type: Final[_Loader[Any | None]] = _UnionLoader( ( None_type, Any_type, ) ) -array_of_LoopInputLoader = _ArrayLoader(LoopInputLoader) -idmap_loop_array_of_LoopInputLoader = _IdMapLoader( +array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _ArrayLoader( + LoopInputLoader +) +idmap_loop_array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _IdMapLoader( array_of_LoopInputLoader, "id", "loopSource" ) -LoopOutputModesLoader = _EnumLoader( +LoopOutputModes: TypeAlias = Literal["last", "all"] +LoopOutputModesLoader: Final[_Loader[LoopOutputModes]] = _EnumLoader( ( "last", "all", ), "LoopOutputModes", ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30676,10 +31710,27 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + Sequence[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow + ] + ] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | Operation + | ProcessGenerator + | Sequence[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow + ] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30694,6 +31745,7 @@ def save( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -30702,12 +31754,78 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" +) + +Sink: TypeAlias = WorkflowStepInput +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +InputParameter: TypeAlias = ( + CommandInputParameter | OperationInputParameter | WorkflowInputParameter +) +OutputParameter: TypeAlias = ( + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter +) +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse +) +Process: TypeAlias = ( + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow +) +CommandInputSchema: TypeAlias = ( + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema +) +CommandLineBindable: TypeAlias = ( + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordField + | CommandInputRecordSchema +) +IOSchema: TypeAlias = InputSchema | OutputSchema +LoadContents: TypeAlias = ( + CommandOutputBinding | InputParameter | InputRecordField | WorkflowStepInput +) +InputFormat: TypeAlias = InputParameter | InputRecordField +OutputFormat: TypeAlias = OutputParameter | OutputRecordField +Parameter: TypeAlias = InputParameter | OutputParameter +Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep +IdentifierRequired: TypeAlias = ( + Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput +) +FieldBase: TypeAlias = InputRecordField | OutputRecordField | Parameter +Identified: TypeAlias = IdentifierRequired | Process +Labeled: TypeAlias = FieldBase | IOSchema | Process | WorkflowStep | WorkflowStepInput def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -30724,9 +31842,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -30744,7 +31862,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -30765,7 +31883,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index f770da8f..7d973ef4 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -2,20 +2,21 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException -from schema_salad.sourceline import SourceLine, add_lc_filename +from schema_salad.sourceline import add_lc_filename, SourceLine from schema_salad.utils import aslist, json_dumps, yaml_no_ts import cwl_utils.parser import cwl_utils.parser.cwl_v1_2 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,38 +25,86 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) - -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | cwl.stdin | Sequence[BasicInputTypeSchemas] +) +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | cwl.CWLType +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | cwl.stdin | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas | cwl.stderr | cwl.stdout | Sequence[BasicOutputTypeSchemas] +) +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | cwl.CWLType +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas + | cwl.stderr + | cwl.stdout + | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, ) - return False - return True + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) def _compare_type(type1: Any, type2: Any) -> bool: @@ -83,7 +132,7 @@ def _compare_type(type1: Any, type2: Any) -> bool: def _is_all_output_method_loop_step( - param_to_step: dict[str, cwl.WorkflowStep], parm_id: str + param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str ) -> bool: if (source_step := param_to_step.get(parm_id)) is not None: for requirement in source_step.requirements or []: @@ -93,7 +142,7 @@ def _is_all_output_method_loop_step( def _is_conditional_step( - param_to_step: dict[str, cwl.WorkflowStep], parm_id: str + param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str ) -> bool: if (source_step := param_to_step.get(parm_id)) is not None: if source_step.when is not None: @@ -163,46 +212,16 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - param_to_step: dict[str, cwl.WorkflowStep], - type_dict: dict[str, Any], + src_dict: Mapping[str, cwl.WorkflowInputParameter | cwl.WorkflowStepOutput], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + param_to_step: Mapping[str, cwl.WorkflowStep], + type_dict: MutableMapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -219,9 +238,9 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, MutableSequence) and len(sourceField) > 1: + if is_sequence(sourceField) and len(sourceField) > 1: linkMerge: str | None = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -246,7 +265,7 @@ def check_all_types( src_dict[parm_id], sink, linkMerge, - message="Source is from conditional step, but pickValue is not used", + message="Source is from conditional step and may produce `null`", ) ) type_dict[src_dict[parm_id].id] = src_typ @@ -256,10 +275,10 @@ def check_all_types( items=src_typ, type_="array" ) else: - if isinstance(sourceField, MutableSequence): - parm_id = cast(str, sourceField[0]) + if is_sequence(sourceField): + parm_id = sourceField[0] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -276,34 +295,25 @@ def check_all_types( ) ) if _is_conditional_step(param_to_step, parm_id): - src_typ = aslist(type_dict[src_dict[parm_id].id]) - snk_typ = type_dict[sink.id] - if "null" not in src_typ: - src_typ = ["null"] + cast(list[Any], src_typ) - if ( - not isinstance(snk_typ, MutableSequence) - or "null" not in snk_typ - ): - validation["warning"].append( - SrcSink( - src_dict[parm_id], - sink, - linkMerge, - message="Source is from conditional step and may produce `null`", - ) + validation["warning"].append( + SrcSink( + src_dict[parm_id], + sink, + linkMerge, + message="Source is from conditional step, but pickValue is not used", ) - type_dict[src_dict[parm_id].id] = src_typ + ) if _is_all_output_method_loop_step(param_to_step, parm_id): src_typ = type_dict[src_dict[parm_id].id] type_dict[src_dict[parm_id].id] = cwl.ArraySchema( items=src_typ, type_="array" ) for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], sink_type, linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append( @@ -312,39 +322,6 @@ def check_all_types( return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - match linkMerge: - case None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - case "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), - sinktype, - None, - None, - ) - case "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - case _: - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -405,8 +382,7 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: ) else: clt.stdin = ( - "$(inputs.%s.path)" - % cast(str, inp.id).rpartition("#")[2].split("/")[-1] + "$(inputs.%s.path)" % inp.id.rpartition("#")[2].split("/")[-1] ) inp.type_ = "File" @@ -469,57 +445,62 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.inputs: - for step_input in step_run.inputs: - if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ - if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.2" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = output.type_ - if step.scatter is not None: - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" - ) - else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.2" + ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.2" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -529,38 +510,57 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, pickValue: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions + ), + type_="array", + ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) if pickValue is not None: if isinstance(new_type, cwl.ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): - new_type = new_type.items + return new_type.items return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -569,47 +569,64 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - new_type = cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) if pickValue is not None: - if isinstance(new_type, cwl.ArraySchema): + if isinstance(final_type, cwl.ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): - new_type = new_type.items - return new_type + return final_type.items + return final_type def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: cwl.Process, + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): @@ -650,8 +667,8 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if scatter_context is not None: - if isinstance(step.scatter, str): + match step.scatter: + case str(): scatter_context.append( ( 1, @@ -659,9 +676,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -669,7 +684,7 @@ def param_for_source_id( or "dotproduct", ) ) - else: + case _: scatter_context.append(None) if len(params) == 1: return params[0] diff --git a/cwl_utils/parser/utils.py b/cwl_utils/parser/utils.py index 967beb12..aa4eadf3 100644 --- a/cwl_utils/parser/utils.py +++ b/cwl_utils/parser/utils.py @@ -2,20 +2,27 @@ import copy import logging -from collections.abc import MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from pathlib import Path -from types import ModuleType -from typing import Any, Optional, cast +from typing import ( + Any, + Final, + Optional, + cast, + Literal, + TypeAlias, + overload, + Mapping, +) from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException from schema_salad.sourceline import SourceLine, strip_dup_lineno from schema_salad.utils import json_dumps, yaml_no_ts -import cwl_utils -import cwl_utils.parser - from . import ( + CommandLineTool, + ExpressionTool, LoadingOptions, Process, Workflow, @@ -27,11 +34,178 @@ cwl_v1_1_utils, cwl_v1_2, cwl_v1_2_utils, + load_document_by_uri, + OutputArraySchema, + InputArraySchema, + OutputParameter, + InputParameter, + ArraySchema, + InputRecordSchema, + CommandOutputRecordSchema, + OutputRecordSchema, + InputRecordField, + OutputRecordField, ) +from ..types import is_sequence _logger = logging.getLogger("cwl_utils") +BasicInputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.BasicInputTypeSchemas + | cwl_v1_1_utils.BasicInputTypeSchemas + | cwl_v1_2_utils.BasicInputTypeSchemas +) + + +InputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.InputTypeSchemas + | cwl_v1_1_utils.InputTypeSchemas + | cwl_v1_2_utils.InputTypeSchemas +) + + +BasicOutputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.BasicOutputTypeSchemas + | cwl_v1_1_utils.BasicOutputTypeSchemas + | cwl_v1_2_utils.BasicOutputTypeSchemas +) + + +OutputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.OutputTypeSchemas + | cwl_v1_1_utils.OutputTypeSchemas + | cwl_v1_2_utils.OutputTypeSchemas +) + + +SrcSink: TypeAlias = ( + cwl_v1_0_utils.SrcSink | cwl_v1_1_utils.SrcSink | cwl_v1_2_utils.SrcSink +) + + +def _compare_records( + src: InputRecordSchema | OutputRecordSchema, + sink: InputRecordSchema | OutputRecordSchema, + strict: bool = False, +) -> bool: + """ + Compare two records, ensuring they have compatible fields. + + This handles normalizing record names, which will be relative to workflow + step, so that they can be compared. + """ + srcfields = { + cwl_v1_2.shortname(field.name): cast( + InputTypeSchemas | OutputTypeSchemas | None, field.type_ + ) + for field in cast( + Sequence[InputRecordField | OutputRecordField], src.fields or [] + ) + } + sinkfields = { + cwl_v1_2.shortname(field.name): cast( + InputTypeSchemas | OutputTypeSchemas | None, field.type_ + ) + for field in cast( + Sequence[InputRecordField | OutputRecordField], sink.fields or [] + ) + } + for key in sinkfields.keys(): + if ( + not can_assign_src_to_sink( + srcfields.get(key, "null"), sinkfields.get(key, "null"), strict + ) + and sinkfields.get(key) is not None + ): + _logger.info( + "Record comparison failure for %s and %s\n" + "Did not match fields for %s: %s and %s", + cast(InputRecordSchema | CommandOutputRecordSchema, src).name, + cast(InputRecordSchema | CommandOutputRecordSchema, sink).name, + key, + srcfields.get(key), + sinkfields.get(key), + ) + return False + return True + + +def can_assign_src_to_sink( + src: InputTypeSchemas | OutputTypeSchemas | None, + sink: InputTypeSchemas | OutputTypeSchemas | None, + strict: bool = False, +) -> bool: + """ + Check for identical type specifications, ignoring extra keys like inputBinding. + + src: admissible source types + sink: admissible sink types + + In non-strict comparison, at least one source type must match one sink type, + except for 'null'. + In strict comparison, all source types must match at least one sink type. + """ + if "Any" in (src, sink): + return True + if isinstance(src, InputArraySchema | OutputArraySchema) and isinstance( + sink, InputArraySchema | OutputArraySchema + ): + return can_assign_src_to_sink( + cast(InputTypeSchemas | OutputTypeSchemas | None, src.items), + cast(InputTypeSchemas | OutputTypeSchemas | None, sink.items), + strict, + ) + if isinstance(src, InputRecordSchema | OutputRecordSchema) and isinstance( + sink, InputRecordSchema | OutputRecordSchema + ): + return _compare_records(src, sink, strict) + if isinstance(src, MutableSequence): + if strict: + for this_src in src: + if not can_assign_src_to_sink(this_src, sink): + return False + return True + for this_src in src: + if this_src != "null" and can_assign_src_to_sink(this_src, sink): + return True + return False + if isinstance(sink, MutableSequence): + for this_sink in sink: + if can_assign_src_to_sink(src, this_sink): + return True + return False + return bool(src == sink) + + +def check_types( + srctype: InputTypeSchemas | OutputTypeSchemas | None, + sinktype: InputTypeSchemas | OutputTypeSchemas | None, + linkMerge: str | None, + valueFrom: str | None = None, +) -> str: + """ + Check if the source and sink types are correct. + + Acceptable types are "pass", "warning", or "exception". + """ + if valueFrom is not None: + return "pass" + if linkMerge is None: + if can_assign_src_to_sink(srctype, sinktype, strict=True): + return "pass" + if can_assign_src_to_sink(srctype, sinktype, strict=False): + return "warning" + return "exception" + if linkMerge == "merge_nested": + return check_types( + cwl_v1_2.ArraySchema(items=srctype, type_="array"), sinktype, None, None + ) + if linkMerge == "merge_flattened": + return check_types(merge_flatten_type(srctype), sinktype, None, None) + raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") + + def convert_stdstreams_to_files(process: Process) -> None: """Convert stdin, stdout and stderr type shortcuts to files.""" match process: @@ -43,6 +217,21 @@ def convert_stdstreams_to_files(process: Process) -> None: cwl_v1_2_utils.convert_stdstreams_to_files(process) +def dump_type( + type_: InputTypeSchemas | OutputTypeSchemas | None, + cwlVersion: Literal["v1.0", "v1.1", "v1.2"], +) -> str: + match cwlVersion: + case "v1.0": + return json_dumps(cwl_v1_0.save(type_)) + case "v1.1": + return json_dumps(cwl_v1_1.save(type_)) + case "v1.2": + return json_dumps(cwl_v1_2.save(type_)) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") + + def load_inputfile_by_uri( version: str, path: str | Path, @@ -134,10 +323,10 @@ def load_inputfile_by_yaml( def load_step( - step: cwl_utils.parser.WorkflowStep, + step: WorkflowStep, ) -> Process: if isinstance(step.run, str): - step_run = cwl_utils.parser.load_document_by_uri( + step_run = load_document_by_uri( path=step.loadingOptions.fetcher.urljoin( base_url=cast(str, step.loadingOptions.fileuri), url=step.run, @@ -148,21 +337,28 @@ def load_step( return cast(Process, copy.deepcopy(step.run)) -def static_checker(workflow: cwl_utils.parser.Workflow) -> None: +def merge_flatten_type(src: Any) -> Any: + """Return the merge flattened type of the source type.""" + if isinstance(src, MutableSequence): + return [merge_flatten_type(t) for t in src] + if isinstance(src, ArraySchema): + return src + return cwl_v1_2.ArraySchema(type_="array", items=src) + + +def static_checker(workflow: Workflow) -> None: """Check if all source and sink types of a workflow are compatible before run time.""" - step_inputs = [] + step_inputs: Final[MutableSequence[WorkflowStepInput]] = [] step_outputs = [] - type_dict = {} - param_to_step = {} + type_dict: dict[str, InputTypeSchemas | OutputTypeSchemas | None] = {} + param_to_step: Final[MutableMapping[str, WorkflowStep]] = {} for step in workflow.steps: if step.in_ is not None: step_inputs.extend(step.in_) param_to_step.update({s.id: step for s in step.in_}) type_dict.update( { - cast(str, s.id): type_for_step_input( - step, s, cast(str, workflow.cwlVersion) - ) + s.id: type_for_step_input(step, s, cast(str, workflow.cwlVersion)) for s in step.in_ } ) @@ -204,33 +400,73 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: **{param.id: param.type_ for param in workflow.outputs}, } - parser: ModuleType - step_inputs_val: dict[str, Any] - workflow_outputs_val: dict[str, Any] + step_inputs_val: Mapping[str, Sequence[SrcSink]] + workflow_outputs_val: Mapping[str, Sequence[SrcSink]] match workflow.cwlVersion: case "v1.0": - parser = cwl_v1_0 step_inputs_val = cwl_v1_0_utils.check_all_types( - src_dict, step_inputs, type_dict + cast( + Mapping[str, cwl_v1_0.InputParameter | cwl_v1_0.WorkflowStepOutput], + src_dict, + ), + cast(MutableSequence[cwl_v1_0.WorkflowStepInput], step_inputs), + type_dict, ) workflow_outputs_val = cwl_v1_0_utils.check_all_types( - src_dict, workflow.outputs, type_dict + cast( + Mapping[str, cwl_v1_0.InputParameter | cwl_v1_0.WorkflowStepOutput], + src_dict, + ), + workflow.outputs, + type_dict, ) case "v1.1": - parser = cwl_v1_1 step_inputs_val = cwl_v1_1_utils.check_all_types( - src_dict, step_inputs, type_dict + cast( + Mapping[ + str, + cwl_v1_1.WorkflowInputParameter | cwl_v1_1.WorkflowStepOutput, + ], + src_dict, + ), + cast(MutableSequence[cwl_v1_1.WorkflowStepInput], step_inputs), + type_dict, ) workflow_outputs_val = cwl_v1_1_utils.check_all_types( - src_dict, workflow.outputs, type_dict + cast( + Mapping[ + str, + cwl_v1_1.WorkflowInputParameter | cwl_v1_1.WorkflowStepOutput, + ], + src_dict, + ), + workflow.outputs, + type_dict, ) case "v1.2": - parser = cwl_v1_2 step_inputs_val = cwl_v1_2_utils.check_all_types( - src_dict, step_inputs, param_to_step, type_dict + cast( + Mapping[ + str, + cwl_v1_2.WorkflowInputParameter | cwl_v1_2.WorkflowStepOutput, + ], + src_dict, + ), + cast(MutableSequence[cwl_v1_2.WorkflowStepInput], step_inputs), + cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), + type_dict, ) workflow_outputs_val = cwl_v1_2_utils.check_all_types( - src_dict, workflow.outputs, param_to_step, type_dict + cast( + Mapping[ + str, + cwl_v1_2.WorkflowInputParameter | cwl_v1_2.WorkflowStepOutput, + ], + src_dict, + ), + workflow.outputs, + cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), + type_dict, ) case _ as cwlVersion: raise Exception(f"Unsupported CWL version {cwlVersion}") @@ -244,20 +480,21 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: src = warning.src sink = warning.sink linkMerge = warning.linkMerge + msg = ( SourceLine(src, "type").makeError( "Source '%s' of type %s may be incompatible" % ( - parser.shortname(src.id), - json_dumps(parser.save(type_dict[src.id])), + shortname(src.id, workflow.cwlVersion), + dump_type(type_dict[src.id], workflow.cwlVersion), ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - parser.shortname(sink.id), - json_dumps(parser.save(type_dict[sink.id])), + shortname(sink.id, workflow.cwlVersion), + dump_type(type_dict[sink.id], workflow.cwlVersion), ) ) ) @@ -281,14 +518,17 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: msg = ( SourceLine(src, "type").makeError( "Source '%s' of type %s is incompatible" - % (parser.shortname(src.id), json_dumps(parser.save(type_dict[src.id]))) + % ( + shortname(src.id, workflow.cwlVersion), + dump_type(type_dict[src.id], workflow.cwlVersion), + ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - parser.shortname(sink.id), - json_dumps(parser.save(type_dict[sink.id])), + shortname(sink.id, workflow.cwlVersion), + dump_type(type_dict[sink.id], workflow.cwlVersion), ) ) ) @@ -302,19 +542,17 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: exception_msgs.append(msg) for sink in step_inputs: + sink_type = type_dict[sink.id] if ( - "null" != type_dict[sink.id] - and not ( - isinstance(type_dict[sink.id], MutableSequence) - and "null" in type_dict[sink.id] - ) + "null" != sink_type + and not (is_sequence(sink_type) and "null" in sink_type) and getattr(sink, "source", None) is None and getattr(sink, "default", None) is None and getattr(sink, "valueFrom", None) is None ): msg = SourceLine(sink).makeError( "Required parameter '%s' does not have source, default, or valueFrom expression" - % parser.shortname(sink.id) + % shortname(sink.id, workflow.cwlVersion), ) exception_msgs.append(msg) @@ -327,6 +565,78 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: raise ValidationException(all_exception_msg) +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.0"] +) -> cwl_v1_0.InputArraySchema: ... + + +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.1"] +) -> cwl_v1_1.InputArraySchema: ... + + +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.2"] +) -> cwl_v1_2.InputArraySchema: ... + + +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.0", "v1.1", "v1.2"] +) -> InputArraySchema: + match cwlVersion: + case "v1.0": + return cwl_v1_0_utils.to_input_array( + cast(cwl_v1_0_utils.InputTypeSchemas, type_) + ) + case "v1.1": + return cwl_v1_1_utils.to_input_array( + cast(cwl_v1_1_utils.InputTypeSchemas, type_) + ) + case "v1.2": + return cwl_v1_2_utils.to_input_array( + cast(cwl_v1_2_utils.InputTypeSchemas, type_) + ) + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.0"] +) -> cwl_v1_0.OutputArraySchema: ... + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.1"] +) -> cwl_v1_1.OutputArraySchema: ... + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.2"] +) -> cwl_v1_2.OutputArraySchema: ... + + +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.0", "v1.1", "v1.2"] +) -> OutputArraySchema: + match cwlVersion: + case "v1.0": + return cwl_v1_0_utils.to_output_array( + cast(cwl_v1_0_utils.OutputTypeSchemas, type_) + ) + case "v1.1": + return cwl_v1_1_utils.to_output_array( + cast(cwl_v1_1_utils.OutputTypeSchemas, type_) + ) + case "v1.2": + return cwl_v1_2_utils.to_output_array( + cast(cwl_v1_2_utils.OutputTypeSchemas, type_) + ) + + def type_for_source( process: Process, sourcenames: str | list[str], @@ -338,36 +648,21 @@ def type_for_source( match process.cwlVersion: case "v1.0": return cwl_v1_0_utils.type_for_source( - cast( - cwl_v1_0.CommandLineTool - | cwl_v1_0.Workflow - | cwl_v1_0.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_0.Workflow | None, parent), linkMerge, ) case "v1.1": return cwl_v1_1_utils.type_for_source( - cast( - cwl_v1_1.CommandLineTool - | cwl_v1_1.Workflow - | cwl_v1_1.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_1.Workflow | None, parent), linkMerge, ) case "v1.2": return cwl_v1_2_utils.type_for_source( - cast( - cwl_v1_2.CommandLineTool - | cwl_v1_2.Workflow - | cwl_v1_2.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_2.Workflow | None, parent), linkMerge, @@ -383,7 +678,7 @@ def type_for_source( def type_for_step_input( step: WorkflowStep, in_: WorkflowStepInput, cwlVersion: str -) -> Any: +) -> InputTypeSchemas | None: """Determine the type for the given step output.""" match cwlVersion: case "v1.0": @@ -398,9 +693,13 @@ def type_for_step_input( return cwl_v1_2_utils.type_for_step_input( cast(cwl_v1_2.WorkflowStep, step), cast(cwl_v1_2.WorkflowStepInput, in_) ) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") -def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) -> Any: +def type_for_step_output( + step: WorkflowStep, sourcename: str, cwlVersion: str +) -> OutputTypeSchemas | None: """Determine the type for the given step output.""" match cwlVersion: case "v1.0": @@ -415,82 +714,38 @@ def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) - return cwl_v1_2_utils.type_for_step_output( cast(cwl_v1_2.WorkflowStep, step), sourcename ) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") def param_for_source_id( - process: ( - cwl_utils.parser.CommandLineTool - | cwl_utils.parser.Workflow - | cwl_utils.parser.ExpressionTool - ), + process: CommandLineTool | Workflow | ExpressionTool, sourcenames: str | list[str], - parent: cwl_utils.parser.Workflow | None = None, + parent: Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - ( - MutableSequence[ - cwl_utils.parser.cwl_v1_0.InputParameter - | cwl_utils.parser.cwl_v1_0.CommandOutputParameter - ] - | cwl_utils.parser.cwl_v1_0.InputParameter - | cwl_utils.parser.cwl_v1_0.CommandOutputParameter - ) - | ( - MutableSequence[ - cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter - ] - | cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter - ) - | ( - MutableSequence[ - cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter - ] - | cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter - ) + InputParameter | OutputParameter | MutableSequence[InputParameter | OutputParameter] ): match process.cwlVersion: case "v1.0": - return cwl_utils.parser.cwl_v1_0_utils.param_for_source_id( - cast( - cwl_utils.parser.cwl_v1_0.CommandLineTool - | cwl_utils.parser.cwl_v1_0.Workflow - | cwl_utils.parser.cwl_v1_0.ExpressionTool, - process, - ), + return cwl_v1_0_utils.param_for_source_id( + process, sourcenames, - cast(cwl_utils.parser.cwl_v1_0.Workflow, parent), + cast(cwl_v1_0.Workflow, parent), scatter_context, ) case "v1.1": - return cwl_utils.parser.cwl_v1_1_utils.param_for_source_id( - cast( - cwl_utils.parser.cwl_v1_1.CommandLineTool - | cwl_utils.parser.cwl_v1_1.Workflow - | cwl_utils.parser.cwl_v1_1.ExpressionTool, - process, - ), + return cwl_v1_1_utils.param_for_source_id( + process, sourcenames, - cast(cwl_utils.parser.cwl_v1_1.Workflow, parent), + cast(cwl_v1_1.Workflow, parent), scatter_context, ) case "v1.2": - return cwl_utils.parser.cwl_v1_2_utils.param_for_source_id( - cast( - cwl_utils.parser.cwl_v1_2.CommandLineTool - | cwl_utils.parser.cwl_v1_2.Workflow - | cwl_utils.parser.cwl_v1_2.ExpressionTool, - process, - ), + return cwl_v1_2_utils.param_for_source_id( + process, sourcenames, - cast(cwl_utils.parser.cwl_v1_2.Workflow, parent), + cast(cwl_v1_2.Workflow, parent), scatter_context, ) case None: @@ -499,3 +754,15 @@ def param_for_source_id( raise ValidationException( f"Version error. Did not recognise {process.cwlVersion} as a CWL version" ) + + +def shortname(name: str, cwlVersion: Literal["v1.0", "v1.1", "v1.2"]) -> str: + match cwlVersion: + case "v1.0": + return cwl_v1_0.shortname(name) + case "v1.1": + return cwl_v1_1.shortname(name) + case "v1.2": + return cwl_v1_2.shortname(name) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") diff --git a/cwl_utils/tests/test_parser_utils.py b/cwl_utils/tests/test_parser_utils.py index d977ec75..2f2610bb 100644 --- a/cwl_utils/tests/test_parser_utils.py +++ b/cwl_utils/tests/test_parser_utils.py @@ -199,6 +199,7 @@ def test_v1_0_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -231,6 +232,7 @@ def test_v1_0_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -244,6 +246,7 @@ def test_v1_0_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -276,6 +279,7 @@ def test_v1_0_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -505,6 +509,7 @@ def test_v1_1_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -537,6 +542,7 @@ def test_v1_1_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -550,6 +556,7 @@ def test_v1_1_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -582,6 +589,7 @@ def test_v1_1_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -855,6 +863,7 @@ def test_v1_2_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -887,6 +896,7 @@ def test_v1_2_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -900,6 +910,7 @@ def test_v1_2_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -932,6 +943,7 @@ def test_v1_2_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob diff --git a/cwl_utils/tests/test_subscope.py b/cwl_utils/tests/test_subscope.py index d50bf958..48a68c98 100644 --- a/cwl_utils/tests/test_subscope.py +++ b/cwl_utils/tests/test_subscope.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 """Test that scoping of identifiers in Workflow.steps[].run is correct.""" -from cwl_utils.parser import Workflow, load_document_by_uri +from cwl_utils.parser import Process, Workflow, load_document_by_uri from .util import get_path @@ -10,6 +10,7 @@ def test_workflow_step_process_scope_v1_0() -> None: """CWL v1.0 IDs under Workflow.steps[].run should not be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/target") @@ -17,6 +18,7 @@ def test_workflow_step_process_scope_v1_1() -> None: """CWL v1.1 IDs under Workflow.steps[].run should be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr_v1_1.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target") @@ -24,4 +26,5 @@ def test_workflow_step_process_scope_v1_2() -> None: """CWL v1.2 IDs under Workflow.steps[].run should be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr_v1_2.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target") diff --git a/cwl_utils/types.py b/cwl_utils/types.py index 6b7b0d83..03f601c5 100644 --- a/cwl_utils/types.py +++ b/cwl_utils/types.py @@ -3,7 +3,7 @@ """Shared Python type definitions for commons JSON like CWL objects.""" import sys -from collections.abc import Mapping, MutableMapping, MutableSequence +from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from typing import Any, Literal, TypeAlias, TypedDict, TypeGuard if sys.version_info >= (3, 13): @@ -161,3 +161,7 @@ def is_file_or_directory( value: Any, ) -> TypeIs[CWLFileType | CWLDirectoryType]: return isinstance(value, Mapping) and value.get("class") in ("File", "Directory") + + +def is_sequence(thing: object) -> TypeIs[Sequence[Any]]: + return isinstance(thing, Sequence) and not isinstance(thing, str) diff --git a/cwl_utils/utils.py b/cwl_utils/utils.py index 0db35819..5abd72b4 100644 --- a/cwl_utils/utils.py +++ b/cwl_utils/utils.py @@ -7,11 +7,11 @@ import urllib.error import urllib.parse import urllib.request -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from copy import deepcopy from importlib.resources import files from io import StringIO -from typing import Any +from typing import Any, cast from urllib.parse import urlparse from ruamel.yaml.main import YAML @@ -381,11 +381,15 @@ def sanitise_schema_field( case {"type": {"type": "enum", **rest}}: schema_field_item["type"] = InputEnumSchemaV1_2( type_="enum", - symbols=rest.get("symbols", ""), + symbols=cast(Sequence[str], rest.get("symbols", [])), ) case {"type": {"type": "array", **rest}}: schema_field_item["type"] = InputArraySchemaV1_2( - type_="array", items=rest.get("items", "") + type_="array", + items=cast( + str | cwl_v1_2.InputSchema | Sequence[str | cwl_v1_2.InputSchema], + rest.get("items", ""), + ), ) case {"type": {"$import": _}}: pass # Leave import as is diff --git a/pyproject.toml b/pyproject.toml index 33edce87..539210af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,3 +140,4 @@ ignore = [ [tool.bandit] exclude_dirs = ["cwl_utils/tests"] +skips = ["B101"]