From 61fc40a4de90b49cc3c962b6e6d7ae5305bff770 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Thu, 18 Dec 2025 22:12:41 +0100 Subject: [PATCH 01/16] Typed CWL parsers --- .gitignore | 3 + cwl_utils/cite_extract.py | 2 +- cwl_utils/cwl_v1_0_expression_refactor.py | 3 +- cwl_utils/cwl_v1_1_expression_refactor.py | 2 +- cwl_utils/cwl_v1_2_expression_refactor.py | 2 +- cwl_utils/docker_extract.py | 4 +- cwl_utils/inputs_schema_gen.py | 18 +- cwl_utils/parser/__init__.py | 6 + cwl_utils/parser/cwl_v1_0.py | 4177 +++++++++--------- cwl_utils/parser/cwl_v1_0_utils.py | 4 +- cwl_utils/parser/cwl_v1_1.py | 4458 ++++++++++--------- cwl_utils/parser/cwl_v1_1_utils.py | 7 +- cwl_utils/parser/cwl_v1_2.py | 4899 +++++++++++---------- cwl_utils/parser/cwl_v1_2_utils.py | 7 +- cwl_utils/parser/utils.py | 11 +- cwl_utils/tests/test_parser_utils.py | 12 + cwl_utils/tests/test_subscope.py | 6 +- 17 files changed, 7213 insertions(+), 6408 deletions(-) diff --git a/.gitignore b/.gitignore index 0900bed7..376eb398 100644 --- a/.gitignore +++ b/.gitignore @@ -111,6 +111,9 @@ testenv*/ # PyCharm .idea/ +# UV +uv.lock + # Backup files *.orig *~ 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 c66e7d6f..80ea51b3 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -1241,7 +1241,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 @@ -1465,6 +1465,7 @@ def traverse_CommandLineTool( inp.linkMerge = None for index, out in enumerate(new_clt_step.out): new_clt_step.out[index] = out.split("/")[-1] + 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: diff --git a/cwl_utils/cwl_v1_1_expression_refactor.py b/cwl_utils/cwl_v1_1_expression_refactor.py index 3f260e56..41adad58 100755 --- a/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/cwl_utils/cwl_v1_1_expression_refactor.py @@ -1243,7 +1243,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 diff --git a/cwl_utils/cwl_v1_2_expression_refactor.py b/cwl_utils/cwl_v1_2_expression_refactor.py index 3d7f86e7..b467c7f7 100755 --- a/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/cwl_utils/cwl_v1_2_expression_refactor.py @@ -1346,7 +1346,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 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 d78228f8..be35701e 100644 --- a/cwl_utils/inputs_schema_gen.py +++ b/cwl_utils/inputs_schema_gen.py @@ -12,7 +12,7 @@ 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 @@ -26,6 +26,7 @@ InputEnumSchema, InputRecordSchema, InputRecordSchemaTypes, + SchemaDefRequirement, Workflow, WorkflowInputParameter, cwl_v1_0, @@ -402,12 +403,15 @@ 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( diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index 6e105072..3ff92077 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -238,6 +238,12 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepInput ) """Type Union for a CWL v1.x LoadContents object.""" +SchemaDefRequirement: TypeAlias = ( + cwl_v1_0.SchemaDefRequirement + | cwl_v1_1.SchemaDefRequirement + | cwl_v1_2.SchemaDefRequirement +) +"""Type Union for a CWL v1.x SchemaDefRequirement object.""" _Loader: TypeAlias = cwl_v1_0._Loader | cwl_v1_1._Loader | cwl_v1_2._Loader """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..4aedf527 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 MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ 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"]] +S = TypeVar("S", bound="Saveable") 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 +62,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 +91,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 +133,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 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,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,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,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] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,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 @@ -434,9 +449,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, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( 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 @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( 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 not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,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[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + 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 +564,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, Any]: 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: @@ -584,11 +599,11 @@ 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 doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: 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): +class _RecordLoader(_Loader, Generic[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 +699,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)))}, " @@ -710,19 +726,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, + ) -> 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: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, 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 +848,40 @@ def load( 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 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 = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,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 +917,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 +929,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,8 +943,8 @@ def load( 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 isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( 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 isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,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,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_0" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): 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 +1216,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"): @@ -1376,7 +1375,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,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +1456,14 @@ 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"]) + + +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 +1478,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 +1581,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 +1641,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_: Literal["record"], + 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 +1656,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_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,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"): @@ -1849,7 +1848,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: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,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_: Literal["enum"], + 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 +1928,14 @@ 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"]) + + +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 +1950,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 +2054,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 +2113,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ 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"]) + + +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 +2149,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 +2253,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 +2312,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_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +2327,13 @@ 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"]) + +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 +2348,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 +2452,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 +2511,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ 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"]) + + +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 +2547,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 +2651,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 +2710,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ 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"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,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"): @@ -2912,7 +2911,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,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | 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 +2992,14 @@ 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"]) + + +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 +3014,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 +3117,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,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + 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"]) class File(Saveable): @@ -3250,43 +3269,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 +3311,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 +3669,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 +3852,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 +3965,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 | int = 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] = "https://w3id.org/cwl/cwl#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", @@ -4049,29 +4068,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 +4090,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 +4302,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,13 +4378,40 @@ 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] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class SchemaBase(Saveable): pass +@trait class Parameter(SchemaBase): """ Define an input or output parameter to a process. @@ -4398,18 +4421,22 @@ class Parameter(SchemaBase): pass +@trait class InputBinding(Saveable): pass +@trait class OutputBinding(Saveable): pass +@trait class InputSchema(SchemaBase): pass +@trait class OutputSchema(SchemaBase): pass @@ -4417,30 +4444,6 @@ class OutputSchema(SchemaBase): 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, - ) -> 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_ - self.inputBinding = inputBinding - self.label = label - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4461,8 +4464,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"): @@ -4714,7 +4717,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,8 +4742,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, inputBinding=inputBinding, label=label, @@ -4792,20 +4795,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_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +4813,19 @@ 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"] + ) + + +class InputRecordSchema(CWLRecordSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): @@ -4839,8 +4846,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"): @@ -5045,7 +5052,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,10 +5077,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5115,21 +5122,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_: Literal["record"], + 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 +5139,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.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5167,8 +5172,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"): @@ -5421,7 +5426,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: @@ -5446,7 +5451,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5498,18 +5503,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_: Literal["enum"], + 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 +5521,18 @@ 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"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): return bool( @@ -5543,8 +5552,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 +5750,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 +5822,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: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +5839,18 @@ 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"] + ) + + +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -5860,8 +5871,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"): @@ -6066,7 +6077,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,8 +6102,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, @@ -6139,17 +6150,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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +6167,17 @@ 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"] + ) + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): return bool( @@ -6181,8 +6196,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 +6346,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 +6411,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_: Literal["record"], + 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 +6427,15 @@ 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"]) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -6448,8 +6459,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"): @@ -6702,7 +6713,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: @@ -6727,7 +6738,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -6779,18 +6790,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_: Literal["enum"], + 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 +6808,18 @@ 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"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): return bool( @@ -6824,8 +6839,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 +7037,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 +7109,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: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + 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 +7126,18 @@ 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"] + ) + + +class InputParameter(Parameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputParameter): @@ -7168,8 +7175,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"): @@ -7608,7 +7615,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 +7640,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -7711,35 +7718,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_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +7744,29 @@ 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", + ] + ) + + +class OutputParameter(Parameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputParameter): @@ -7789,8 +7800,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"): @@ -8135,7 +8146,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,11 +8171,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, extension_fields=extension_fields, @@ -8228,7 +8239,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,6 +8280,7 @@ def save( ) +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8255,6 +8295,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Saveable): """ @@ -8275,23 +8316,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 +8333,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 +8404,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,7 +8470,24 @@ 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] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) class SchemaDefRequirement(ProcessRequirement): @@ -8461,23 +8502,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 +8516,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 +8588,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 +8651,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 +8665,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8672,8 +8695,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 +8799,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,7 +8859,25 @@ 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): @@ -8879,34 +8920,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 +8952,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 +9289,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 +9386,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int = 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", @@ -9401,26 +9442,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 +9460,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 +9609,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 +9680,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 +9696,15 @@ 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"]) + + +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9709,8 +9726,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"): @@ -9962,7 +9979,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,8 +10004,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, inputBinding=inputBinding, label=label, @@ -10040,20 +10057,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_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +10075,19 @@ 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"] + ) + + +class CommandInputRecordSchema(InputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): @@ -10087,8 +10108,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"): @@ -10293,7 +10314,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,10 +10339,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -10363,21 +10384,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_: Literal["record"], + 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 +10401,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.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): @@ -10415,8 +10434,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"): @@ -10669,7 +10688,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: @@ -10694,7 +10713,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -10746,18 +10765,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_: Literal["enum"], + 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 +10783,18 @@ 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"] + ) + + +class CommandInputArraySchema(InputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -10791,8 +10814,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 +11012,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 +11084,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: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +11101,18 @@ 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"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11108,8 +11133,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"): @@ -11314,7 +11339,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,8 +11364,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, @@ -11387,20 +11412,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_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +11429,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.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + + +class CommandOutputRecordSchema(OutputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): @@ -11434,8 +11461,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"): @@ -11640,7 +11667,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,10 +11692,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11710,21 +11737,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_: Literal["record"], + 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 +11754,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 + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -11762,8 +11787,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"): @@ -12016,7 +12041,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: @@ -12041,7 +12066,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -12093,18 +12118,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_: Literal["enum"], + 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 +12136,18 @@ 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"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): return bool( @@ -12138,8 +12167,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 +12365,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 +12437,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: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +12454,22 @@ 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"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -12486,8 +12507,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"): @@ -12926,7 +12947,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 +12972,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -13029,7 +13050,39 @@ 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, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -13051,36 +13104,6 @@ class CommandOutputParameter(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, CommandOutputParameter): return bool( @@ -13115,8 +13138,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"): @@ -13508,7 +13531,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,11 +13556,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, @@ -13606,7 +13629,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_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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", @@ -13628,53 +13681,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 +13733,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"): @@ -14514,7 +14520,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: @@ -14539,7 +14545,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -14666,7 +14672,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: Literal["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"] | 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[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = 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] = "https://w3id.org/cwl/cwl#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", @@ -14727,33 +14780,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 +14812,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 +15118,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 +15224,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] = "https://w3id.org/cwl/cwl#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", @@ -15218,23 +15271,6 @@ class SoftwareRequirement(ProcessRequirement): """ - 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 +15285,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 +15357,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 +15420,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 +15434,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -15426,8 +15459,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 +15609,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 +15673,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 +15689,21 @@ 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"]) + + +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 +15723,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 +15873,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 +15941,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 +15957,17 @@ 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"]) + + +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 __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -15947,8 +15983,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 +16055,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 +16118,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 +16132,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -16123,8 +16159,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 +16231,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,7 +16294,24 @@ 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] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -16273,21 +16326,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_) @@ -16302,8 +16340,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"): @@ -16326,7 +16364,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,7 +16420,22 @@ 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] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -16410,37 +16463,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 +16499,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 +16528,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 +16622,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 +16669,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 +16763,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 +16810,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 +16857,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 +16899,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 +17009,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | int | str = None, + coresMax: None | int | str = None, + ramMin: None | int | str = None, + ramMax: None | int | str = None, + tmpdirMin: None | int | str = None, + tmpdirMax: None | int | str = None, + outdirMin: None | int | str = None, + outdirMax: None | int | 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] = "https://w3id.org/cwl/cwl#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", @@ -17005,36 +17058,6 @@ def save( 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 +17092,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"): @@ -17462,7 +17485,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,11 +17510,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, @@ -17560,7 +17583,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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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", @@ -17582,39 +17635,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 +17673,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"): @@ -18112,7 +18132,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: @@ -18137,7 +18157,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -18220,46 +18240,19 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "id", - "inputs", - "outputs", - "requirements", - "hints", - "label", - "doc", - "cwlVersion", - "class", - "expression", - ] - ) - - -class WorkflowOutputParameter(OutputParameter): - """ - Describe an output parameter of a workflow. The parameter must be - connected to one or more parameters defined in the workflow that will - provide the value of the output 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, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + 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: Literal["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"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -18269,16 +18262,42 @@ 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.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_ + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "inputs", + "outputs", + "requirements", + "hints", + "label", + "doc", + "cwlVersion", + "class", + "expression", + ] + ) + + +class WorkflowOutputParameter(OutputParameter): + """ + Describe an output parameter of a workflow. The parameter must be + connected to one or more parameters defined in the workflow that will + provide the value of the output parameter. + + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): @@ -18318,8 +18337,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"): @@ -18805,7 +18824,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 +18849,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, outputSource=outputSource, @@ -18912,7 +18931,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: Literal["merge_nested", "merge_flattened"] | None = None, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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,6 +18981,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -18978,30 +19032,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 +19054,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"): @@ -19276,7 +19306,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,9 +19331,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), source=source, linkMerge=linkMerge, - id=id, default=default, valueFrom=valueFrom, extension_fields=extension_fields, @@ -19350,7 +19380,33 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["source", "linkMerge", "id", "default", "valueFrom"]) + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | 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 + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.source = source + self.linkMerge = linkMerge + self.id = id + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( + ["source", "linkMerge", "id", "default", "valueFrom"] + ) class WorkflowStepOutput(Saveable): @@ -19364,22 +19420,6 @@ class WorkflowStepOutput(Saveable): 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) @@ -19394,8 +19434,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"): @@ -19458,7 +19498,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19481,7 +19521,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -19511,7 +19551,23 @@ 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(Saveable): @@ -19576,40 +19632,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 +19670,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"): @@ -20138,7 +20160,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: @@ -20163,7 +20185,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), in_=in_, out=out, requirements=requirements, @@ -20239,7 +20261,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: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | 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 + 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", @@ -20307,39 +20363,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 +20401,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"): @@ -20837,7 +20860,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: @@ -20862,7 +20885,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -20942,7 +20965,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -20965,21 +21021,6 @@ class SubworkflowFeatureRequirement(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_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -20994,8 +21035,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 +21059,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 +21115,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 +21128,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + 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 +21154,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 +21178,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 +21234,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 +21247,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -21232,8 +21273,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 +21297,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 +21353,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 +21366,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + 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 +21392,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 +21416,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 +21472,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 +21485,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +class LoadListingRequirement(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): return bool( @@ -21468,8 +21507,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 +21579,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 +21645,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: Literal["no_listing", "shallow_listing", "deep_listing"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21624,9 +21659,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.class_: Final[str] = "http://commonwl.org/cwltool#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + +class InplaceUpdateRequirement(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -21644,8 +21683,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 +21755,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 +21821,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 +21835,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "http://commonwl.org/cwltool#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) + +class Secrets(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -21817,8 +21856,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 +21928,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 +21990,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 +22004,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "TimeLimit" - self.timelimit = timelimit + self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, TimeLimit): @@ -21996,8 +22035,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 +22107,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,7 +22173,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) + def __init__( + self, + timelimit: int | 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] = "http://commonwl.org/cwltool#TimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) class WorkReuse(ProcessRequirement): @@ -22151,23 +22207,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 +22223,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 +22295,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,7 +22361,24 @@ 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] = "http://commonwl.org/cwltool#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -22345,23 +22401,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( @@ -22379,8 +22418,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 +22490,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 +22556,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 +22570,14 @@ 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] = "http://commonwl.org/cwltool#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -22594,8 +22617,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"): @@ -23053,7 +23076,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: @@ -23078,7 +23101,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -23157,7 +23180,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[OutputParameter], + 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: Literal["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"] | 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] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -23179,23 +23235,6 @@ class MPIRequirement(ProcessRequirement): """ - 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 +23251,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 +23323,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 +23389,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: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23376,11 +23403,17 @@ 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] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -23410,8 +23443,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 +23657,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 +23747,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 | int | str = None, + cudaDeviceCountMin: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23740,9 +23764,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -23757,8 +23796,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 +23868,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 +23931,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] = "http://commonwl.org/cwltool#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", @@ -24016,8 +24072,8 @@ def save( "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", @@ -24138,15 +24194,15 @@ def save( "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 = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -24172,17 +24228,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _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 = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -24201,26 +24257,26 @@ 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( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True ) -CWLInputFileLoader = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( +CWLInputFileLoader: Final = map_of_union_of_None_type_or_CWLObjectTypeLoader +CWLVersionLoader: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -24240,35 +24296,49 @@ def save( """ Version symbols for published CWL document versions. """ -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( +ExpressionLoader: Final = _ExpressionLoader(str) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +InputParameterLoader: Final = _RecordLoader(InputParameter, None, None) +OutputParameterLoader: Final = _RecordLoader(OutputParameter, None, None) +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, 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") +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24312,7 +24382,7 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24356,20 +24426,24 @@ 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( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -24379,10 +24453,12 @@ 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 = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -24393,38 +24469,44 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( +WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, 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( +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +TimeLimitLoader: Final = _RecordLoader(TimeLimit, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _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 = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24435,10 +24517,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24450,51 +24536,57 @@ 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 +) = _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 = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _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 = _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_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _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 +) = _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_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24503,10 +24595,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24516,73 +24612,82 @@ 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 +) = _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 +) = _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 = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _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( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _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 = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, + ) ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _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: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_strtype_or_ExpressionLoader: Final = _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 +) = _UnionLoader( ( None_type, strtype, @@ -24590,13 +24695,15 @@ def save( array_of_union_of_strtype_or_ExpressionLoader, ) ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24605,10 +24712,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24618,35 +24729,41 @@ 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 +) = _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 = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _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( +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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24655,10 +24772,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24668,50 +24789,60 @@ 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 +) = _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 = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _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( +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 +) = _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( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + 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 +) = _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 +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24722,30 +24853,36 @@ 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 +) = _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( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _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: Final = _ArrayLoader(InputParameterLoader) +idmap_inputs_array_of_InputParameterLoader: Final = _IdMapLoader( array_of_InputParameterLoader, "id", "type" ) -array_of_OutputParameterLoader = _ArrayLoader(OutputParameterLoader) -idmap_outputs_array_of_OutputParameterLoader = _IdMapLoader( +array_of_OutputParameterLoader: Final = _ArrayLoader(OutputParameterLoader) +idmap_outputs_array_of_OutputParameterLoader: Final = _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 = _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: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24770,21 +24907,29 @@ 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 +) = _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 +) = _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 +) = _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 +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24810,68 +24955,86 @@ 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 +) = _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 +) = _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 +) = _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( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = ( - _UnionLoader( - ( - InputRecordSchemaLoader, - InputEnumSchemaLoader, - InputArraySchemaLoader, - ) +union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( + Final +) = _UnionLoader( + ( + InputRecordSchemaLoader, + InputEnumSchemaLoader, + InputArraySchemaLoader, ) ) -array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = _ArrayLoader( +array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( + Final +) = _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_inttype: Final = _UnionLoader( ( None_type, - strtype, - ExpressionLoader, - array_of_strtype, + inttype, + ) +) +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + 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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24880,10 +25043,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24893,31 +25060,39 @@ 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 +) = _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 = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24926,10 +25101,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24939,31 +25118,39 @@ 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 +) = _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 = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24974,12 +25161,16 @@ 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 +) = _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 +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24992,72 +25183,82 @@ 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 +) = _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: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _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( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( InitialWorkDirRequirement_classLoader, False, True, None, None ) -union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( FileLoader, DirectoryLoader, @@ -25066,39 +25267,54 @@ 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 +) = _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 +) = _UnionLoader( ( array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader, strtype, ExpressionLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + inttype, + inttype, + strtype, + ExpressionLoader, + ) + ) +) +union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, @@ -25106,7 +25322,9 @@ 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 +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25117,67 +25335,75 @@ 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 +) = _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: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( + _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: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _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( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( union_of_None_type_or_array_of_Any_type, "class", "None" ) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -25186,64 +25412,70 @@ 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 +) = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, False, True, None, None ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -LoadListingEnumLoader = _EnumLoader( +uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -25251,42 +25483,44 @@ def save( ), "LoadListingEnum", ) -union_of_LoadListingEnumLoader = _UnionLoader((LoadListingEnumLoader,)) -uri_array_of_strtype_False_False_0_None = _URILoader( +union_of_LoadListingEnumLoader: Final = _UnionLoader((LoadListingEnumLoader,)) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_strtype = _UnionLoader( +union_of_inttype_or_strtype: Final = _UnionLoader( ( inttype, strtype, ) ) -union_of_booltype_or_strtype = _UnionLoader( +union_of_booltype_or_strtype: Final = _UnionLoader( ( booltype, strtype, ) ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _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 +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25294,10 +25528,14 @@ 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 +) = _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 +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25319,12 +25557,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) 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 +25582,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 +25602,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 +25623,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 2400298b..4a9a82ff 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -205,7 +205,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}" @@ -375,7 +375,7 @@ def type_for_step_input( 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]: + if 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") diff --git a/cwl_utils/parser/cwl_v1_1.py b/cwl_utils/parser/cwl_v1_1.py index 744cba7f..d03c8932 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 MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ 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"]] +S = TypeVar("S", bound="Saveable") 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 +62,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 +91,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 +133,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 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,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,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,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] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,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 @@ -434,9 +449,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, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( 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 @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( 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 not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,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[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + 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 +564,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, Any]: 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: @@ -584,11 +599,11 @@ 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 doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: 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): +class _RecordLoader(_Loader, Generic[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 +699,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)))}, " @@ -710,19 +726,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, + ) -> 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: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, 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 +848,40 @@ def load( 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 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 = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,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 +917,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 +929,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,8 +943,8 @@ def load( 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 isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( 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 isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,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,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_1" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): 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 +1216,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"): @@ -1376,7 +1375,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,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +1456,14 @@ 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"]) + + +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 +1478,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 +1581,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 +1641,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_: Literal["record"], + 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 +1656,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_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,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"): @@ -1849,7 +1848,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: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,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_: Literal["enum"], + 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 +1928,14 @@ 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"]) + + +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 +1950,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 +2054,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 +2113,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ 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"]) + + +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 +2149,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 +2253,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 +2312,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_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +2327,13 @@ 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"]) + +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 +2348,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 +2452,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 +2511,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ 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"]) + + +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 +2547,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 +2651,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 +2710,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ 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"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,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"): @@ -2912,7 +2911,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,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | 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 +2992,14 @@ 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"]) + + +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 +3014,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 +3117,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,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + 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"]) class File(Saveable): @@ -3250,43 +3269,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 +3311,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 +3669,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 +3852,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 +3965,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 | int = 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] = "https://w3id.org/cwl/cwl#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", @@ -4049,29 +4068,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 +4090,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 +4302,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,37 +4378,70 @@ 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] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class Labeled(Saveable): pass +@trait class Identified(Saveable): pass +@trait class IdentifierRequired(Identified): pass +@trait class LoadContents(Saveable): pass +@trait class FieldBase(Labeled): pass +@trait class InputFormat(Saveable): pass +@trait class OutputFormat(Saveable): pass +@trait class Parameter(FieldBase, Documented, IdentifierRequired): """ Define an input or output parameter to a process. @@ -4423,22 +4452,6 @@ class Parameter(FieldBase, Documented, IdentifierRequired): 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 +4466,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 +4521,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,17 +4579,36 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) + def __init__( + self, + loadContents: 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 + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + +@trait class IOSchema(Labeled, Documented): pass +@trait class InputSchema(IOSchema): pass +@trait class OutputSchema(IOSchema): pass @@ -4584,38 +4616,6 @@ class OutputSchema(IOSchema): 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, - ) -> 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_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4652,8 +4652,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"): @@ -5093,7 +5093,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 +5118,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5199,7 +5199,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -5217,30 +5249,6 @@ def save( class InputRecordSchema(CWLRecordSchema, InputSchema): 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 +5269,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"): @@ -5514,7 +5522,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,11 +5547,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5589,21 +5597,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_: Literal["record"], + 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 +5615,19 @@ 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"] + ) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5649,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"): @@ -5893,7 +5903,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: @@ -5918,7 +5928,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5967,21 +5977,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_: Literal["enum"], + 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 +5995,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +6029,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"): @@ -6271,7 +6283,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,11 +6308,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -6345,23 +6357,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: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +6375,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.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"] + ) + + +class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6421,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"): @@ -6758,7 +6768,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 +6793,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6848,23 +6858,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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +6878,21 @@ 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"] + ) + + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6914,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"): @@ -7153,7 +7167,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,11 +7192,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7228,21 +7242,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_: Literal["record"], + 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 +7260,19 @@ 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"] + ) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7294,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"): @@ -7532,7 +7548,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: @@ -7557,7 +7573,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -7606,21 +7622,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_: Literal["enum"], + 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 +7640,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7674,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"): @@ -7910,7 +7928,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,11 +7953,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7984,17 +8002,46 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) + def __init__( + self, + items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + 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 + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + 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"] + ) +@trait class InputParameter(Parameter, InputFormat, LoadContents): pass +@trait class OutputParameter(Parameter, OutputFormat): pass +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8009,6 +8056,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Identified, Labeled, Documented): """ @@ -8029,23 +8077,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( @@ -8063,8 +8094,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 +8165,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,9 +8231,27 @@ 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] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@trait class CommandInputSchema(Saveable): pass @@ -8219,23 +8268,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 +8282,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 +8354,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 +8417,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 +8431,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + +class SecondaryFileSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): return bool( @@ -8423,8 +8454,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 +8557,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 +8617,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,17 +8632,27 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.pattern = pattern + self.required = required - def __eq__(self, other: Any) -> bool: - if isinstance(other, LoadListingRequirement): - return bool( - self.class_ == other.class_ and self.loadListing == other.loadListing - ) - return False + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) - def __hash__(self) -> int: + +class LoadListingRequirement(ProcessRequirement): + """ + 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): + return bool( + self.class_ == other.class_ and self.loadListing == other.loadListing + ) + return False + + def __hash__(self) -> int: return hash((self.class_, self.loadListing)) @classmethod @@ -8629,8 +8661,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 +8732,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 +8798,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: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8792,8 +8812,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8811,8 +8842,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 +8946,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,7 +9006,25 @@ 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): @@ -9018,34 +9067,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 +9099,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 +9436,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 +9533,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int | 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", @@ -9540,28 +9589,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 +9608,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 +9804,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 +9883,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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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 +9900,23 @@ 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"] + ) + + +@trait +class CommandLineBindable(Saveable): + pass + + +class CommandInputRecordField(InputRecordField, CommandLineBindable): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9938,8 +9956,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"): @@ -10426,7 +10444,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 +10469,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10540,7 +10558,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -10561,32 +10613,6 @@ class CommandInputRecordSchema( ): 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 +10643,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"): @@ -10917,7 +10943,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,11 +10968,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11000,22 +11026,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_: Literal["record"], + 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 +11045,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_ 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"] + ) + + +class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11062,8 +11090,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"): @@ -11363,7 +11391,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: @@ -11388,7 +11416,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -11445,24 +11473,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_: Literal["enum"], + 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 +11492,23 @@ 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"] + ) + + +class CommandInputArraySchema( + InputArraySchema, CommandInputSchema, CommandLineBindable +): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11502,8 +11532,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"): @@ -11803,7 +11833,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,11 +11858,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11885,24 +11915,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: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +11934,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.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"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11955,8 +11983,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"): @@ -12349,7 +12377,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 +12402,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12447,7 +12475,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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", @@ -12464,30 +12522,6 @@ def save( 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( @@ -12508,8 +12542,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"): @@ -12761,7 +12795,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,11 +12820,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12836,21 +12870,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_: Literal["record"], + 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 +12888,19 @@ 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"] + ) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12886,8 +12922,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"): @@ -13140,7 +13176,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: @@ -13165,7 +13201,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -13214,21 +13250,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_: Literal["enum"], + 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 +13268,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13264,8 +13302,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"): @@ -13518,7 +13556,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,11 +13581,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -13592,31 +13630,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: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +13648,23 @@ 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"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13678,8 +13706,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"): @@ -14213,7 +14241,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 +14266,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14332,7 +14360,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -14356,36 +14420,6 @@ class CommandOutputParameter(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, - 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 +14454,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"): @@ -14814,7 +14848,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,11 +14873,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, @@ -14912,7 +14946,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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, + 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", @@ -14934,53 +14998,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 +15050,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"): @@ -15820,7 +15837,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: @@ -15845,7 +15862,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -15972,7 +15989,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: Literal["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"] | 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[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = 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] = "https://w3id.org/cwl/cwl#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", @@ -16051,33 +16115,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 +16147,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 +16453,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 +16559,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] = "https://w3id.org/cwl/cwl#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", @@ -16542,23 +16606,6 @@ class SoftwareRequirement(ProcessRequirement): """ - 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 +16620,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 +16692,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 +16755,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 +16769,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16750,8 +16794,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 +16944,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 +17008,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 +17024,21 @@ 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"]) + + +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 +17058,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 +17208,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 +17276,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 +17292,17 @@ 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"]) + + +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 __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17271,8 +17318,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 +17390,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 +17453,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 +17467,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17447,8 +17494,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 +17566,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,7 +17629,24 @@ 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] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -17597,21 +17661,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_) @@ -17626,8 +17675,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 +17699,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,7 +17755,22 @@ 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] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -17734,37 +17798,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 +17834,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 +17863,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 +17910,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 +17957,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 +18004,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 +18051,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 +18098,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 +18145,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 +18192,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 +18234,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 +18344,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | int | str = None, + coresMax: None | int | str = None, + ramMin: None | int | str = None, + ramMax: None | int | str = None, + tmpdirMin: None | int | str = None, + tmpdirMax: None | int | str = None, + outdirMin: None | int | str = None, + outdirMax: None | int | 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] = "https://w3id.org/cwl/cwl#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", @@ -18340,23 +18404,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 +18420,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 +18492,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,7 +18558,24 @@ 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] = "https://w3id.org/cwl/cwl#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -18534,23 +18598,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( @@ -18568,8 +18615,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 +18687,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,7 +18753,24 @@ 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] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) class InplaceUpdateRequirement(ProcessRequirement): @@ -18744,23 +18808,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 +18825,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 +18897,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,7 +18963,24 @@ 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] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) class ToolTimeLimit(ProcessRequirement): @@ -18931,23 +18995,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 +19011,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 +19041,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 +19083,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 +19149,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: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19128,13 +19163,14 @@ 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] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +class ExpressionToolOutputParameter(OutputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19168,8 +19204,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"): @@ -19515,7 +19551,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,11 +19576,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -19603,31 +19639,19 @@ def save( r["$namespaces"] = self.loadingOptions.namespaces if self.loadingOptions.schemas: r["$schemas"] = self.loadingOptions.schemas - return r - - attrs = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -class WorkflowInputParameter(InputParameter): - id: str + return r 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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +19665,17 @@ 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"] + ) + + +class WorkflowInputParameter(InputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19689,8 +19717,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"): @@ -20224,7 +20252,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 +20277,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20343,7 +20371,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -20374,39 +20438,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 +20476,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"): @@ -20904,7 +20935,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: @@ -20929,7 +20960,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -21012,7 +21043,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21039,38 +21103,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 +21139,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"): @@ -21548,7 +21580,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 +21605,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21647,7 +21679,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["merge_nested", "merge_flattened"] | 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,6 +21726,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -21716,36 +21781,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 +21815,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"): @@ -22173,7 +22208,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: @@ -22198,7 +22233,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), source=source, linkMerge=linkMerge, loadContents=loadContents, @@ -22268,7 +22303,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -22297,22 +22362,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 +22376,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"): @@ -22391,7 +22440,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22414,7 +22463,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -22444,7 +22493,23 @@ 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): @@ -22509,40 +22574,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 +22612,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"): @@ -23073,7 +23104,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: @@ -23098,7 +23129,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, in_=in_, @@ -23174,7 +23205,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, + 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: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | 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 + 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", @@ -23242,39 +23307,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 +23345,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"): @@ -23772,7 +23804,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: @@ -23797,7 +23829,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -23877,7 +23909,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23900,21 +23965,6 @@ class SubworkflowFeatureRequirement(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_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -23929,8 +23979,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 +24003,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 +24059,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 +24072,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + 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 +24098,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 +24122,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 +24178,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 +24191,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24167,8 +24217,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 +24241,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 +24297,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 +24310,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + 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 +24336,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 +24360,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 +24416,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 +24429,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +class Secrets(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -24401,8 +24449,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 +24521,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 +24583,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 +24597,14 @@ 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] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -24612,8 +24644,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"): @@ -25073,7 +25105,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: @@ -25098,7 +25130,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -25177,7 +25209,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter | WorkflowInputParameter], + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter], + 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: Literal["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"] | 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] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -25199,23 +25264,6 @@ class MPIRequirement(ProcessRequirement): """ - 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 +25280,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 +25352,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 +25418,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: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25396,11 +25432,17 @@ 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] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -25430,8 +25472,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 +25686,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 +25776,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 | int | str = None, + cudaDeviceCountMin: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25760,9 +25793,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -25777,8 +25825,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 +25897,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 +25960,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] = "http://commonwl.org/cwltool#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", @@ -26050,8 +26115,8 @@ def save( "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", @@ -26186,15 +26251,15 @@ def save( "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 = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -26220,17 +26285,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _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 = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -26249,54 +26314,64 @@ 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( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "None", None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, 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( +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, 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( +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +ShmSizeLoader: Final = _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 +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26321,24 +26396,32 @@ 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 +) = _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 +) = _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 +) = _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( +CWLInputFileLoader: Final = ( + 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: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -26360,7 +26443,7 @@ def save( """ Version symbols for published CWL document versions. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26376,31 +26459,45 @@ 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") +ExpressionLoader: Final = _ExpressionLoader(str) +InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdinLoader: Final = _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 +26519,7 @@ def save( stdin: ${inputs.an_input_name.path} ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26466,7 +26563,7 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26510,15 +26607,15 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -26528,10 +26625,12 @@ 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 = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -26542,19 +26641,21 @@ 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 = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _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 = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26565,10 +26666,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26580,51 +26685,57 @@ 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 +) = _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 = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _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 = _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_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _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 +) = _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_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26633,10 +26744,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26646,57 +26761,66 @@ 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 +) = _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 +) = _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 = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _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( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _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 = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _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 +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -26704,34 +26828,38 @@ 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( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _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: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _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 +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -26739,32 +26867,40 @@ 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( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + 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 +) = _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( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26773,10 +26909,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26786,29 +26926,35 @@ 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 +) = _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 = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _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( +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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26817,10 +26963,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26830,69 +26980,89 @@ 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 +) = _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 = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _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( +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 +) = _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( - ( - CommandInputParameterLoader, - WorkflowInputParameterLoader, +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( + _UnionLoader( + ( + CommandInputParameterLoader, + WorkflowInputParameterLoader, + ) ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = ( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) ) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = _IdMapLoader( +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: ( + Final +) = _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 +) = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, WorkflowOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( + Final +) = _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 +) = _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 +) = _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 +) = _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 +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26918,104 +27088,118 @@ 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 +) = _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 +) = _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 +) = _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( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( +LoadListingRequirement_classLoader: Final = _EnumLoader( ("LoadListingRequirement",), "LoadListingRequirement_class" ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( +uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( LoadListingRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, ExpressionLoader, ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, - array_of_strtype, +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27024,10 +27208,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27037,31 +27225,39 @@ 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 +) = _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 = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27070,10 +27266,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27083,37 +27283,45 @@ 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 +) = _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 = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -27124,12 +27332,16 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -27141,72 +27353,82 @@ 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 +) = _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: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _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( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _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( +union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( None_type, FileLoader, @@ -27216,133 +27438,158 @@ 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 +) = _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 +) = _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_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( +union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + None_type, + inttype, + inttype, + ExpressionLoader, + ) +) +WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") +uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( WorkReuse_classLoader, False, True, None, None ) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( +NetworkAccess_classLoader: Final = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" +) +uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( NetworkAccess_classLoader, False, True, None, None ) -InplaceUpdateRequirement_classLoader = _EnumLoader( +InplaceUpdateRequirement_classLoader: Final = _EnumLoader( ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" ) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( InplaceUpdateRequirement_classLoader, False, True, None, None ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( +ToolTimeLimit_classLoader: Final = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" +) +uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( ToolTimeLimit_classLoader, False, True, None, None ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( + inttype, inttype, ExpressionLoader, ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( +union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( ( None_type, InputBindingLoader, ) ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( +ExpressionTool_classLoader: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( +array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( + WorkflowInputParameterLoader +) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( array_of_WorkflowInputParameterLoader, "id", "type" ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( + _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: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _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( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( union_of_None_type_or_array_of_Any_type, "class", "None" ) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -27351,73 +27598,87 @@ 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 +) = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, 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_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + inttype, + ExpressionLoader, + ) +) +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27425,10 +27686,14 @@ 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 +) = _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 +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27450,12 +27715,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) 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 +27740,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 +27760,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 +27781,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 79ce337b..ce3e5ce5 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -205,7 +205,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}" @@ -307,8 +307,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" @@ -391,7 +390,7 @@ def type_for_step_input( 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]: + if 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") diff --git a/cwl_utils/parser/cwl_v1_2.py b/cwl_utils/parser/cwl_v1_2.py index 85f744fc..77a7c937 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 MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ 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"]] +S = TypeVar("S", bound="Saveable") 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 +62,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 +91,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 +133,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 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,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,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,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] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,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 @@ -434,9 +449,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, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( 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 @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( 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 not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,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[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + 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 +564,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, Any]: 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: @@ -584,11 +599,11 @@ 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 doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: 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): +class _RecordLoader(_Loader, Generic[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 +699,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)))}, " @@ -710,19 +726,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, + ) -> 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: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, 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 +848,40 @@ def load( 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 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 = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,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 +917,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 +929,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,8 +943,8 @@ def load( 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 isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( 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 isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,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,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_2" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): 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 +1216,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"): @@ -1376,7 +1375,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,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +1456,14 @@ 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"]) + + +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 +1478,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 +1581,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 +1641,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_: Literal["record"], + 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 +1656,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_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,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"): @@ -1849,7 +1848,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: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,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_: Literal["enum"], + 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 +1928,14 @@ 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"]) + + +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 +1950,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 +2054,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 +2113,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ 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"]) + + +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 +2149,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 +2253,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 +2312,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_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | 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 +2327,13 @@ 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"]) + +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 +2348,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 +2452,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 +2511,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ 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"]) + + +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 +2547,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 +2651,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 +2710,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ 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"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,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"): @@ -2912,7 +2911,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,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,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 | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | 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 +2992,14 @@ 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"]) + + +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 +3014,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 +3117,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,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + 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"]) class File(Saveable): @@ -3250,43 +3269,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 +3311,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 +3669,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 +3852,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 +3965,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 | int = 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] = "https://w3id.org/cwl/cwl#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", @@ -4049,29 +4068,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 +4090,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 +4302,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,37 +4378,70 @@ 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] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class Labeled(Saveable): pass +@trait class Identified(Saveable): pass +@trait class IdentifierRequired(Identified): pass +@trait class LoadContents(Saveable): pass +@trait class FieldBase(Labeled): pass +@trait class InputFormat(Saveable): pass +@trait class OutputFormat(Saveable): pass +@trait class Parameter(FieldBase, Documented, IdentifierRequired): """ Define an input or output parameter to a process. @@ -4423,22 +4452,6 @@ class Parameter(FieldBase, Documented, IdentifierRequired): 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 +4466,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 +4521,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,17 +4579,36 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) - - -class IOSchema(Labeled, Documented): + def __init__( + self, + loadContents: 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 + + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + + +@trait +class IOSchema(Labeled, Documented): pass +@trait class InputSchema(IOSchema): pass +@trait class OutputSchema(IOSchema): pass @@ -4584,38 +4616,6 @@ class OutputSchema(IOSchema): 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, - ) -> 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_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4652,8 +4652,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"): @@ -5093,7 +5093,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 +5118,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5199,7 +5199,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -5217,30 +5249,6 @@ def save( class InputRecordSchema(CWLRecordSchema, InputSchema): 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 +5269,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"): @@ -5514,7 +5522,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,11 +5547,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5589,21 +5597,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_: Literal["record"], + 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 +5615,19 @@ 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"] + ) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5649,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"): @@ -5893,7 +5903,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: @@ -5918,7 +5928,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5967,21 +5977,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_: Literal["enum"], + 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 +5995,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +6029,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"): @@ -6271,7 +6283,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,11 +6308,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -6345,23 +6357,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: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +6375,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.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"] + ) + + +class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6421,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"): @@ -6758,7 +6768,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 +6793,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6848,23 +6858,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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +6878,21 @@ 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"] + ) + + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6914,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"): @@ -7153,7 +7167,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,11 +7192,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7228,21 +7242,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_: Literal["record"], + 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 +7260,19 @@ 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"] + ) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7294,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"): @@ -7532,7 +7548,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: @@ -7557,7 +7573,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -7606,21 +7622,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_: Literal["enum"], + 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 +7640,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7674,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"): @@ -7910,7 +7928,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,11 +7953,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7984,17 +8002,46 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) + def __init__( + self, + items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + 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 + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + 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"] + ) +@trait class InputParameter(Parameter, InputFormat, LoadContents): pass +@trait class OutputParameter(Parameter, OutputFormat): pass +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8009,6 +8056,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Identified, Labeled, Documented): """ @@ -8029,23 +8077,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( @@ -8063,8 +8094,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 +8165,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,9 +8231,27 @@ 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] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@trait class CommandInputSchema(Saveable): pass @@ -8224,23 +8273,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 +8287,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 +8359,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,7 +8422,24 @@ 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] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) class SecondaryFileSchema(Saveable): @@ -8411,24 +8460,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 +8476,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 +8579,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 +8639,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 +8654,18 @@ 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"]) + + +class LoadListingRequirement(ProcessRequirement): + """ + 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 +8683,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 +8754,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 +8820,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: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8814,8 +8834,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8833,8 +8864,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 +8968,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,7 +9028,25 @@ 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): @@ -9040,34 +9089,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 +9121,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 +9458,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 +9555,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int | 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", @@ -9562,28 +9611,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 +9630,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 +9826,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 +9905,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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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 +9922,23 @@ 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"] + ) + + +@trait +class CommandLineBindable(Saveable): + pass + + +class CommandInputRecordField(InputRecordField, CommandLineBindable): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9960,8 +9978,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"): @@ -10448,7 +10466,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 +10491,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10562,7 +10580,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -10583,32 +10635,6 @@ class CommandInputRecordSchema( ): 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 +10665,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"): @@ -10939,7 +10965,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,11 +10990,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11022,22 +11048,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_: Literal["record"], + 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 +11067,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_ 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"] + ) + + +class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11084,8 +11112,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"): @@ -11385,7 +11413,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: @@ -11410,7 +11438,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -11467,24 +11495,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_: Literal["enum"], + 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 +11514,23 @@ 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"] + ) + + +class CommandInputArraySchema( + InputArraySchema, CommandInputSchema, CommandLineBindable +): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11524,8 +11554,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"): @@ -11825,7 +11855,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,11 +11880,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11907,24 +11937,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: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +11956,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.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"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11977,8 +12005,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"): @@ -12371,7 +12399,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 +12424,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12469,7 +12497,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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", @@ -12486,30 +12544,6 @@ def save( 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 +12564,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"): @@ -12783,7 +12817,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,11 +12842,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12858,21 +12892,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_: Literal["record"], + 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 +12910,19 @@ 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"] + ) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12908,8 +12944,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"): @@ -13162,7 +13198,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: @@ -13187,7 +13223,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -13236,21 +13272,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_: Literal["enum"], + 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 +13290,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.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13286,8 +13324,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"): @@ -13540,7 +13578,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,11 +13603,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -13614,31 +13652,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: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + 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 +13670,23 @@ 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"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13700,8 +13728,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"): @@ -14235,7 +14263,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 +14288,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14354,7 +14382,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -14378,36 +14442,6 @@ class CommandOutputParameter(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, - 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 +14476,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"): @@ -14836,7 +14870,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,11 +14895,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, @@ -14934,7 +14968,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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, + 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", @@ -14956,55 +15020,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 +15074,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"): @@ -15893,7 +15908,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: @@ -15918,7 +15933,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -16049,7 +16064,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: Literal["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"] | 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[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = 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] = "https://w3id.org/cwl/cwl#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", @@ -16129,33 +16193,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 +16225,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 +16531,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 +16637,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] = "https://w3id.org/cwl/cwl#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", @@ -16620,23 +16684,6 @@ class SoftwareRequirement(ProcessRequirement): """ - 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 +16698,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 +16770,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 +16833,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 +16847,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16828,8 +16872,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 +17022,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,7 +17086,27 @@ 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"]) class Dirent(Saveable): @@ -17058,26 +17122,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 +17140,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 +17290,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 +17358,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 +17374,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"]) + + +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 __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17354,8 +17401,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 +17473,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 +17536,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 +17550,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17530,8 +17577,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 +17649,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,7 +17712,24 @@ 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] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -17680,21 +17744,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 +17758,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 +17782,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,7 +17838,22 @@ 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] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -17822,37 +17886,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 +17922,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 +17951,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 +17998,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 +18045,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 +18092,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 +18139,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 +18186,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 +18233,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 +18280,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 +18322,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 +18432,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | float | int | str = None, + coresMax: None | float | int | str = None, + ramMin: None | float | int | str = None, + ramMax: None | float | int | str = None, + tmpdirMin: None | float | int | str = None, + tmpdirMax: None | float | int | str = None, + outdirMin: None | float | int | str = None, + outdirMax: None | float | int | 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] = "https://w3id.org/cwl/cwl#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", @@ -18428,23 +18492,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 +18508,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 +18580,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,7 +18646,24 @@ 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] = "https://w3id.org/cwl/cwl#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -18622,23 +18686,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 +18703,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 +18775,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,7 +18841,24 @@ 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] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) class InplaceUpdateRequirement(ProcessRequirement): @@ -18832,23 +18896,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 +18913,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 +18985,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,7 +19051,24 @@ 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] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) class ToolTimeLimit(ProcessRequirement): @@ -19019,23 +19083,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( @@ -19052,8 +19099,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 +19129,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 +19171,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 +19237,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: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19216,13 +19251,14 @@ 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] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +class ExpressionToolOutputParameter(OutputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19256,8 +19292,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"): @@ -19603,7 +19639,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,11 +19664,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -19693,29 +19729,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_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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 +19753,17 @@ 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"] + ) + + +class WorkflowInputParameter(InputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19777,8 +19805,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"): @@ -20312,7 +20340,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 +20365,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20431,7 +20459,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -20462,41 +20526,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 +20566,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"): @@ -21043,7 +21072,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: @@ -21068,7 +21097,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -21155,7 +21184,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21186,40 +21250,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 +21288,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"): @@ -21746,7 +21776,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 +21801,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21850,7 +21880,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["merge_nested", "merge_flattened"] | None = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | 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.pickValue = pickValue + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -21866,6 +21930,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -21985,38 +22050,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 +22086,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"): @@ -22493,7 +22526,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: @@ -22518,7 +22551,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), source=source, linkMerge=linkMerge, pickValue=pickValue, @@ -22593,7 +22626,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -22623,22 +22688,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 +22702,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"): @@ -22717,7 +22766,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22740,7 +22789,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -22770,7 +22819,23 @@ 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): @@ -22848,53 +22913,17 @@ class WorkflowStep(IdentifierRequired, Labeled, Documented): # Subworkflows - To specify a nested workflow as part of a workflow step, - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be - specified in the workflow or workflow step requirements. - - It is a fatal error if a workflow directly or indirectly invokes itself as - a subworkflow (recursive workflows are not allowed). - - """ - - 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 - + To specify a nested workflow as part of a workflow step, + [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be + specified in the workflow or workflow step requirements. + + It is a fatal error if a workflow directly or indirectly invokes itself as + a subworkflow (recursive workflows are not allowed). + + """ + + id: str + def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -22935,8 +22964,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"): @@ -23474,7 +23503,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: @@ -23499,7 +23528,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, in_=in_, @@ -23580,7 +23609,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: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | 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 + 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", @@ -23655,41 +23720,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 +23760,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"): @@ -24236,7 +24266,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: @@ -24261,7 +24291,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -24345,7 +24375,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -24369,21 +24434,6 @@ class SubworkflowFeatureRequirement(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_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -24398,8 +24448,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 +24472,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 +24528,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 +24541,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + 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 +24567,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 +24591,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 +24647,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 +24660,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = 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 __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24636,8 +24686,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 +24710,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 +24766,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 +24779,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + 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 +24805,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 +24829,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 +24885,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 +24898,18 @@ 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] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class OperationInputParameter(InputParameter): + """ + Describe an input parameter of an operation. + + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OperationInputParameter): @@ -24918,8 +24949,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"): @@ -25406,7 +25437,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 +25462,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -25517,7 +25548,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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: Literal["no_listing", "shallow_listing", "deep_listing"] | 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", @@ -25541,34 +25606,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 +25638,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"): @@ -25948,7 +25985,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,11 +26010,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -26038,7 +26075,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | 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"] ) @@ -26057,39 +26122,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 +26160,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"): @@ -26586,7 +26618,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: @@ -26611,7 +26643,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -26690,7 +26722,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: Literal["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"] | 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] = "https://w3id.org/cwl/cwl#Operation" + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -26707,23 +26772,6 @@ 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 - def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -26738,8 +26786,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 +26858,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 +26920,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 +26934,14 @@ 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] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -26953,8 +26983,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"): @@ -27461,7 +27491,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: @@ -27486,7 +27516,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -27569,7 +27599,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter], + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter], + 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: Literal["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"] | 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] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -27592,23 +27657,6 @@ class MPIRequirement(ProcessRequirement): """ - 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 +27673,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 +27745,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 +27811,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: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -27789,11 +27825,17 @@ 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] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -27823,8 +27865,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 +28079,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 +28169,30 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | int | str = None, + cudaDeviceCountMin: None | int | 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] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "cudaComputeCapability", @@ -28141,32 +28206,6 @@ def save( 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 +28236,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"): @@ -28496,7 +28535,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 +28560,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), default=default, - id=id, linkMerge=linkMerge, loopSource=loopSource, pickValue=pickValue, @@ -28575,7 +28614,33 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + default: Any | None = None, + id: None | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + loopSource: None | Sequence[str] | str = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | 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.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"] ) @@ -28597,27 +28662,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 +28681,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 +28849,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 +28925,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: Literal["last", "all"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -28899,9 +28941,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#Loop" + self.loop = loop + self.loopWhen = loopWhen + self.outputMethod = outputMethod + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "loop", "loopWhen", "outputMethod"] + ) + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -28916,8 +28966,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 +29038,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 +29101,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] = "http://commonwl.org/cwltool#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", @@ -29206,8 +29273,8 @@ def save( "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", @@ -29359,15 +29426,15 @@ def save( "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 = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -29393,17 +29460,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _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 = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -29422,55 +29489,65 @@ 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( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "None", None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, 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( +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, 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( +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +LoopLoader: Final = _RecordLoader(Loop, None, None) +ShmSizeLoader: Final = _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 +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -29496,24 +29573,32 @@ 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 +) = _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 +) = _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 +) = _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( +CWLInputFileLoader: Final = ( + 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: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -29541,7 +29626,7 @@ def save( """ Version symbols for published CWL document versions. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -29557,31 +29642,45 @@ 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") +ExpressionLoader: Final = _ExpressionLoader(str) +InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdinLoader: Final = _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 +29702,7 @@ def save( stdin: $(inputs.an_input_name.path) ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29651,7 +29750,7 @@ def save( (e.g. `echo a && echo b`) `stdout` must include the output of every command. """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29695,15 +29794,15 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -29713,7 +29812,7 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -PickValueMethodLoader = _EnumLoader( +PickValueMethodLoader: Final = _EnumLoader( ( "first_non_null", "the_only_non_null", @@ -29724,10 +29823,12 @@ 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 = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -29738,23 +29839,29 @@ 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 = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +OperationInputParameterLoader: Final = _RecordLoader( + OperationInputParameter, None, None +) +OperationOutputParameterLoader: Final = _RecordLoader( + OperationOutputParameter, None, None +) +OperationLoader: Final = _RecordLoader(Operation, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +LoopInputLoader: Final = _RecordLoader(LoopInput, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _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 = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29765,10 +29872,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29780,51 +29891,57 @@ 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 +) = _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 = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _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 = _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_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _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 +) = _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_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29833,10 +29950,14 @@ 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 +) = _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 +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29846,57 +29967,66 @@ 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 +) = _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 +) = _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 = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _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( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _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 = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _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 +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -29904,34 +30034,38 @@ 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( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _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: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _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 +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -29939,32 +30073,40 @@ 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( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + 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 +) = _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( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29973,10 +30115,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29986,29 +30132,35 @@ 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 +) = _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 = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _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( +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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30017,10 +30169,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30030,44 +30186,56 @@ 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 +) = _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 = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _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" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _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( +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 +) = _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 +) = _UnionLoader( ( CommandInputParameterLoader, WorkflowInputParameterLoader, OperationInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _ArrayLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( + Final +) = _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 +) = _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 +) = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, @@ -30075,26 +30243,36 @@ 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 +) = _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 +) = _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 +) = _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 +) = _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 +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -30121,107 +30299,121 @@ 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 +) = _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 +) = _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 +) = _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( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -uri_union_of_None_type_or_array_of_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final = _URILoader( union_of_None_type_or_array_of_strtype, True, False, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( +LoadListingRequirement_classLoader: Final = _EnumLoader( ("LoadListingRequirement",), "LoadListingRequirement_class" ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( +uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( LoadListingRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, ExpressionLoader, ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, - array_of_strtype, +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30230,10 +30422,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30243,31 +30439,39 @@ 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 +) = _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 = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30276,10 +30480,14 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30289,37 +30497,45 @@ 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 +) = _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 = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -30330,12 +30546,16 @@ 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 +) = _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 +) = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -30347,72 +30567,82 @@ 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 +) = _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: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _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( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _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( +union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _UnionLoader( ( None_type, DirentLoader, @@ -30422,147 +30652,167 @@ 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 +) = _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 +) = _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_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - inttype, - floattype, - ExpressionLoader, +union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + inttype, + inttype, + floattype, + ExpressionLoader, + ) ) ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( +WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") +uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( WorkReuse_classLoader, False, True, None, None ) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( +NetworkAccess_classLoader: Final = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" +) +uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( NetworkAccess_classLoader, False, True, None, None ) -InplaceUpdateRequirement_classLoader = _EnumLoader( +InplaceUpdateRequirement_classLoader: Final = _EnumLoader( ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" ) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( InplaceUpdateRequirement_classLoader, False, True, None, None ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( +ToolTimeLimit_classLoader: Final = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" +) +uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( ToolTimeLimit_classLoader, False, True, None, None ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( + inttype, inttype, ExpressionLoader, ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( +union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( ( None_type, InputBindingLoader, ) ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( +ExpressionTool_classLoader: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( +array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( + WorkflowInputParameterLoader +) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( array_of_WorkflowInputParameterLoader, "id", "type" ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -union_of_None_type_or_PickValueMethodLoader = _UnionLoader( +union_of_None_type_or_PickValueMethodLoader: Final = _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 = ( + _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: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _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( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _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( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -30572,102 +30822,120 @@ 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 +) = _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 +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, False, True, None, None ) -Operation_classLoader = _EnumLoader(("Operation",), "Operation_class") -uri_Operation_classLoader_False_True_None_None = _URILoader( +Operation_classLoader: Final = _EnumLoader(("Operation",), "Operation_class") +uri_Operation_classLoader_False_True_None_None: Final = _URILoader( Operation_classLoader, False, True, None, None ) -array_of_OperationInputParameterLoader = _ArrayLoader(OperationInputParameterLoader) -idmap_inputs_array_of_OperationInputParameterLoader = _IdMapLoader( +array_of_OperationInputParameterLoader: Final = _ArrayLoader( + OperationInputParameterLoader +) +idmap_inputs_array_of_OperationInputParameterLoader: Final = _IdMapLoader( array_of_OperationInputParameterLoader, "id", "type" ) -array_of_OperationOutputParameterLoader = _ArrayLoader(OperationOutputParameterLoader) -idmap_outputs_array_of_OperationOutputParameterLoader = _IdMapLoader( +array_of_OperationOutputParameterLoader: Final = _ArrayLoader( + OperationOutputParameterLoader +) +idmap_outputs_array_of_OperationOutputParameterLoader: Final = _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_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + inttype, + ExpressionLoader, + ) +) +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_None_type_or_Any_type = _UnionLoader( +union_of_None_type_or_Any_type: Final = _UnionLoader( ( None_type, Any_type, ) ) -array_of_LoopInputLoader = _ArrayLoader(LoopInputLoader) -idmap_loop_array_of_LoopInputLoader = _IdMapLoader( +array_of_LoopInputLoader: Final = _ArrayLoader(LoopInputLoader) +idmap_loop_array_of_LoopInputLoader: Final = _IdMapLoader( array_of_LoopInputLoader, "id", "loopSource" ) -LoopOutputModesLoader = _EnumLoader( +LoopOutputModesLoader: Final = _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 +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30676,10 +30944,14 @@ 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 +) = _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 +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30702,12 +30974,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) 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 +30999,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 +31019,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 +31040,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 e40f5877..a8f37256 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -247,7 +247,7 @@ def check_all_types( items=src_typ, type_="array" ) 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}" @@ -388,8 +388,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" @@ -472,7 +471,7 @@ def type_for_step_input( 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]: + if 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") diff --git a/cwl_utils/parser/utils.py b/cwl_utils/parser/utils.py index 6849afd9..18ff4270 100644 --- a/cwl_utils/parser/utils.py +++ b/cwl_utils/parser/utils.py @@ -159,9 +159,7 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: 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_ } ) @@ -482,12 +480,7 @@ def param_for_source_id( ) 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, - ), + process, sourcenames, cast(cwl_utils.parser.cwl_v1_2.Workflow, parent), scatter_context, diff --git a/cwl_utils/tests/test_parser_utils.py b/cwl_utils/tests/test_parser_utils.py index d4d24fa7..16d900b8 100644 --- a/cwl_utils/tests/test_parser_utils.py +++ b/cwl_utils/tests/test_parser_utils.py @@ -163,6 +163,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 @@ -195,6 +196,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 @@ -208,6 +210,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 @@ -240,6 +243,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 @@ -469,6 +473,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 @@ -501,6 +506,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 @@ -514,6 +520,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 @@ -546,6 +553,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 @@ -819,6 +827,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 @@ -851,6 +860,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 @@ -864,6 +874,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 @@ -896,6 +907,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 2f7d4d50..48a68c98 100644 --- a/cwl_utils/tests/test_subscope.py +++ b/cwl_utils/tests/test_subscope.py @@ -1,8 +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 @@ -11,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") @@ -18,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") @@ -25,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") From 9fbb611f70f23ae1c61b522a94518093f6782dc1 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 19 Dec 2025 17:29:29 +0100 Subject: [PATCH 02/16] WIP expression_refactor type fixes --- cwl_utils/cwl_v1_0_expression_refactor.py | 1010 ++++++++++++++++----- cwl_utils/parser/cwl_v1_0_utils.py | 16 +- 2 files changed, 795 insertions(+), 231 deletions(-) diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index 80ea51b3..539b7239 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -7,7 +7,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, cast +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -55,33 +55,111 @@ 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: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None +) +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] | None +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + 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 isinstance(result, Sequence): + 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 isinstance(field, Sequence): + 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 +214,439 @@ def get_expression( return None +def _plain_input_type_to_clt_input( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + 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_type_to_clt_input( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(input_type, Sequence): + return [ + _plain_input_type_to_clt_input(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_type_to_clt_input(input_type) + + +def _plain_input_type_to_plain_output( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + 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_type_to_plain_output( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(input_type, Sequence): + return [ + _plain_input_type_to_plain_output(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_type_to_plain_output(input_type) + + +def _plain_output_type_to_clt_output( + output_type: ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + 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( + output_type: ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(output_type, Sequence): + return [ + _plain_output_type_to_clt_output(output_type_item) + for output_type_item in output_type + ] + if output_type is None: + return None + return _plain_output_type_to_clt_output(output_type) + + +def parameters_to_plain_input_paramaters( + parameters: Sequence[ + cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.InputParameter]: + return [ + cwl.InputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -151,7 +662,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_type_to_clt_input(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -166,7 +677,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -337,16 +848,20 @@ def generate_etool_from_expr( if not no_inputs: if not self_type: 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_) + new_type: InputTypeSchemas + if isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + 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", @@ -382,8 +897,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_type_to_plain_output(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -412,18 +927,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): + for inp in cast(list[cwl.InputParameter], 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 @@ -432,7 +953,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: """ @@ -484,14 +1009,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( @@ -529,19 +1056,22 @@ def empty_inputs( """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 @@ -618,33 +1148,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 @@ -689,7 +1208,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -710,7 +1229,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: @@ -719,7 +1240,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 ) @@ -744,7 +1265,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 ), @@ -765,18 +1286,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, @@ -786,17 +1307,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="", @@ -806,7 +1329,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( @@ -817,38 +1340,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, @@ -858,24 +1381,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, @@ -884,10 +1407,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: @@ -902,14 +1427,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: @@ -920,15 +1449,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: @@ -940,32 +1473,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, @@ -1001,7 +1541,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 ) @@ -1014,9 +1554,11 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + new_requirements = list(target_process.requirements) + new_requirements[req_index][ env_index ].envValue = f"$(inputs._envDef{env_index})" + target_process.requirements = new_requirements generated_envVar_reqs.append((etool_id, env_index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -1025,7 +1567,7 @@ 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 ) @@ -1054,7 +1596,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 ) @@ -1083,15 +1625,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 = ( @@ -1114,25 +1656,25 @@ def process_level_reqs( 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} ; @@ -1148,7 +1690,7 @@ 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( @@ -1171,14 +1713,14 @@ def process_level_reqs( 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( @@ -1255,7 +1797,7 @@ 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 ) @@ -1281,7 +1823,7 @@ 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 ) @@ -1307,7 +1849,7 @@ 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 ) @@ -1347,7 +1889,7 @@ def traverse_CommandLineTool( 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) + target = cwl.InputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) @@ -1384,7 +1926,7 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) etool = generate_etool_from_expr( @@ -1657,7 +2199,7 @@ 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. @@ -1700,7 +2242,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 +2262,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_type_to_plain_output(target.type_), ) ) expression = "${" @@ -1730,19 +2278,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 +2327,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 +2349,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 isinstance(scattered_source_type, list): + 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 +2387,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 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="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1865,9 +2419,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 +2440,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,7 +2466,7 @@ def traverse_step( def workflow_step_to_InputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str ) -> list[cwl.InputParameter | cwl.CommandOutputParameter]: """Create InputParameters to match the given WorkflowStep inputs.""" params = [] @@ -1948,8 +2505,10 @@ 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: ( @@ -1989,7 +2548,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 +2556,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 +2576,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 +2587,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2060,7 +2620,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/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index 4a9a82ff..cedea06a 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 from io import StringIO from pathlib import Path -from typing import Any, IO, cast +from typing import IO, Any, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -415,8 +415,10 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, ) -> Any: @@ -466,8 +468,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 1ed986c445267286a5495041f10a537429d1da0a Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 19 Dec 2025 22:22:15 +0100 Subject: [PATCH 03/16] Fix typing errors in utils --- cwl_utils/parser/cwl_v1_0_utils.py | 26 ++++-- cwl_utils/parser/cwl_v1_1_utils.py | 12 ++- cwl_utils/parser/cwl_v1_2_utils.py | 22 ++++-- cwl_utils/parser/utils.py | 123 +++++++++++++++++------------ cwl_utils/utils.py | 21 ++++- 5 files changed, 134 insertions(+), 70 deletions(-) diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index cedea06a..d9127536 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import Any, IO, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -181,7 +181,7 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -197,7 +197,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if isinstance(sourceField, Sequence): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -475,14 +475,26 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.InputParameter - | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + | MutableSequence[ + cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + ] ): """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.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): for param in process.inputs: diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index ce3e5ce5..77d73e41 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -2,7 +2,7 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path from typing import Any, IO, cast @@ -181,7 +181,7 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -197,7 +197,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if isinstance(sourceField, Sequence): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -489,11 +489,15 @@ def param_for_source_id( ) -> ( cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter | MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" @@ -502,7 +506,9 @@ def param_for_source_id( params: MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index a8f37256..143ba6f3 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -2,7 +2,7 @@ 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 Any, IO, cast @@ -83,7 +83,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 +93,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: @@ -200,8 +200,8 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - param_to_step: dict[str, cwl.WorkflowStep], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + param_to_step: Mapping[str, cwl.WorkflowStep], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -220,7 +220,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if isinstance(sourceField, Sequence): linkMerge: str | None = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -578,11 +578,19 @@ def param_for_source_id( ) -> ( cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter | MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" @@ -591,7 +599,9 @@ def param_for_source_id( params: MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/cwl_utils/parser/utils.py b/cwl_utils/parser/utils.py index 18ff4270..9c4a2c4b 100644 --- a/cwl_utils/parser/utils.py +++ b/cwl_utils/parser/utils.py @@ -2,19 +2,19 @@ import copy import logging -from collections.abc import MutableSequence +from collections.abc import MutableMapping, MutableSequence from pathlib import Path from types import ModuleType -from typing import Any, Optional, cast +from typing import Any, Final, Optional, cast 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 ( +from cwl_utils.parser import ( + CommandLineTool, + ExpressionTool, LoadingOptions, Process, Workflow, @@ -26,6 +26,7 @@ cwl_v1_1_utils, cwl_v1_2, cwl_v1_2_utils, + load_document_by_uri, ) _logger = logging.getLogger("cwl_utils") @@ -133,10 +134,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, @@ -147,12 +148,12 @@ def load_step( return cast(Process, copy.deepcopy(step.run)) -def static_checker(workflow: cwl_utils.parser.Workflow) -> None: +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 = {} + param_to_step: Final[MutableMapping[str, WorkflowStep]] = {} for step in workflow.steps: if step.in_ is not None: step_inputs.extend(step.in_) @@ -208,26 +209,36 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: case "v1.0": parser = cwl_v1_0 step_inputs_val = cwl_v1_0_utils.check_all_types( - src_dict, step_inputs, type_dict + 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 + src_dict, cast(cwl_v1_0.Workflow, 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 + 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 + src_dict, cast(cwl_v1_1.Workflow, 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 + 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 + 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}") @@ -415,74 +426,86 @@ def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) - 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_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.InputParameter + | cwl_v1_0.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_0.InputParameter - | cwl_utils.parser.cwl_v1_0.CommandOutputParameter + | cwl_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.InputParameter + | cwl_v1_0.WorkflowOutputParameter ) | ( MutableSequence[ - cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter + cwl_v1_1.CommandInputParameter + | cwl_v1_1.CommandOutputParameter + | cwl_v1_1.ExpressionToolOutputParameter + | cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.CommandInputParameter + | cwl_v1_1.CommandOutputParameter + | cwl_v1_1.ExpressionToolOutputParameter + | cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.WorkflowOutputParameter ) | ( MutableSequence[ - cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter + cwl_v1_2.CommandInputParameter + | cwl_v1_2.CommandOutputParameter + | cwl_v1_2.ExpressionToolOutputParameter + | cwl_v1_2.OperationInputParameter + | cwl_v1_2.OperationOutputParameter + | cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.CommandInputParameter + | cwl_v1_2.CommandOutputParameter + | cwl_v1_2.ExpressionToolOutputParameter + | cwl_v1_2.OperationInputParameter + | cwl_v1_2.OperationOutputParameter + | cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.WorkflowOutputParameter ) ): match process.cwlVersion: case "v1.0": - return cwl_utils.parser.cwl_v1_0_utils.param_for_source_id( + return 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, + cwl_v1_0.CommandLineTool + | cwl_v1_0.Workflow + | cwl_v1_0.ExpressionTool, 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( + return 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, + cwl_v1_1.CommandLineTool + | cwl_v1_1.Workflow + | cwl_v1_1.ExpressionTool, 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( + 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: diff --git a/cwl_utils/utils.py b/cwl_utils/utils.py index a535fcfb..43e382a3 100644 --- a/cwl_utils/utils.py +++ b/cwl_utils/utils.py @@ -6,11 +6,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 @@ -380,11 +380,24 @@ 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.InputArraySchema + | cwl_v1_2.InputEnumSchema + | cwl_v1_2.InputRecordSchema + | Sequence[ + str + | cwl_v1_2.InputArraySchema + | cwl_v1_2.InputEnumSchema + | cwl_v1_2.InputRecordSchema, + ], + rest.get("items", ""), + ), ) case {"type": {"$import": _}}: pass # Leave import as is From 36f153221416fa434e65503fc65cf05eb2a62eab Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 19 Dec 2025 22:55:37 +0100 Subject: [PATCH 04/16] Regenerate parsers with native ints --- cwl_utils/parser/cwl_v1_0.py | 120 ++++++++++++------------ cwl_utils/parser/cwl_v1_0_utils.py | 18 ++-- cwl_utils/parser/cwl_v1_1.py | 138 ++++++++++++++-------------- cwl_utils/parser/cwl_v1_1_utils.py | 18 ++-- cwl_utils/parser/cwl_v1_2.py | 142 +++++++++++++++-------------- cwl_utils/parser/cwl_v1_2_utils.py | 60 ++++++------ 6 files changed, 251 insertions(+), 245 deletions(-) diff --git a/cwl_utils/parser/cwl_v1_0.py b/cwl_utils/parser/cwl_v1_0.py index 4aedf527..165e94df 100644 --- a/cwl_utils/parser/cwl_v1_0.py +++ b/cwl_utils/parser/cwl_v1_0.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,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)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,12 +4407,12 @@ def __init__( @trait -class SchemaBase(Saveable): +class SchemaBase(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(SchemaBase): +class Parameter(SchemaBase, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4422,22 +4422,22 @@ class Parameter(SchemaBase): @trait -class InputBinding(Saveable): +class InputBinding(Saveable, metaclass=ABCMeta): pass @trait -class OutputBinding(Saveable): +class OutputBinding(Saveable, metaclass=ABCMeta): pass @trait -class InputSchema(SchemaBase): +class InputSchema(SchemaBase, metaclass=ABCMeta): pass @trait -class OutputSchema(SchemaBase): +class OutputSchema(SchemaBase, metaclass=ABCMeta): pass @@ -8281,7 +8281,7 @@ def __init__( @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8296,7 +8296,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Saveable): +class Process(Saveable, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8484,7 +8484,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8665,7 +8665,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -9389,7 +9389,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int = None, + position: None | i32 = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -14687,9 +14687,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = 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: @@ -14709,7 +14709,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -15243,7 +15243,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -15434,7 +15434,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -16132,7 +16132,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -16308,7 +16308,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -16433,7 +16433,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -17011,14 +17011,14 @@ def save( def __init__( self, - coresMin: None | int | str = None, - coresMax: None | int | str = None, - ramMin: None | int | str = None, - ramMax: None | int | str = None, - tmpdirMin: None | int | str = None, - tmpdirMax: None | int | str = None, - outdirMin: None | int | str = None, - outdirMax: None | int | str = None, + 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: @@ -17030,7 +17030,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18270,7 +18270,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -18982,7 +18982,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -20995,7 +20995,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -21128,7 +21128,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21247,7 +21247,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21366,7 +21366,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21485,7 +21485,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21659,7 +21659,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -21835,7 +21835,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -22004,7 +22004,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -22175,7 +22175,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22187,7 +22187,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#TimeLimit" + self.class_: Final[str] = "TimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -22375,7 +22375,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -22570,7 +22570,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -23210,7 +23210,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -23391,7 +23391,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23403,7 +23403,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -23751,8 +23751,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23764,7 +23764,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -23945,7 +23945,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -24197,11 +24197,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -25549,6 +25550,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -25558,7 +25560,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index d9127536..974abcab 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -195,16 +195,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, Sequence): - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - else: + if isinstance(sourceField, str): parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -212,6 +205,13 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None + else: + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], diff --git a/cwl_utils/parser/cwl_v1_1.py b/cwl_utils/parser/cwl_v1_1.py index d03c8932..7397d3a5 100644 --- a/cwl_utils/parser/cwl_v1_1.py +++ b/cwl_utils/parser/cwl_v1_1.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,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)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,42 +4407,42 @@ def __init__( @trait -class Labeled(Saveable): +class Labeled(Saveable, metaclass=ABCMeta): pass @trait -class Identified(Saveable): +class Identified(Saveable, metaclass=ABCMeta): pass @trait -class IdentifierRequired(Identified): +class IdentifierRequired(Identified, metaclass=ABCMeta): pass @trait -class LoadContents(Saveable): +class LoadContents(Saveable, metaclass=ABCMeta): pass @trait -class FieldBase(Labeled): +class FieldBase(Labeled, metaclass=ABCMeta): pass @trait -class InputFormat(Saveable): +class InputFormat(Saveable, metaclass=ABCMeta): pass @trait -class OutputFormat(Saveable): +class OutputFormat(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(FieldBase, Documented, IdentifierRequired): +class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4599,17 +4599,17 @@ def __init__( @trait -class IOSchema(Labeled, Documented): +class IOSchema(Labeled, Documented, metaclass=ABCMeta): pass @trait -class InputSchema(IOSchema): +class InputSchema(IOSchema, metaclass=ABCMeta): pass @trait -class OutputSchema(IOSchema): +class OutputSchema(IOSchema, metaclass=ABCMeta): pass @@ -8032,17 +8032,17 @@ def __init__( @trait -class InputParameter(Parameter, InputFormat, LoadContents): +class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): pass @trait -class OutputParameter(Parameter, OutputFormat): +class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): pass @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8057,7 +8057,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Identified, Labeled, Documented): +class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8245,14 +8245,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @trait -class CommandInputSchema(Saveable): +class CommandInputSchema(Saveable, metaclass=ABCMeta): pass @@ -8431,7 +8431,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8812,7 +8812,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9536,7 +9536,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int | str = None, + position: None | i32 | str = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -9911,7 +9911,7 @@ def __init__( @trait -class CommandLineBindable(Saveable): +class CommandLineBindable(Saveable, metaclass=ABCMeta): pass @@ -16004,9 +16004,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = 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: @@ -16026,7 +16026,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -16578,7 +16578,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -16769,7 +16769,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17467,7 +17467,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17643,7 +17643,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17768,7 +17768,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -18346,14 +18346,14 @@ def save( def __init__( self, - coresMin: None | int | str = None, - coresMax: None | int | str = None, - ramMin: None | int | str = None, - ramMax: None | int | str = None, - tmpdirMin: None | int | str = None, - tmpdirMax: None | int | str = None, - outdirMin: None | int | str = None, - outdirMax: None | int | str = None, + 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: @@ -18365,7 +18365,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18572,7 +18572,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18767,7 +18767,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -18977,7 +18977,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19151,7 +19151,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19163,7 +19163,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.class_: Final[str] = "ToolTimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -21073,7 +21073,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -21727,7 +21727,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -23939,7 +23939,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -24072,7 +24072,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24191,7 +24191,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24310,7 +24310,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24429,7 +24429,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24597,7 +24597,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -25239,7 +25239,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -25420,7 +25420,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25432,7 +25432,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -25780,8 +25780,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25793,7 +25793,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -25974,7 +25974,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -26254,11 +26254,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -27707,6 +27708,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -27716,7 +27718,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 77d73e41..031c07e1 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -195,16 +195,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, Sequence): - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - else: + if isinstance(sourceField, str): parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -212,6 +205,13 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None + else: + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], diff --git a/cwl_utils/parser/cwl_v1_2.py b/cwl_utils/parser/cwl_v1_2.py index 77a7c937..25d55219 100644 --- a/cwl_utils/parser/cwl_v1_2.py +++ b/cwl_utils/parser/cwl_v1_2.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,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)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,42 +4407,42 @@ def __init__( @trait -class Labeled(Saveable): +class Labeled(Saveable, metaclass=ABCMeta): pass @trait -class Identified(Saveable): +class Identified(Saveable, metaclass=ABCMeta): pass @trait -class IdentifierRequired(Identified): +class IdentifierRequired(Identified, metaclass=ABCMeta): pass @trait -class LoadContents(Saveable): +class LoadContents(Saveable, metaclass=ABCMeta): pass @trait -class FieldBase(Labeled): +class FieldBase(Labeled, metaclass=ABCMeta): pass @trait -class InputFormat(Saveable): +class InputFormat(Saveable, metaclass=ABCMeta): pass @trait -class OutputFormat(Saveable): +class OutputFormat(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(FieldBase, Documented, IdentifierRequired): +class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4599,17 +4599,17 @@ def __init__( @trait -class IOSchema(Labeled, Documented): +class IOSchema(Labeled, Documented, metaclass=ABCMeta): pass @trait -class InputSchema(IOSchema): +class InputSchema(IOSchema, metaclass=ABCMeta): pass @trait -class OutputSchema(IOSchema): +class OutputSchema(IOSchema, metaclass=ABCMeta): pass @@ -8032,17 +8032,17 @@ def __init__( @trait -class InputParameter(Parameter, InputFormat, LoadContents): +class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): pass @trait -class OutputParameter(Parameter, OutputFormat): +class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): pass @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8057,7 +8057,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Identified, Labeled, Documented): +class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8245,14 +8245,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @trait -class CommandInputSchema(Saveable): +class CommandInputSchema(Saveable, metaclass=ABCMeta): pass @@ -8436,7 +8436,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8834,7 +8834,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9558,7 +9558,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int | str = None, + position: None | i32 | str = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -9933,7 +9933,7 @@ def __init__( @trait -class CommandLineBindable(Saveable): +class CommandLineBindable(Saveable, metaclass=ABCMeta): pass @@ -16080,9 +16080,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = 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: @@ -16103,7 +16103,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -16656,7 +16656,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -16847,7 +16847,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17550,7 +17550,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17726,7 +17726,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17851,7 +17851,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -18434,14 +18434,14 @@ def save( def __init__( self, - coresMin: None | float | int | str = None, - coresMax: None | float | int | str = None, - ramMin: None | float | int | str = None, - ramMax: None | float | int | str = None, - tmpdirMin: None | float | int | str = None, - tmpdirMax: None | float | int | str = None, - outdirMin: None | float | int | str = None, - outdirMax: None | float | int | str = None, + 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: @@ -18453,7 +18453,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18660,7 +18660,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18855,7 +18855,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -19065,7 +19065,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19239,7 +19239,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19251,7 +19251,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.class_: Final[str] = "ToolTimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -21216,7 +21216,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -21931,7 +21931,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -24407,7 +24407,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -24541,7 +24541,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24660,7 +24660,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24779,7 +24779,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24898,7 +24898,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -26753,7 +26753,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Operation" + self.class_: Final[str] = "Operation" attrs: ClassVar[Collection[str]] = frozenset( [ @@ -26934,7 +26934,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -27631,7 +27631,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -27813,7 +27813,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -27825,7 +27825,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -28173,8 +28173,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -28186,7 +28186,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -28941,7 +28941,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Loop" + self.class_: Final[str] = "Loop" self.loop = loop self.loopWhen = loopWhen self.outputMethod = outputMethod @@ -29115,7 +29115,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -29429,11 +29429,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -30966,6 +30967,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -30975,7 +30977,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index 143ba6f3..8262c188 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -218,35 +218,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, Sequence): - linkMerge: str | None = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - if sink.pickValue in ("first_non_null", "the_only_non_null"): - linkMerge = None - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - if ( - _is_conditional_step(param_to_step, parm_id) - and sink.pickValue is not None - ): - validation["warning"].append( - SrcSink( - src_dict[parm_id], - sink, - linkMerge, - message="Source is from conditional step, but pickValue is not used", - ) - ) - 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" - ) - else: + if isinstance(sourceField, str): parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -269,8 +243,8 @@ def check_all_types( 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 + not isinstance(snk_typ, MutableSequence) + or "null" not in snk_typ ): validation["warning"].append( SrcSink( @@ -286,6 +260,32 @@ def check_all_types( type_dict[src_dict[parm_id].id] = cwl.ArraySchema( items=src_typ, type_="array" ) + else: + linkMerge: str | None = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + if sink.pickValue in ("first_non_null", "the_only_non_null"): + linkMerge = None + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] + if ( + _is_conditional_step(param_to_step, parm_id) + and sink.pickValue is not None + ): + validation["warning"].append( + SrcSink( + src_dict[parm_id], + sink, + linkMerge, + message="Source is from conditional step, but pickValue is not used", + ) + ) + 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)], From 085d3366171cc0570e6973f95c94937ba50a0c47 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 12:02:03 +0100 Subject: [PATCH 05/16] ProcessGenerator schema improvement --- cwl_utils/parser/cwl_v1_0.py | 4 ++-- cwl_utils/parser/cwl_v1_1.py | 8 ++++---- cwl_utils/parser/cwl_v1_2.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cwl_utils/parser/cwl_v1_0.py b/cwl_utils/parser/cwl_v1_0.py index 165e94df..406bcd7d 100644 --- a/cwl_utils/parser/cwl_v1_0.py +++ b/cwl_utils/parser/cwl_v1_0.py @@ -22751,7 +22751,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") @@ -23183,7 +23183,7 @@ def save( def __init__( self, inputs: Sequence[InputParameter], - outputs: Sequence[OutputParameter], + 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, diff --git a/cwl_utils/parser/cwl_v1_1.py b/cwl_utils/parser/cwl_v1_1.py index 7397d3a5..0f4004c0 100644 --- a/cwl_utils/parser/cwl_v1_1.py +++ b/cwl_utils/parser/cwl_v1_1.py @@ -24824,7 +24824,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") @@ -24872,7 +24872,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") @@ -25211,8 +25211,8 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter | WorkflowInputParameter], - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter], + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, id: None | str = None, label: None | str = None, diff --git a/cwl_utils/parser/cwl_v1_2.py b/cwl_utils/parser/cwl_v1_2.py index 25d55219..167ed57b 100644 --- a/cwl_utils/parser/cwl_v1_2.py +++ b/cwl_utils/parser/cwl_v1_2.py @@ -27163,7 +27163,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") @@ -27211,7 +27211,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") @@ -27601,8 +27601,8 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter], - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter], + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, id: None | str = None, label: None | str = None, From a94d5f508044b06eab4d507aaa90b34d2675bf3d Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 11:38:47 +0100 Subject: [PATCH 06/16] finish type fixing cwl_v1_0_expression_refactor --- cwl_utils/cwl_v1_0_expression_refactor.py | 797 +++++++++------------- cwl_utils/parser/cwl_v1_0_utils.py | 2 +- cwl_utils/parser/cwl_v1_1_utils.py | 2 +- cwl_utils/parser/cwl_v1_2_utils.py | 10 +- 4 files changed, 341 insertions(+), 470 deletions(-) diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index 539b7239..72981e52 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -75,6 +75,46 @@ def escape_expression_field(contents: str) -> str: InputTypeSchemas: TypeAlias = ( BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None ) +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] | None +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] | None +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -214,41 +254,9 @@ def get_expression( return None -def _plain_input_type_to_clt_input( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: match input_type: case cwl.InputArraySchema(): return cwl.CommandInputArraySchema.fromDoc( @@ -273,122 +281,22 @@ def _plain_input_type_to_clt_input( raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") -def plain_input_type_to_clt_input( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: if isinstance(input_type, Sequence): return [ - _plain_input_type_to_clt_input(input_type_item) + _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_type_to_clt_input(input_type) - - -def _plain_input_type_to_plain_output( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): + 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( @@ -413,122 +321,22 @@ def _plain_input_type_to_plain_output( raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") -def plain_input_type_to_plain_output( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: if isinstance(input_type, Sequence): return [ - _plain_input_type_to_plain_output(input_type_item) + _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_type_to_plain_output(input_type) - - -def _plain_output_type_to_clt_output( - output_type: ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): + 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( @@ -553,85 +361,31 @@ def _plain_output_type_to_clt_output( raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") -def plain_output_type_to_clt_output( - output_type: ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: if isinstance(output_type, Sequence): return [ - _plain_output_type_to_clt_output(output_type_item) + _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(output_type) + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_plain_input_paramater( + parameter: ( + cwl.InputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + ), +) -> cwl.InputParameter: + return cwl.InputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) def parameters_to_plain_input_paramaters( @@ -639,12 +393,7 @@ def parameters_to_plain_input_paramaters( cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], ) -> Sequence[cwl.InputParameter]: - return [ - cwl.InputParameter.fromDoc( - parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions - ) - for parameter in parameters - ] + return [parameter_to_plain_input_paramater(parameter) for parameter in parameters] def etool_to_cltool( @@ -662,7 +411,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=plain_input_type_to_clt_input(inp.type_), + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -677,7 +426,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=plain_output_type_to_clt_output(outp.type_), + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -840,14 +589,21 @@ 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 + assert self_type is not None new_type: InputTypeSchemas if isinstance(self_type, Sequence): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] @@ -889,7 +645,7 @@ def generate_etool_from_expr( ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -898,7 +654,7 @@ def generate_etool_from_expr( streamable=target.streamable, doc=target.doc, format=target.format[0] if target.format else None, - type_=plain_input_type_to_plain_output(target.type_), + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -982,23 +738,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( @@ -1049,7 +817,11 @@ 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]: @@ -1525,6 +1297,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]] = [] @@ -1534,6 +1307,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): @@ -1554,11 +1328,12 @@ def process_level_reqs( replace_etool, process, ) - new_requirements = list(target_process.requirements) - new_requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" - target_process.requirements = new_requirements generated_envVar_reqs.append((etool_id, env_index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -1571,7 +1346,7 @@ def process_level_reqs( 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, @@ -1609,15 +1384,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", @@ -1650,9 +1428,19 @@ 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) ) @@ -1697,7 +1485,7 @@ def process_level_reqs( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1705,9 +1493,13 @@ 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( @@ -1735,26 +1527,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 @@ -1763,13 +1569,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( @@ -1801,20 +1609,24 @@ def traverse_CommandLineTool( 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) @@ -1827,18 +1639,24 @@ def traverse_CommandLineTool( 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) @@ -1854,12 +1672,16 @@ def traverse_CommandLineTool( 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( @@ -1874,12 +1696,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: @@ -1888,21 +1717,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")] + 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 = [ { @@ -1929,31 +1765,42 @@ def traverse_CommandLineTool( 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 isinstance(orig_step_input.source, Sequence): + 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 = ( @@ -1972,8 +1819,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: @@ -2001,13 +1848,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: @@ -2038,24 +1889,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_: @@ -2071,7 +1931,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( @@ -2082,7 +1944,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) @@ -2090,7 +1952,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) @@ -2109,7 +1971,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] ) @@ -2123,8 +1986,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, @@ -2132,9 +1996,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, @@ -2145,7 +2010,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] ) @@ -2159,8 +2025,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, @@ -2168,30 +2035,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 @@ -2206,10 +2076,11 @@ def cltool_step_outputs_to_workflow_outputs( 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] @@ -2263,7 +2134,7 @@ def generate_etool_from_expr2( streamable=target.streamable, doc=target.doc, format=target.format[0] if target.format else None, - type_=plain_input_type_to_plain_output(target.type_), + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -2467,34 +2338,34 @@ def traverse_step( def workflow_step_to_InputParameters( step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> list[cwl.InputParameter | cwl.CommandOutputParameter]: - """Create InputParameters to match the given WorkflowStep inputs.""" +) -> 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 isinstance(param, Sequence): 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 diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index 974abcab..9362d4ee 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import Any, IO, cast +from typing import IO, Any, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 031c07e1..20117145 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import Any, IO, cast +from typing import IO, Any, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index 8262c188..c8037e94 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -5,7 +5,7 @@ from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import Any, IO, cast +from typing import IO, Any, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -243,8 +243,8 @@ def check_all_types( 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 + not isinstance(snk_typ, MutableSequence) + or "null" not in snk_typ ): validation["warning"].append( SrcSink( @@ -270,8 +270,8 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] if ( - _is_conditional_step(param_to_step, parm_id) - and sink.pickValue is not None + _is_conditional_step(param_to_step, parm_id) + and sink.pickValue is not None ): validation["warning"].append( SrcSink( From d2935f25603a528b01e59ac0e93acab4e630c252 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 15:28:55 +0100 Subject: [PATCH 07/16] finish type fixing cwl_v1_1_expression_refactor --- cwl_utils/cwl_v1_0_expression_refactor.py | 2 +- cwl_utils/cwl_v1_1_expression_refactor.py | 1133 ++++++++++++++------- cwl_utils/parser/cwl_v1_1_utils.py | 12 +- 3 files changed, 798 insertions(+), 349 deletions(-) diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index 72981e52..a3ceef5f 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -2385,7 +2385,7 @@ def replace_step_valueFrom_expr_with_etool( source_type: ( cwl.InputParameter | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + | Sequence[cwl.InputParameter | cwl.CommandOutputParameter] | None ) = None, ) -> None: diff --git a/cwl_utils/cwl_v1_1_expression_refactor.py b/cwl_utils/cwl_v1_1_expression_refactor.py index 41adad58..d8283611 100755 --- a/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/cwl_utils/cwl_v1_1_expression_refactor.py @@ -7,7 +7,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, cast +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -44,7 +44,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 +55,153 @@ 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: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + 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 isinstance(result, Sequence): + 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 isinstance(field, Sequence): + 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 +256,146 @@ 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 isinstance(input_type, Sequence): + 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 isinstance(input_type, Sequence): + 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 isinstance(output_type, Sequence): + 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.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + ), +) -> 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 +411,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 +426,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, ) @@ -329,20 +589,33 @@ 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 isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + 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( @@ -372,7 +645,7 @@ def generate_etool_from_expr( ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -380,8 +653,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 +683,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 @@ -430,7 +709,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: """ @@ -455,23 +738,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( @@ -482,14 +777,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 +817,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 @@ -616,18 +920,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, @@ -636,7 +939,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, @@ -645,6 +948,7 @@ def process_workflow_inputs_and_outputs( f"Entry {index}," + TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1]) ) + return modified @@ -689,7 +993,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -710,7 +1014,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: @@ -719,9 +1025,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 ) @@ -746,7 +1050,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 ), @@ -767,18 +1071,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, @@ -788,17 +1092,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="", @@ -808,7 +1114,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( @@ -819,38 +1125,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, @@ -860,24 +1166,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, @@ -886,10 +1192,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: @@ -904,14 +1212,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: @@ -922,15 +1234,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: @@ -942,32 +1258,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, @@ -987,6 +1310,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]] = [] @@ -996,6 +1320,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): @@ -1003,7 +1328,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 ) @@ -1016,7 +1341,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)) @@ -1027,11 +1355,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, @@ -1056,7 +1384,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 ) @@ -1069,15 +1397,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", @@ -1085,15 +1416,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 = ( @@ -1110,31 +1441,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} ; @@ -1150,14 +1491,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, @@ -1165,22 +1506,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( @@ -1195,26 +1540,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 @@ -1223,13 +1582,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( @@ -1257,24 +1618,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) @@ -1283,22 +1648,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) @@ -1309,17 +1680,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( @@ -1334,12 +1709,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: @@ -1348,21 +1730,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 = [ { @@ -1386,34 +1775,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 isinstance(orig_step_input.source, Sequence): + 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 = ( @@ -1432,8 +1832,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: @@ -1461,12 +1861,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: @@ -1497,24 +1902,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_: @@ -1530,7 +1944,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( @@ -1541,7 +1957,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) @@ -1549,7 +1965,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) @@ -1562,13 +1978,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] ) @@ -1582,8 +1999,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, @@ -1591,9 +2009,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, @@ -1604,7 +2023,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] ) @@ -1618,8 +2038,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, @@ -1627,30 +2048,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 @@ -1658,17 +2082,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] @@ -1696,14 +2121,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, @@ -1717,8 +2148,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 = "${" @@ -1733,19 +2164,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)) @@ -1754,7 +2213,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, @@ -1776,43 +2235,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 isinstance(scattered_source_type, list): + 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 @@ -1821,42 +2266,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 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="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1872,9 +2307,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, @@ -1891,6 +2328,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, @@ -1916,29 +2354,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 isinstance(param, Sequence): 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 @@ -1949,15 +2393,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 @@ -1994,22 +2440,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)) @@ -2025,7 +2468,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, @@ -2035,6 +2479,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2067,7 +2512,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/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 20117145..44633281 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -430,8 +430,10 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, ) -> Any: @@ -482,8 +484,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 8fe2fa90c87b1c9c8761402302be72edd804557c Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 16:11:10 +0100 Subject: [PATCH 08/16] finish type fixing cwl_v1_2_expression_refactor --- cwl_utils/cwl_v1_2_expression_refactor.py | 1328 ++++++++++++++------- cwl_utils/parser/cwl_v1_2_utils.py | 16 +- 2 files changed, 895 insertions(+), 449 deletions(-) diff --git a/cwl_utils/cwl_v1_2_expression_refactor.py b/cwl_utils/cwl_v1_2_expression_refactor.py index b467c7f7..eff40a7c 100755 --- a/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/cwl_utils/cwl_v1_2_expression_refactor.py @@ -5,9 +5,9 @@ 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 +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -24,6 +24,7 @@ CWLOutputType, CWLParameterContext, CWLRuntimeParameterContext, + is_file_or_directory, ) @@ -43,7 +44,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 @@ -54,33 +55,153 @@ 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: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + 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 isinstance(result, Sequence): + 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 isinstance(field, Sequence): + 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. @@ -135,6 +256,186 @@ 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 isinstance(input_type, Sequence): + 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 isinstance(input_type, Sequence): + 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 isinstance(input_type, Sequence): + 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 isinstance(output_type, Sequence): + 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.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + | cwl.OperationOutputParameter + | cwl.OperationInputParameter + ), +) -> 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: @@ -150,7 +451,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, ) @@ -165,7 +466,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, ) @@ -325,53 +626,71 @@ 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 isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + 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 isinstance(self_type, Sequence) else None, secondaryFiles=( self_type.secondaryFiles - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable + if not isinstance(self_type, Sequence) + else None + ), + doc=self_type.doc if not isinstance(self_type, Sequence) else None, + format=( + self_type.format if not isinstance(self_type, Sequence) 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, type_=new_type, extension_fields=( self_type.extension_fields - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), loadingOptions=( self_type.loadingOptions - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -379,8 +698,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, ) @@ -409,18 +728,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 @@ -429,7 +758,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: """ @@ -451,26 +785,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( @@ -481,14 +830,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( @@ -519,26 +870,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 @@ -659,18 +1018,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, @@ -679,7 +1037,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, @@ -708,26 +1066,31 @@ 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 isinstance(param2.outputSource, Sequence): 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 isinstance(source_type_items.items, Sequence): 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): + elif isinstance(source_type_items, Sequence): 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, @@ -785,7 +1148,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -806,7 +1169,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: @@ -815,9 +1180,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 ) @@ -842,7 +1205,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 ), @@ -863,18 +1226,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, @@ -884,17 +1247,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="", @@ -902,16 +1267,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( @@ -922,38 +1280,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, @@ -963,24 +1321,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, @@ -989,10 +1347,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: @@ -1007,14 +1367,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: @@ -1025,15 +1389,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: @@ -1045,32 +1413,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, @@ -1090,6 +1469,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]] = [] @@ -1099,6 +1479,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): @@ -1106,7 +1487,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 ) @@ -1119,7 +1500,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)) @@ -1130,11 +1514,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, @@ -1159,7 +1543,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 ) @@ -1172,15 +1556,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", @@ -1188,15 +1575,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 = ( @@ -1213,31 +1600,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} ; @@ -1253,14 +1650,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, @@ -1268,22 +1665,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( @@ -1298,26 +1699,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 @@ -1326,13 +1741,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( @@ -1360,24 +1777,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) @@ -1386,22 +1807,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) @@ -1412,17 +1839,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( @@ -1437,12 +1868,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: @@ -1451,21 +1889,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 = [ { @@ -1489,34 +1934,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 isinstance(orig_step_input.source, Sequence): + 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 = ( @@ -1535,8 +1991,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: @@ -1564,12 +2020,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: @@ -1600,24 +2061,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_: @@ -1633,7 +2103,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( @@ -1644,7 +2116,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) @@ -1652,7 +2124,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) @@ -1665,13 +2137,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] ) @@ -1685,8 +2158,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, @@ -1694,9 +2168,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, @@ -1707,7 +2182,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] ) @@ -1721,8 +2197,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, @@ -1730,30 +2207,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 @@ -1761,17 +2245,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] @@ -1799,14 +2284,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, @@ -1820,8 +2312,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 = "${" @@ -1836,19 +2328,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)) @@ -1857,7 +2379,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, @@ -1879,43 +2401,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 isinstance(scattered_source_type, Sequence): + 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 @@ -1924,42 +2432,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 isinstance(temp_type, Sequence): + 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 @@ -1975,9 +2473,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, @@ -1993,15 +2493,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, @@ -2027,29 +2520,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 isinstance(param, Sequence): 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 @@ -2060,15 +2559,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 @@ -2105,22 +2610,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)) @@ -2136,7 +2638,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, @@ -2146,72 +2649,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( @@ -2244,7 +2682,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/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index c8037e94..c663ec93 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -511,8 +511,14 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, pickValue: str | None = None, @@ -571,8 +577,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 8d13b6194c10853f57732476774f16cc8b423f27 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sat, 20 Dec 2025 21:53:30 +0100 Subject: [PATCH 09/16] Regenerate parsers --- cwl_utils/parser/cwl_v1_0.py | 555 ++++++++++----------- cwl_utils/parser/cwl_v1_1.py | 656 +++++++++++++------------ cwl_utils/parser/cwl_v1_2.py | 742 +++++++++++++++-------------- cwl_utils/parser/cwl_v1_2_utils.py | 2 +- 4 files changed, 1018 insertions(+), 937 deletions(-) diff --git a/cwl_utils/parser/cwl_v1_0.py b/cwl_utils/parser/cwl_v1_0.py index 406bcd7d..9f1ee3e5 100644 --- a/cwl_utils/parser/cwl_v1_0.py +++ b/cwl_utils/parser/cwl_v1_0.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ 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.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( 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 + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,7 +4408,7 @@ def __init__( @trait class SchemaBase(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait @@ -4418,12 +4418,15 @@ class Parameter(SchemaBase, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | Sequence[str] | str + streamable: None | bool + doc: None | Sequence[str] | str @trait class InputBinding(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool @trait @@ -4433,12 +4436,12 @@ class OutputBinding(Saveable, metaclass=ABCMeta): @trait class InputSchema(SchemaBase, metaclass=ABCMeta): - pass + label: None | str @trait class OutputSchema(SchemaBase, metaclass=ABCMeta): - pass + label: None | str class InputRecordField(CWLRecordField): @@ -4813,11 +4816,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] @@ -5139,10 +5142,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -5521,11 +5524,11 @@ 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.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] @@ -5839,10 +5842,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -6167,10 +6170,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] @@ -6427,9 +6430,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label + self.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) @@ -6808,11 +6811,11 @@ 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.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] @@ -7126,10 +7129,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] @@ -7740,15 +7743,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 - self.format = format - self.inputBinding = inputBinding - self.default = default - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.inputBinding: CommandLineBinding | None = inputBinding + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -8259,13 +8262,13 @@ def __init__( 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.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( [ @@ -8305,7 +8308,14 @@ class Process(Saveable, metaclass=ABCMeta): """ - pass + id: None | str + inputs: Sequence[InputParameter] + outputs: Sequence[OutputParameter] + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] + 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] + label: None | str + doc: None | str + cwlVersion: Literal["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"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -8485,7 +8495,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8666,7 +8676,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8874,8 +8884,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9406,13 +9416,13 @@ def __init__( 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 + self.loadContents: None | bool = loadContents + self.position: None | i32 = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9696,9 +9706,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.glob = glob - self.loadContents = loadContents - self.outputEval = outputEval + self.glob: None | Sequence[str] | str = glob + self.loadContents: None | bool = loadContents + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) @@ -10075,11 +10085,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] @@ -10401,10 +10411,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -10783,11 +10793,11 @@ 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.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] @@ -11101,10 +11111,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -11429,10 +11439,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] @@ -11754,10 +11764,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -12136,11 +12146,11 @@ 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.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] @@ -12454,10 +12464,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] @@ -13072,15 +13082,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 - self.format = format - self.inputBinding = inputBinding - self.default = default - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.inputBinding: CommandLineBinding | None = inputBinding + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -13650,14 +13660,14 @@ def __init__( 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_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14701,23 +14711,23 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.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] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["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"] | None = 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 + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15244,12 +15254,12 @@ def __init__( 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 + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15435,7 +15445,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -15689,9 +15699,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -15957,9 +15967,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -16133,7 +16143,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -16309,7 +16319,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17031,14 +17041,14 @@ def __init__( 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 + self.coresMin: None | i32 | str = coresMin + self.coresMax: None | i32 | str = coresMax + self.ramMin: None | i32 | str = ramMin + self.ramMax: None | i32 | str = ramMax + self.tmpdirMin: None | i32 | str = tmpdirMin + self.tmpdirMax: None | i32 | str = tmpdirMax + self.outdirMin: None | i32 | str = outdirMin + self.outdirMax: None | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -17604,14 +17614,14 @@ def __init__( 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_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18262,16 +18272,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.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] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18954,16 +18964,16 @@ def __init__( 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_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18983,7 +18993,8 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None class WorkflowStepInput(Sink): @@ -19398,11 +19409,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.source = source - self.linkMerge = linkMerge - self.id = id - self.default = default - self.valueFrom = valueFrom + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.id: str = id + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["source", "linkMerge", "id", "default", "valueFrom"] @@ -19565,7 +19576,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -20284,16 +20295,16 @@ def __init__( 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 + self.id: str = id + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any] = hints + self.label: None | str = label + self.doc: None | str = doc + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -20987,16 +20998,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.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] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21660,7 +21671,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -21836,7 +21847,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -22005,7 +22016,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -22188,7 +22199,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "TimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -22376,7 +22387,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -22571,7 +22582,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -23202,16 +23213,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.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] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23404,7 +23415,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -23765,10 +23776,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23946,7 +23957,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/cwl_utils/parser/cwl_v1_1.py b/cwl_utils/parser/cwl_v1_1.py index 0f4004c0..f75e9657 100644 --- a/cwl_utils/parser/cwl_v1_1.py +++ b/cwl_utils/parser/cwl_v1_1.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ 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.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( 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 + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,37 +4408,40 @@ def __init__( @trait class Labeled(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait class Identified(Saveable, metaclass=ABCMeta): - pass + id: None | str @trait class IdentifierRequired(Identified, metaclass=ABCMeta): - pass + id: str @trait class LoadContents(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None @trait class FieldBase(Labeled, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool @trait class InputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | Sequence[str] | str @trait class OutputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | str @trait @@ -4448,7 +4451,11 @@ class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str class InputBinding(Saveable): @@ -4593,24 +4600,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.loadContents: None | bool = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @trait class IOSchema(Labeled, Documented, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class InputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class OutputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): @@ -5221,15 +5234,15 @@ def __init__( 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.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5615,11 +5628,11 @@ def __init__( 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.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -5995,11 +6008,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -6375,11 +6388,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -6878,13 +6891,13 @@ def __init__( 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.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] @@ -7260,11 +7273,11 @@ def __init__( 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.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -7640,11 +7653,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -8020,11 +8033,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -8033,12 +8046,25 @@ def __init__( @trait class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | Sequence[str] | str + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None + default: CWLObjectType | None @trait class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | str @trait @@ -8066,7 +8092,14 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ - pass + id: None | str + label: None | str + doc: None | Sequence[str] | str + inputs: Sequence[CommandInputParameter | WorkflowInputParameter] + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter] + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] + 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] + cwlVersion: Literal["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"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -8246,7 +8279,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8432,7 +8465,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8632,8 +8665,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.pattern: str = pattern + self.required: None | bool | str = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @@ -8813,7 +8846,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9021,8 +9054,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9553,13 +9586,13 @@ def __init__( 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 + self.loadContents: None | bool = loadContents + self.position: None | i32 | str = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9900,10 +9933,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.glob: None | Sequence[str] | str = glob + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] @@ -9912,7 +9945,7 @@ def __init__( @trait class CommandLineBindable(Saveable, metaclass=ABCMeta): - pass + inputBinding: CommandLineBinding | None class CommandInputRecordField(InputRecordField, CommandLineBindable): @@ -10581,16 +10614,16 @@ def __init__( 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 + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -11045,12 +11078,12 @@ def __init__( 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 + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] @@ -11492,12 +11525,12 @@ 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.type_ = type_ - self.label = label - self.doc = doc - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] @@ -11934,12 +11967,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12496,14 +12529,14 @@ def __init__( 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 + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12888,11 +12921,11 @@ def __init__( 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.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13268,11 +13301,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13648,11 +13681,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -14384,17 +14417,17 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14967,14 +15000,14 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16018,23 +16051,23 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = 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 + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16579,12 +16612,12 @@ def __init__( 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 + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16770,7 +16803,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17024,9 +17057,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17292,9 +17325,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -17468,7 +17501,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17644,7 +17677,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -18366,14 +18399,14 @@ def __init__( 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 + self.coresMin: None | i32 | str = coresMin + self.coresMax: None | i32 | str = coresMax + self.ramMin: None | i32 | str = ramMin + self.ramMax: None | i32 | str = ramMax + self.tmpdirMin: None | i32 | str = tmpdirMin + self.tmpdirMax: None | i32 | str = tmpdirMax + self.outdirMin: None | i32 | str = outdirMin + self.outdirMax: None | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18573,7 +18606,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18768,7 +18801,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -18978,7 +19011,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19164,7 +19197,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -19661,13 +19694,13 @@ def __init__( 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.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -20395,17 +20428,17 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: InputBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21065,16 +21098,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21701,15 +21734,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 - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21728,7 +21761,8 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): @@ -22324,14 +22358,14 @@ def __init__( 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 + self.id: str = id + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.label: None | str = label + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22507,7 +22541,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -23228,16 +23262,16 @@ def __init__( 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 + self.id: str = id + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any] = hints + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23931,16 +23965,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -24598,7 +24632,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -25231,16 +25265,16 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25433,7 +25467,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -25794,10 +25828,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25975,7 +26009,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/cwl_utils/parser/cwl_v1_2.py b/cwl_utils/parser/cwl_v1_2.py index 167ed57b..34e379b2 100644 --- a/cwl_utils/parser/cwl_v1_2.py +++ b/cwl_utils/parser/cwl_v1_2.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ 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.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( 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 + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,37 +4408,40 @@ def __init__( @trait class Labeled(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait class Identified(Saveable, metaclass=ABCMeta): - pass + id: None | str @trait class IdentifierRequired(Identified, metaclass=ABCMeta): - pass + id: str @trait class LoadContents(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None @trait class FieldBase(Labeled, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool @trait class InputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | Sequence[str] | str @trait class OutputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | str @trait @@ -4448,7 +4451,11 @@ class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str class InputBinding(Saveable): @@ -4593,24 +4600,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.loadContents: None | bool = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @trait class IOSchema(Labeled, Documented, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class InputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class OutputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): @@ -5221,15 +5234,15 @@ def __init__( 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.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5615,11 +5628,11 @@ def __init__( 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.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -5995,11 +6008,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -6375,11 +6388,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -6878,13 +6891,13 @@ def __init__( 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.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] @@ -7260,11 +7273,11 @@ def __init__( 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.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -7640,11 +7653,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -8020,11 +8033,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -8033,12 +8046,25 @@ def __init__( @trait class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | Sequence[str] | str + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None + default: CWLObjectType | None @trait class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | str @trait @@ -8066,7 +8092,15 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ - pass + id: None | str + label: None | str + doc: None | Sequence[str] | str + inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter] + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter] + 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] + 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] + cwlVersion: Literal["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"] | None + intent: None | Sequence[str] class InlineJavascriptRequirement(ProcessRequirement): @@ -8246,7 +8280,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8437,7 +8471,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8654,8 +8688,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.pattern: str = pattern + self.required: None | bool | str = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @@ -8835,7 +8869,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9043,8 +9077,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9575,13 +9609,13 @@ def __init__( 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 + self.loadContents: None | bool = loadContents + self.position: None | i32 | str = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9922,10 +9956,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.glob: None | Sequence[str] | str = glob + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] @@ -9934,7 +9968,7 @@ def __init__( @trait class CommandLineBindable(Saveable, metaclass=ABCMeta): - pass + inputBinding: CommandLineBinding | None class CommandInputRecordField(InputRecordField, CommandLineBindable): @@ -10603,16 +10637,16 @@ def __init__( 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 + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -11067,12 +11101,12 @@ def __init__( 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 + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] @@ -11514,12 +11548,12 @@ 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.type_ = type_ - self.label = label - self.doc = doc - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] @@ -11956,12 +11990,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12518,14 +12552,14 @@ def __init__( 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 + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12910,11 +12944,11 @@ def __init__( 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.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13290,11 +13324,11 @@ 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.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13670,11 +13704,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -14406,17 +14440,17 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14989,14 +15023,14 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16094,24 +16128,24 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.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] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion + self.intent: None | Sequence[str] = 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 + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16657,12 +16691,12 @@ def __init__( 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 + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16848,7 +16882,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17102,9 +17136,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17374,9 +17408,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -17551,7 +17585,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17727,7 +17761,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -18454,14 +18488,14 @@ def __init__( 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 + self.coresMin: None | float | i32 | str = coresMin + self.coresMax: None | float | i32 | str = coresMax + self.ramMin: None | float | i32 | str = ramMin + self.ramMax: None | float | i32 | str = ramMax + self.tmpdirMin: None | float | i32 | str = tmpdirMin + self.tmpdirMax: None | float | i32 | str = tmpdirMax + self.outdirMin: None | float | i32 | str = outdirMin + self.outdirMax: None | float | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18661,7 +18695,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18856,7 +18890,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -19066,7 +19100,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19252,7 +19286,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -19749,13 +19783,13 @@ def __init__( 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.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -20483,17 +20517,17 @@ def __init__( 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 + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: InputBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21207,17 +21241,17 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.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] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21903,16 +21937,16 @@ def __init__( 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_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21932,7 +21966,9 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): @@ -22648,15 +22684,15 @@ def __init__( 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 + self.id: str = id + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.label: None | str = label + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22833,7 +22869,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -23633,17 +23669,17 @@ def __init__( 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 + self.id: str = id + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.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] = requirements + self.hints: None | Sequence[Any] = hints + self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run + self.when: None | str = when + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -24398,17 +24434,17 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.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] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25571,16 +25607,16 @@ def __init__( 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.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -26095,13 +26131,13 @@ def __init__( 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.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -26744,15 +26780,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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[OperationInputParameter] = inputs + self.outputs: Sequence[OperationOutputParameter] = outputs + self.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] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Operation" attrs: ClassVar[Collection[str]] = frozenset( @@ -26935,7 +26971,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -27622,17 +27658,17 @@ 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.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.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] = requirements + self.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] = hints + self.cwlVersion: Literal["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"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -27826,7 +27862,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -28187,10 +28223,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -28633,12 +28669,12 @@ def __init__( 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 + self.default: Any | None = default + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.loopSource: None | Sequence[str] | str = loopSource + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] @@ -28942,9 +28978,9 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Loop" - self.loop = loop - self.loopWhen = loopWhen - self.outputMethod = outputMethod + self.loop: Sequence[LoopInput] = loop + self.loopWhen: str = loopWhen + self.outputMethod: Literal["last", "all"] = outputMethod attrs: ClassVar[Collection[str]] = frozenset( ["class", "loop", "loopWhen", "outputMethod"] @@ -29116,7 +29152,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index c663ec93..170fdb28 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -261,7 +261,7 @@ def check_all_types( items=src_typ, type_="array" ) else: - linkMerge: str | None = sink.linkMerge or ( + linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) if sink.pickValue in ("first_non_null", "the_only_non_null"): From e1beae2027c64edbe6c586da1f677b2f41357cc0 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 11:31:15 +0100 Subject: [PATCH 10/16] expression-refactor: fix detection of non-string Sequences --- cwl_utils/cwl_v1_0_expression_refactor.py | 45 ++++++++-------- cwl_utils/cwl_v1_1_expression_refactor.py | 45 ++++++++-------- cwl_utils/cwl_v1_2_expression_refactor.py | 62 +++++++++++------------ cwl_utils/types.py | 10 ++-- 4 files changed, 76 insertions(+), 86 deletions(-) diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index a3ceef5f..8b3d904f 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -25,6 +25,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -144,7 +145,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -173,7 +174,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -190,7 +191,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -284,7 +285,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -324,7 +325,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -364,7 +365,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -605,11 +606,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -621,27 +622,21 @@ def generate_etool_from_expr( 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 ), ) ) @@ -1782,7 +1777,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + 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): new_orig_step_input_source[index] = source.split("#")[ @@ -2238,7 +2233,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, list): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2264,7 +2259,7 @@ def traverse_step( 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): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2347,7 +2342,7 @@ def workflow_step_to_InputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/cwl_utils/cwl_v1_1_expression_refactor.py b/cwl_utils/cwl_v1_1_expression_refactor.py index d8283611..f0824b10 100755 --- a/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/cwl_utils/cwl_v1_1_expression_refactor.py @@ -25,6 +25,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -146,7 +147,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -175,7 +176,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -192,7 +193,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -286,7 +287,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -324,7 +325,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -362,7 +363,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -605,11 +606,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -621,27 +622,21 @@ def generate_etool_from_expr( 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 ), ) ) @@ -1795,7 +1790,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + 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): new_orig_step_input_source[index] = source.split("#")[ @@ -2253,7 +2248,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, list): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2281,7 +2276,7 @@ def traverse_step( 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): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2364,7 +2359,7 @@ def workflow_step_to_WorkflowInputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/cwl_utils/cwl_v1_2_expression_refactor.py b/cwl_utils/cwl_v1_2_expression_refactor.py index eff40a7c..21f23c96 100755 --- a/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/cwl_utils/cwl_v1_2_expression_refactor.py @@ -25,6 +25,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -146,7 +147,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -175,7 +176,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -192,7 +193,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -286,7 +287,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -324,7 +325,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -362,7 +363,7 @@ def _plain_output_schema_to_plain_input_schema( def plain_output_schema_to_plain_input_schema( input_type: OutputTypeSchemas, ) -> InputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_output_schema_to_plain_input_schema(input_type_item) for input_type_item in input_type @@ -400,7 +401,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -646,11 +647,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -662,31 +663,21 @@ def generate_etool_from_expr( inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, Sequence) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, Sequence) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable - if not isinstance(self_type, Sequence) - else None - ), - doc=self_type.doc if not isinstance(self_type, Sequence) else None, - format=( - self_type.format if not isinstance(self_type, Sequence) else None + self_type.streamable if not is_sequence(self_type) 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, Sequence) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, Sequence) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) @@ -1070,20 +1061,25 @@ def process_workflow_inputs_and_outputs( id="", type_=plain_output_schema_to_plain_input_schema(target_type) ) assert param2.outputSource is not None - if not isinstance(param2.outputSource, Sequence): + 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, Sequence): + if is_sequence(source_type_items.items): if "null" not in source_type_items.items: 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, Sequence): + 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: new_source_type_items = list(source_type_items) new_source_type_items.append("null") @@ -1954,7 +1950,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + 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): new_orig_step_input_source[index] = source.split("#")[ @@ -2419,7 +2415,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, Sequence): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2447,7 +2443,7 @@ def traverse_step( 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, Sequence): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2530,7 +2526,7 @@ def workflow_step_to_WorkflowInputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/cwl_utils/types.py b/cwl_utils/types.py index e2cc2cf5..19189a99 100644 --- a/cwl_utils/types.py +++ b/cwl_utils/types.py @@ -2,13 +2,13 @@ # From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py """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): - from typing import TypeIs + from typing import TypeIs as TypeIs else: - from typing_extensions import TypeIs + from typing_extensions import TypeIs as TypeIs if sys.version_info >= (3, 11): from typing import Required @@ -160,3 +160,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) From 8fe819d4f8af041b954848d6c9141e57af0b7417 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 12:01:33 +0100 Subject: [PATCH 11/16] bandit: allow asserts --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 133b5929..0fe29d2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -142,3 +142,4 @@ ignore = [ [tool.bandit] exclude_dirs = ["cwl_utils/tests"] +skips = ["B101"] From 5e005615aa4a6d33203670c42fe27094d1ae553c Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 14:19:28 +0100 Subject: [PATCH 12/16] inputs_schema_gen: type fixes --- cwl_utils/inputs_schema_gen.py | 73 ++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/cwl_utils/inputs_schema_gen.py b/cwl_utils/inputs_schema_gen.py index be35701e..a982a2fc 100644 --- a/cwl_utils/inputs_schema_gen.py +++ b/cwl_utils/inputs_schema_gen.py @@ -5,9 +5,11 @@ """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 @@ -16,6 +18,7 @@ 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 ( @@ -34,6 +37,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 +256,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 +271,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 +324,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 +342,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 +403,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 @@ -415,11 +430,9 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: ) workflow_schema_definitions_list.extend( - list( - map( - generate_definition_from_schema, - schema_def_requirement.types, - ) + map( + generate_definition_from_schema, + schema_def_requirement.types, ) ) @@ -432,7 +445,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), ) ) From f86cec04862626c44f72af96aacaedb68f7195d0 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 21 Dec 2025 22:01:17 +0100 Subject: [PATCH 13/16] Using LoadContents in type alias --- cwl_utils/parser/__init__.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index 3ff92077..df29b820 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -226,16 +226,8 @@ class NoType(ABC): 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 + cwl_v1_1.LoadContents + | cwl_v1_2.LoadContents ) """Type Union for a CWL v1.x LoadContents object.""" SchemaDefRequirement: TypeAlias = ( From 13cf53320426309ff3cbc0bd824c5a3044600235 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 16:27:52 +0100 Subject: [PATCH 14/16] WIP --- cwl_utils/cwl_v1_0_expression_refactor.py | 102 +------ cwl_utils/cwl_v1_1_expression_refactor.py | 102 +------ cwl_utils/cwl_v1_2_expression_refactor.py | 100 +------ cwl_utils/parser/__init__.py | 65 +++- cwl_utils/parser/cwl_v1_0_utils.py | 331 ++++++++++++++++++--- cwl_utils/parser/cwl_v1_1_utils.py | 332 ++++++++++++++++++--- cwl_utils/parser/cwl_v1_2_utils.py | 343 +++++++++++++++++++--- 7 files changed, 995 insertions(+), 380 deletions(-) diff --git a/cwl_utils/cwl_v1_0_expression_refactor.py b/cwl_utils/cwl_v1_0_expression_refactor.py index 8b3d904f..2c0fb72c 100755 --- a/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/cwl_utils/cwl_v1_0_expression_refactor.py @@ -7,7 +7,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -17,6 +17,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, @@ -56,91 +67,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -InputTypeSchemas: TypeAlias = ( - BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None -) -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] | None -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -OutputTypeSchemas: TypeAlias = ( - BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] | None -) -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] | None -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: @@ -162,8 +88,6 @@ def _clean_type_ids( for field in cwltype.items.fields: field.name = field.name.split("/")[-1] 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] @@ -686,7 +610,7 @@ def get_input_for_id( """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] - for inp in cast(list[cwl.InputParameter], tool.inputs): + for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: return cwl.CommandInputParameter.fromDoc( inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions diff --git a/cwl_utils/cwl_v1_1_expression_refactor.py b/cwl_utils/cwl_v1_1_expression_refactor.py index f0824b10..3523cd82 100755 --- a/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/cwl_utils/cwl_v1_1_expression_refactor.py @@ -7,7 +7,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -17,6 +17,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, @@ -56,93 +67,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: @@ -164,8 +88,6 @@ def _clean_type_ids( for field in cwltype.items.fields: field.name = field.name.split("/")[-1] 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] diff --git a/cwl_utils/cwl_v1_2_expression_refactor.py b/cwl_utils/cwl_v1_2_expression_refactor.py index 21f23c96..670ddda8 100755 --- a/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/cwl_utils/cwl_v1_2_expression_refactor.py @@ -7,7 +7,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -17,6 +17,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, @@ -56,93 +67,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index df29b820..70fc71f2 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -2,9 +2,9 @@ import os from abc import ABC -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from pathlib import Path -from typing import Any, Optional, TypeAlias, cast +from typing import Any, Literal, Optional, TypeAlias, cast from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -44,10 +44,20 @@ class NoType(ABC): 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,9 +68,34 @@ 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 ) +BasicOutputTypeSchemas: TypeAlias = ( + OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stderr", + "stdout", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] """Type union for a CWL v1.x OutputSchema object.""" Workflow: TypeAlias = cwl_v1_0.Workflow | cwl_v1_1.Workflow | cwl_v1_2.Workflow WorkflowTypes = (cwl_v1_0.Workflow, cwl_v1_1.Workflow, cwl_v1_2.Workflow) @@ -215,6 +250,27 @@ class NoType(ABC): cwl_v1_2.InputRecordSchema, ) """Type Union for a CWL v1.x RecordSchema object.""" + +BasicInputTypeSchemas: TypeAlias = ( + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] + 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,10 +281,7 @@ 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.LoadContents - | cwl_v1_2.LoadContents -) +LoadContents: TypeAlias = cwl_v1_1.LoadContents | cwl_v1_2.LoadContents """Type Union for a CWL v1.x LoadContents object.""" SchemaDefRequirement: TypeAlias = ( cwl_v1_0.SchemaDefRequirement diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index 9362d4ee..65d59b7b 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, Literal, TypeAlias, TypeVar, cast 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,6 +25,214 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_0_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_0_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_0_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_0_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_0_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type, loading_options + ) + + +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, + ) + 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, + ) + 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_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -367,7 +576,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -376,10 +585,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_0_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" 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 + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -391,21 +605,31 @@ def type_for_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: + for output in step_run.outputs: if ( - step_output.id.split("#")[-1].split("/")[-1] + output.id.split("#")[-1].split("/")[-1] == sourcename.split("#")[-1].split("/")[-1] ): - output_type = step_output.type_ + output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_0_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -415,35 +639,52 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = 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: @@ -452,25 +693,45 @@ 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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 = 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 | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 44633281..61b3d6b6 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, Literal, TypeAlias, TypeVar, cast 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,6 +25,220 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_1_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_1_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_1_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_1_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_1_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type, loading_options + ) + + +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, + ) + 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, + ) + 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_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -382,7 +597,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -391,10 +606,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_1_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" 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 + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -413,14 +633,24 @@ def type_for_step_output( ): output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_1_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -430,35 +660,52 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = 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: @@ -467,26 +714,45 @@ 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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 = 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 | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index 170fdb28..e223adbf 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -5,7 +5,7 @@ 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, Literal, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ 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,6 +25,220 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_2_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_2_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_2_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_2_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_2_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type, loading_options + ) + + +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, + ) + 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, + ) + 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_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -463,7 +678,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -472,10 +687,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_2_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" 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 + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -494,14 +714,24 @@ def type_for_step_output( ): output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_2_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -511,44 +741,57 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool - | cwl.Workflow - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = 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: @@ -557,29 +800,49 @@ 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: ignore[attr-defined] + ), + 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: ignore[attr-defined] + ), + 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 = 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 | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, @@ -608,6 +871,8 @@ def param_for_source_id( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter | cwl.WorkflowOutputParameter ] = [] From f0f5785c864209bfa255ccca95fd8e26787487e4 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 26 Dec 2025 10:47:23 +0100 Subject: [PATCH 15/16] Make `param_for_source_id` return any CWL parameter --- cwl_utils/parser/__init__.py | 4 ++ cwl_utils/parser/cwl_v1_0_utils.py | 33 +++++++++------ cwl_utils/parser/cwl_v1_1_utils.py | 36 +++++++++------- cwl_utils/parser/cwl_v1_2_utils.py | 42 +++++++++---------- cwl_utils/parser/utils.py | 67 ++++++++++-------------------- 5 files changed, 90 insertions(+), 92 deletions(-) diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index 70fc71f2..587a70c7 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -132,6 +132,10 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepOutput ) """Type union for a CWL v1.x WorkflowStepOutput object.""" +OperationInputParameter: TypeAlias = cwl_v1_2.OperationInputParameter +"""Type union for a CWL v1.x WorkflowInputParameter object.""" +OperationOutputParameter: TypeAlias = cwl_v1_2.OperationOutputParameter +"""Type union for a CWL v1.x WorkflowOutputParameter object.""" CommandLineTool: TypeAlias = ( cwl_v1_0.CommandLineTool | cwl_v1_1.CommandLineTool | cwl_v1_2.CommandLineTool ) diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index 65d59b7b..d4991d4f 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -736,25 +736,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 61b3d6b6..42cad4dc 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -757,28 +757,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """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.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index e223adbf..af9306c8 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -847,34 +847,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """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.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/cwl_utils/parser/utils.py b/cwl_utils/parser/utils.py index 9c4a2c4b..f5a9ccfc 100644 --- a/cwl_utils/parser/utils.py +++ b/cwl_utils/parser/utils.py @@ -27,6 +27,13 @@ cwl_v1_2, cwl_v1_2_utils, load_document_by_uri, + CommandInputParameter, + CommandOutputParameter, + ExpressionToolOutputParameter, + OperationInputParameter, + OperationOutputParameter, + WorkflowInputParameter, + WorkflowOutputParameter, ) _logger = logging.getLogger("cwl_utils") @@ -431,50 +438,22 @@ def param_for_source_id( parent: Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - ( - MutableSequence[ - cwl_v1_0.CommandOutputParameter - | cwl_v1_0.ExpressionToolOutputParameter - | cwl_v1_0.InputParameter - | cwl_v1_0.WorkflowOutputParameter - ] - | cwl_v1_0.CommandOutputParameter - | cwl_v1_0.ExpressionToolOutputParameter - | cwl_v1_0.InputParameter - | cwl_v1_0.WorkflowOutputParameter - ) - | ( - MutableSequence[ - cwl_v1_1.CommandInputParameter - | cwl_v1_1.CommandOutputParameter - | cwl_v1_1.ExpressionToolOutputParameter - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_1.WorkflowOutputParameter - ] - | cwl_v1_1.CommandInputParameter - | cwl_v1_1.CommandOutputParameter - | cwl_v1_1.ExpressionToolOutputParameter - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_1.WorkflowOutputParameter - ) - | ( - MutableSequence[ - cwl_v1_2.CommandInputParameter - | cwl_v1_2.CommandOutputParameter - | cwl_v1_2.ExpressionToolOutputParameter - | cwl_v1_2.OperationInputParameter - | cwl_v1_2.OperationOutputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_2.WorkflowOutputParameter - ] - | cwl_v1_2.CommandInputParameter - | cwl_v1_2.CommandOutputParameter - | cwl_v1_2.ExpressionToolOutputParameter - | cwl_v1_2.OperationInputParameter - | cwl_v1_2.OperationOutputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_2.WorkflowOutputParameter - ) + CommandInputParameter + | CommandOutputParameter + | ExpressionToolOutputParameter + | OperationInputParameter + | OperationOutputParameter + | WorkflowInputParameter + | WorkflowOutputParameter + | MutableSequence[ + CommandInputParameter + | CommandOutputParameter + | ExpressionToolOutputParameter + | OperationInputParameter + | OperationOutputParameter + | WorkflowInputParameter + | WorkflowOutputParameter + ] ): match process.cwlVersion: case "v1.0": From e907837f06fdfb8fb3c7398e3d56aaeb4c2133fc Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 26 Dec 2025 17:29:02 +0100 Subject: [PATCH 16/16] Regenerate prsers with fixed CWL versions --- cwl_utils/parser/__init__.py | 50 +------- cwl_utils/parser/cwl_v1_0.py | 60 ++------- cwl_utils/parser/cwl_v1_0_utils.py | 194 ++++++++--------------------- cwl_utils/parser/cwl_v1_1.py | 66 ++-------- cwl_utils/parser/cwl_v1_1_utils.py | 193 +++++++++------------------- cwl_utils/parser/cwl_v1_2.py | 88 ++----------- cwl_utils/parser/cwl_v1_2_utils.py | 193 +++++++++------------------- cwl_utils/parser/utils.py | 153 +++++++++++++++++------ 8 files changed, 326 insertions(+), 671 deletions(-) diff --git a/cwl_utils/parser/__init__.py b/cwl_utils/parser/__init__.py index 587a70c7..be8c41ef 100644 --- a/cwl_utils/parser/__init__.py +++ b/cwl_utils/parser/__init__.py @@ -2,9 +2,9 @@ import os from abc import ABC -from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import MutableMapping, MutableSequence from pathlib import Path -from typing import Any, Literal, Optional, TypeAlias, cast +from typing import Any, Optional, TypeAlias, cast from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -76,26 +76,6 @@ class NoType(ABC): OutputSchema: TypeAlias = ( cwl_v1_0.OutputSchema | cwl_v1_1.OutputSchema | cwl_v1_2.OutputSchema ) -BasicOutputTypeSchemas: TypeAlias = ( - OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stderr", - "stdout", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] """Type union for a CWL v1.x OutputSchema object.""" Workflow: TypeAlias = cwl_v1_0.Workflow | cwl_v1_1.Workflow | cwl_v1_2.Workflow WorkflowTypes = (cwl_v1_0.Workflow, cwl_v1_1.Workflow, cwl_v1_2.Workflow) @@ -132,10 +112,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 WorkflowInputParameter object.""" +"""Type union for a CWL v1.x OperationInputParameter object.""" OperationOutputParameter: TypeAlias = cwl_v1_2.OperationOutputParameter -"""Type union for a CWL v1.x WorkflowOutputParameter object.""" +"""Type union for a CWL v1.x OperationOutputParameter object.""" CommandLineTool: TypeAlias = ( cwl_v1_0.CommandLineTool | cwl_v1_1.CommandLineTool | cwl_v1_2.CommandLineTool ) @@ -255,26 +237,6 @@ class NoType(ABC): ) """Type Union for a CWL v1.x RecordSchema object.""" -BasicInputTypeSchemas: TypeAlias = ( - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] - 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 = ( diff --git a/cwl_utils/parser/cwl_v1_0.py b/cwl_utils/parser/cwl_v1_0.py index 9f1ee3e5..6a6e814b 100644 --- a/cwl_utils/parser/cwl_v1_0.py +++ b/cwl_utils/parser/cwl_v1_0.py @@ -8315,7 +8315,7 @@ class Process(Saveable, metaclass=ABCMeta): 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] label: None | str doc: None | str - cwlVersion: Literal["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"] | None + cwlVersion: Literal["v1.0"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -14691,7 +14691,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -14718,7 +14718,7 @@ def __init__( self.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] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand self.arguments: None | Sequence[CommandLineBinding | str] = arguments @@ -18260,7 +18260,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18279,7 +18279,7 @@ def __init__( self.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] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -20986,7 +20986,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21005,7 +21005,7 @@ def __init__( self.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] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -23201,7 +23201,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23220,7 +23220,7 @@ def __init__( self.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] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run @@ -24054,16 +24054,6 @@ def __init__( "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", @@ -24082,7 +24072,6 @@ def __init__( "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.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -24176,16 +24165,6 @@ def __init__( "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", @@ -24204,7 +24183,6 @@ def __init__( "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: Final = _PrimitiveLoader(str) @@ -24288,25 +24266,9 @@ def __init__( union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True ) CWLInputFileLoader: Final = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader: Final = _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", -) +CWLVersionLoader: Final = _EnumLoader(("v1.0",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ ExpressionLoader: Final = _ExpressionLoader(str) InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) diff --git a/cwl_utils/parser/cwl_v1_0_utils.py b/cwl_utils/parser/cwl_v1_0_utils.py index d4991d4f..38e3e320 100644 --- a/cwl_utils/parser/cwl_v1_0_utils.py +++ b/cwl_utils/parser/cwl_v1_0_utils.py @@ -106,88 +106,6 @@ ) -def _input_type_schema_to_cwl_v1_0_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_0_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_0_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_0_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_0_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -573,63 +491,62 @@ def merge_flatten_type(src: Any) -> Any: 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, -) -> InputTypeSchemas: +) -> 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_0_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_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 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 output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_0_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + 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, @@ -804,26 +721,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 f75e9657..f229e0b0 100644 --- a/cwl_utils/parser/cwl_v1_1.py +++ b/cwl_utils/parser/cwl_v1_1.py @@ -8099,7 +8099,7 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter] requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] 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] - cwlVersion: Literal["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"] | None + cwlVersion: Literal["v1.1"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -16031,7 +16031,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -16058,7 +16058,7 @@ def __init__( self.outputs: Sequence[CommandOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand self.arguments: None | Sequence[CommandLineBinding | str] = arguments @@ -21086,7 +21086,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21105,7 +21105,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -23953,7 +23953,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23972,7 +23972,7 @@ def __init__( self.outputs: Sequence[WorkflowOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -25253,7 +25253,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25272,7 +25272,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run @@ -26117,16 +26117,6 @@ def __init__( "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", @@ -26145,10 +26135,7 @@ def __init__( "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.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -26253,16 +26240,6 @@ def __init__( "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", @@ -26281,10 +26258,7 @@ def __init__( "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: Final = _PrimitiveLoader(str) @@ -26456,27 +26430,9 @@ def __init__( CWLInputFileLoader: Final = ( 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: Final = _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", -) +CWLVersionLoader: Final = _EnumLoader(("v1.1",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ LoadListingEnumLoader: Final = _EnumLoader( ( diff --git a/cwl_utils/parser/cwl_v1_1_utils.py b/cwl_utils/parser/cwl_v1_1_utils.py index 42cad4dc..eaa21dc5 100644 --- a/cwl_utils/parser/cwl_v1_1_utils.py +++ b/cwl_utils/parser/cwl_v1_1_utils.py @@ -40,10 +40,11 @@ "string", "File", "Directory", - "stdin", ] ) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] +) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema @@ -59,11 +60,12 @@ "string", "File", "Directory", - "stdin", ] ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] + BasicCommandInputTypeSchemas + | Literal["stdin"] + | Sequence[BasicCommandInputTypeSchemas] ) BasicOutputTypeSchemas: TypeAlias = ( cwl.OutputArraySchema @@ -80,11 +82,13 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicOutputTypeSchemas] +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -100,100 +104,18 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] + BasicCommandOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas ) -def _input_type_schema_to_cwl_v1_1_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_1_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_1_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_1_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_1_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -594,63 +516,62 @@ def merge_flatten_type(src: Any) -> Any: 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, -) -> InputTypeSchemas: +) -> 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_1_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_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 output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_1_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + 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, @@ -825,8 +746,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, @@ -834,9 +755,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -844,7 +763,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 34e379b2..be96ca70 100644 --- a/cwl_utils/parser/cwl_v1_2.py +++ b/cwl_utils/parser/cwl_v1_2.py @@ -8099,7 +8099,7 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter] 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] 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] - cwlVersion: Literal["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"] | None + cwlVersion: Literal["v1.2"] | None intent: None | Sequence[str] @@ -16107,7 +16107,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, @@ -16135,7 +16135,7 @@ def __init__( self.outputs: Sequence[CommandOutputParameter] = outputs self.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] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand @@ -21228,7 +21228,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -21248,7 +21248,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.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] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -24421,7 +24421,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -24441,7 +24441,7 @@ def __init__( self.outputs: Sequence[WorkflowOutputParameter] = outputs self.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] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -26767,7 +26767,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -26787,7 +26787,7 @@ def __init__( self.outputs: Sequence[OperationOutputParameter] = outputs self.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] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Operation" @@ -27645,7 +27645,7 @@ def __init__( 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: Literal["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"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -27665,7 +27665,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.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] = requirements self.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] = hints - self.cwlVersion: Literal["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"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run @@ -29268,16 +29268,6 @@ def __init__( "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", @@ -29299,16 +29289,7 @@ def __init__( "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.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -29421,16 +29402,6 @@ def __init__( "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", @@ -29452,16 +29423,7 @@ def __init__( "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: Final = _PrimitiveLoader(str) @@ -29635,33 +29597,9 @@ def __init__( CWLInputFileLoader: Final = ( 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: Final = _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", -) +CWLVersionLoader: Final = _EnumLoader(("v1.2",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ LoadListingEnumLoader: Final = _EnumLoader( ( diff --git a/cwl_utils/parser/cwl_v1_2_utils.py b/cwl_utils/parser/cwl_v1_2_utils.py index af9306c8..f4fc6402 100644 --- a/cwl_utils/parser/cwl_v1_2_utils.py +++ b/cwl_utils/parser/cwl_v1_2_utils.py @@ -40,10 +40,11 @@ "string", "File", "Directory", - "stdin", ] ) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] +) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema @@ -59,11 +60,12 @@ "string", "File", "Directory", - "stdin", ] ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] + BasicCommandInputTypeSchemas + | Literal["stdin"] + | Sequence[BasicCommandInputTypeSchemas] ) BasicOutputTypeSchemas: TypeAlias = ( cwl.OutputArraySchema @@ -80,11 +82,13 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicOutputTypeSchemas] +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -100,100 +104,18 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] + BasicCommandOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas ) -def _input_type_schema_to_cwl_v1_2_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_2_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_2_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_2_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_2_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -675,63 +597,62 @@ def merge_flatten_type(src: Any) -> Any: 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, -) -> InputTypeSchemas: +) -> 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_2_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_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 output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_2_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + 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, @@ -915,8 +836,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, @@ -924,9 +845,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -934,7 +853,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 f5a9ccfc..0ad4a8c3 100644 --- a/cwl_utils/parser/utils.py +++ b/cwl_utils/parser/utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence from pathlib import Path from types import ModuleType -from typing import Any, Final, Optional, cast +from typing import Any, Final, Optional, cast, Literal, TypeAlias, overload from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -34,11 +34,41 @@ OperationOutputParameter, WorkflowInputParameter, WorkflowOutputParameter, + OutputArraySchema, + InputArraySchema, ) _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 +) + + def convert_stdstreams_to_files(process: Process) -> None: """Convert stdin, stdout and stderr type shortcuts to files.""" match process: @@ -221,7 +251,7 @@ def static_checker(workflow: Workflow) -> None: type_dict, ) workflow_outputs_val = cwl_v1_0_utils.check_all_types( - src_dict, cast(cwl_v1_0.Workflow, workflow).outputs, type_dict + src_dict, workflow.outputs, type_dict ) case "v1.1": parser = cwl_v1_1 @@ -231,7 +261,7 @@ def static_checker(workflow: Workflow) -> None: type_dict, ) workflow_outputs_val = cwl_v1_1_utils.check_all_types( - src_dict, cast(cwl_v1_1.Workflow, workflow).outputs, type_dict + src_dict, workflow.outputs, type_dict ) case "v1.2": parser = cwl_v1_2 @@ -342,6 +372,78 @@ def static_checker(workflow: 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], @@ -353,36 +455,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, @@ -398,7 +485,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": @@ -413,9 +500,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": @@ -430,6 +521,8 @@ 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( @@ -458,24 +551,14 @@ def param_for_source_id( match process.cwlVersion: case "v1.0": return cwl_v1_0_utils.param_for_source_id( - cast( - cwl_v1_0.CommandLineTool - | cwl_v1_0.Workflow - | cwl_v1_0.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_0.Workflow, parent), scatter_context, ) case "v1.1": return cwl_v1_1_utils.param_for_source_id( - cast( - cwl_v1_1.CommandLineTool - | cwl_v1_1.Workflow - | cwl_v1_1.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_1.Workflow, parent), scatter_context,