44from abc import ABC
55from collections .abc import MutableMapping , MutableSequence
66from pathlib import Path
7- from typing import Any , Optional , Union , cast
7+ from typing import Any , Optional , TypeAlias , Union , cast
88from urllib .parse import unquote_plus , urlparse
99
1010from schema_salad .exceptions import ValidationException
@@ -18,232 +18,229 @@ class NoType(ABC):
1818 pass
1919
2020
21- LoadingOptions = Union [
22- cwl_v1_0 .LoadingOptions , cwl_v1_1 .LoadingOptions , cwl_v1_2 .LoadingOptions
23- ]
21+ LoadingOptions : TypeAlias = (
22+ cwl_v1_0 .LoadingOptions | cwl_v1_1 .LoadingOptions | cwl_v1_2 .LoadingOptions
23+ )
2424"""Type union for a CWL v1.x LoadingOptions object."""
25- Saveable = Union [ cwl_v1_0 .Saveable , cwl_v1_1 .Saveable , cwl_v1_2 .Saveable ]
25+ Saveable : TypeAlias = cwl_v1_0 .Saveable | cwl_v1_1 .Saveable | cwl_v1_2 .Saveable
2626"""Type union for a CWL v1.x Saveable object."""
27- InputParameter = Union [
28- cwl_v1_0 .InputParameter , cwl_v1_1 .InputParameter , cwl_v1_2 .InputParameter
29- ]
27+ InputParameter : TypeAlias = (
28+ cwl_v1_0 .InputParameter | cwl_v1_1 .InputParameter | cwl_v1_2 .InputParameter
29+ )
3030"""Type union for a CWL v1.x InputEnumSchema object."""
31- InputRecordField = Union [
32- cwl_v1_0 .InputRecordField ,
33- cwl_v1_1 .InputRecordField ,
34- cwl_v1_2 .InputRecordField ,
35- ]
31+ InputRecordField : TypeAlias = (
32+ cwl_v1_0 .InputRecordField | cwl_v1_1 .InputRecordField | cwl_v1_2 .InputRecordField
33+ )
3634"""Type union for a CWL v1.x InputRecordSchema object."""
37- InputSchema = Union [cwl_v1_0 .InputSchema , cwl_v1_1 .InputSchema , cwl_v1_2 .InputSchema ]
35+ InputSchema : TypeAlias = (
36+ cwl_v1_0 .InputSchema | cwl_v1_1 .InputSchema | cwl_v1_2 .InputSchema
37+ )
3838"""Type union for a CWL v1.x InputSchema object."""
39- OutputParameter = Union [
40- cwl_v1_0 .OutputParameter , cwl_v1_1 .OutputParameter , cwl_v1_2 .OutputParameter
41- ]
39+ OutputParameter : TypeAlias = (
40+ cwl_v1_0 .OutputParameter | cwl_v1_1 .OutputParameter | cwl_v1_2 .OutputParameter
41+ )
4242"""Type union for a CWL v1.x OutputParameter object."""
43- OutputArraySchema = Union [
44- cwl_v1_0 .OutputArraySchema ,
45- cwl_v1_1 .OutputArraySchema ,
46- cwl_v1_2 .OutputArraySchema ,
47- ]
43+ OutputArraySchema : TypeAlias = (
44+ cwl_v1_0 .OutputArraySchema | cwl_v1_1 .OutputArraySchema | cwl_v1_2 .OutputArraySchema
45+ )
4846"""Type union for a CWL v1.x OutputArraySchema object."""
49- OutputEnumSchema = Union [
50- cwl_v1_0 .OutputEnumSchema ,
51- cwl_v1_1 .OutputEnumSchema ,
52- cwl_v1_2 .OutputEnumSchema ,
53- ]
47+ OutputEnumSchema : TypeAlias = (
48+ cwl_v1_0 .OutputEnumSchema | cwl_v1_1 .OutputEnumSchema | cwl_v1_2 .OutputEnumSchema
49+ )
5450"""Type union for a CWL v1.x OutputEnumSchema object."""
55- OutputRecordField = Union [
56- cwl_v1_0 .OutputRecordField ,
57- cwl_v1_1 .OutputRecordField ,
58- cwl_v1_2 .OutputRecordField ,
59- ]
51+ OutputRecordField : TypeAlias = (
52+ cwl_v1_0 .OutputRecordField | cwl_v1_1 .OutputRecordField | cwl_v1_2 .OutputRecordField
53+ )
6054"""Type union for a CWL v1.x OutputRecordField object."""
61- OutputRecordSchema = Union [
62- cwl_v1_0 .OutputRecordSchema ,
63- cwl_v1_1 .OutputRecordSchema ,
64- cwl_v1_2 .OutputRecordSchema ,
65- ]
55+ OutputRecordSchema : TypeAlias = (
56+ cwl_v1_0 .OutputRecordSchema
57+ | cwl_v1_1 .OutputRecordSchema
58+ | cwl_v1_2 .OutputRecordSchema
59+ )
6660"""Type union for a CWL v1.x OutputRecordSchema object."""
67- OutputSchema = Union [
68- cwl_v1_0 .OutputSchema , cwl_v1_1 .OutputSchema , cwl_v1_2 .OutputSchema
69- ]
61+ OutputSchema : TypeAlias = (
62+ cwl_v1_0 .OutputSchema | cwl_v1_1 .OutputSchema | cwl_v1_2 .OutputSchema
63+ )
7064"""Type union for a CWL v1.x OutputSchema object."""
71- Workflow = Union [ cwl_v1_0 .Workflow , cwl_v1_1 .Workflow , cwl_v1_2 .Workflow ]
65+ Workflow : TypeAlias = cwl_v1_0 .Workflow | cwl_v1_1 .Workflow | cwl_v1_2 .Workflow
7266WorkflowTypes = (cwl_v1_0 .Workflow , cwl_v1_1 .Workflow , cwl_v1_2 .Workflow )
7367"""Type union for a CWL v1.x Workflow object."""
74- WorkflowInputParameter = Union [
75- cwl_v1_0 .InputParameter ,
76- cwl_v1_1 .WorkflowInputParameter ,
77- cwl_v1_2 .WorkflowInputParameter ,
78- ]
68+ WorkflowInputParameter : TypeAlias = (
69+ cwl_v1_0 .InputParameter
70+ | cwl_v1_1 .WorkflowInputParameter
71+ | cwl_v1_2 .WorkflowInputParameter
72+ )
7973"""Type union for a CWL v1.x WorkflowInputParameter object."""
80- WorkflowOutputParameter = Union [
81- cwl_v1_0 .WorkflowOutputParameter ,
82- cwl_v1_1 .WorkflowOutputParameter ,
83- cwl_v1_2 .WorkflowOutputParameter ,
84- ]
74+ WorkflowOutputParameter : TypeAlias = (
75+ cwl_v1_0 .WorkflowOutputParameter
76+ | cwl_v1_1 .WorkflowOutputParameter
77+ | cwl_v1_2 .WorkflowOutputParameter
78+ )
8579"""Type union for a CWL v1.x WorkflowOutputParameter object."""
86- WorkflowStep = Union [
87- cwl_v1_0 .WorkflowStep , cwl_v1_1 .WorkflowStep , cwl_v1_2 .WorkflowStep
88- ]
80+ WorkflowStep : TypeAlias = (
81+ cwl_v1_0 .WorkflowStep | cwl_v1_1 .WorkflowStep | cwl_v1_2 .WorkflowStep
82+ )
8983"""Type union for a CWL v1.x WorkflowStep object."""
90- ScatterWorkflowStep = Union [
91- cwl_v1_0 .WorkflowStep ,
92- cwl_v1_1 .WorkflowStep ,
93- cwl_v1_2 .WorkflowStep ,
94- ]
84+ ScatterWorkflowStep : TypeAlias = (
85+ cwl_v1_0 .WorkflowStep | cwl_v1_1 .WorkflowStep | cwl_v1_2 .WorkflowStep
86+ )
9587"""Type union for a CWL v1.x ScatterWorkflowStep object."""
96- LoopWorkflowStep = NoType
88+ LoopWorkflowStep : TypeAlias = NoType
9789"""Type union for a CWL v1.x LoopWorkflowStep object."""
98- WorkflowStepInput = Union [
99- cwl_v1_0 .WorkflowStepInput , cwl_v1_1 .WorkflowStepInput , cwl_v1_2 .WorkflowStepInput
100- ]
90+ WorkflowStepInput : TypeAlias = (
91+ cwl_v1_0 .WorkflowStepInput | cwl_v1_1 .WorkflowStepInput | cwl_v1_2 .WorkflowStepInput
92+ )
10193"""Type union for a CWL v1.x WorkflowStepInput object."""
102- WorkflowStepOutput = Union [
103- cwl_v1_0 .WorkflowStepOutput ,
104- cwl_v1_1 .WorkflowStepOutput ,
105- cwl_v1_2 .WorkflowStepOutput ,
106- ]
94+ WorkflowStepOutput : TypeAlias = (
95+ cwl_v1_0 .WorkflowStepOutput
96+ | cwl_v1_1 .WorkflowStepOutput
97+ | cwl_v1_2 .WorkflowStepOutput
98+ )
10799"""Type union for a CWL v1.x WorkflowStepOutput object."""
108- CommandLineTool = Union [
109- cwl_v1_0 .CommandLineTool , cwl_v1_1 .CommandLineTool , cwl_v1_2 .CommandLineTool
110- ]
100+ CommandLineTool : TypeAlias = (
101+ cwl_v1_0 .CommandLineTool | cwl_v1_1 .CommandLineTool | cwl_v1_2 .CommandLineTool
102+ )
111103CommandLineToolTypes = (
112104 cwl_v1_0 .CommandLineTool ,
113105 cwl_v1_1 .CommandLineTool ,
114106 cwl_v1_2 .CommandLineTool ,
115107)
116108"""Type union for a CWL v1.x CommandLineTool object."""
117- CommandLineBinding = Union [
118- cwl_v1_0 .CommandLineBinding ,
119- cwl_v1_1 .CommandLineBinding ,
120- cwl_v1_2 .CommandLineBinding ,
121- ]
109+ CommandLineBinding : TypeAlias = (
110+ cwl_v1_0 .CommandLineBinding
111+ | cwl_v1_1 .CommandLineBinding
112+ | cwl_v1_2 .CommandLineBinding
113+ )
114+
122115"""Type union for a CWL v1.x CommandLineBinding object."""
123- CommandOutputBinding = Union [
124- cwl_v1_0 .CommandOutputBinding ,
125- cwl_v1_1 .CommandOutputBinding ,
126- cwl_v1_2 .CommandOutputBinding ,
127- ]
116+ CommandOutputBinding : TypeAlias = (
117+ cwl_v1_0 .CommandOutputBinding
118+ | cwl_v1_1 .CommandOutputBinding
119+ | cwl_v1_2 .CommandOutputBinding
120+ )
128121"""Type union for a CWL v1.x CommandOutputBinding object."""
129- CommandInputParameter = Union [
130- cwl_v1_0 .CommandInputParameter ,
131- cwl_v1_1 .CommandInputParameter ,
132- cwl_v1_2 .CommandInputParameter ,
133- ]
122+ CommandInputParameter : TypeAlias = (
123+ cwl_v1_0 .CommandInputParameter
124+ | cwl_v1_1 .CommandInputParameter
125+ | cwl_v1_2 .CommandInputParameter
126+ )
134127"""Type union for a CWL v1.x CommandInputParameter object."""
135- CommandOutputParameter = Union [
136- cwl_v1_0 .CommandOutputParameter ,
137- cwl_v1_1 .CommandOutputParameter ,
138- cwl_v1_2 .CommandOutputParameter ,
139- ]
128+ CommandOutputParameter : TypeAlias = (
129+ cwl_v1_0 .CommandOutputParameter
130+ | cwl_v1_1 .CommandOutputParameter
131+ | cwl_v1_2 .CommandOutputParameter
132+ )
133+
140134"""Type union for a CWL v1.x CommandOutputParameter object."""
141- CommandOutputRecordField = Union [
142- cwl_v1_0 .CommandOutputRecordField ,
143- cwl_v1_1 .CommandOutputRecordField ,
144- cwl_v1_2 .CommandOutputRecordField ,
145- ]
135+ CommandOutputRecordField : TypeAlias = (
136+ cwl_v1_0 .CommandOutputRecordField
137+ | cwl_v1_1 .CommandOutputRecordField
138+ | cwl_v1_2 .CommandOutputRecordField
139+ )
146140"""Type union for a CWL v1.x CommandOutputRecordField object."""
147- ExpressionTool = Union [
148- cwl_v1_0 .ExpressionTool , cwl_v1_1 .ExpressionTool , cwl_v1_2 .ExpressionTool
149- ]
141+ ExpressionTool : TypeAlias = (
142+ cwl_v1_0 .ExpressionTool | cwl_v1_1 .ExpressionTool | cwl_v1_2 .ExpressionTool
143+ )
150144"""Type union for a CWL v1.x ExpressionTool object."""
151- ExpressionToolOutputParameter = Union [
152- cwl_v1_0 .ExpressionToolOutputParameter ,
153- cwl_v1_1 .ExpressionToolOutputParameter ,
154- cwl_v1_2 .ExpressionToolOutputParameter ,
155- ]
145+ ExpressionToolOutputParameter : TypeAlias = (
146+ cwl_v1_0 .ExpressionToolOutputParameter
147+ | cwl_v1_1 .ExpressionToolOutputParameter
148+ | cwl_v1_2 .ExpressionToolOutputParameter
149+ )
156150"""Type union for a CWL v1.x ExpressionToolOutputParameter object."""
157- DockerRequirement = Union [
158- cwl_v1_0 .DockerRequirement , cwl_v1_1 .DockerRequirement , cwl_v1_2 .DockerRequirement
159- ]
151+ DockerRequirement : TypeAlias = (
152+ cwl_v1_0 .DockerRequirement | cwl_v1_1 .DockerRequirement | cwl_v1_2 .DockerRequirement
153+ )
160154DockerRequirementTypes = (
161155 cwl_v1_0 .DockerRequirement ,
162156 cwl_v1_1 .DockerRequirement ,
163157 cwl_v1_2 .DockerRequirement ,
164158)
165159"""Type union for a CWL v1.x DockerRequirement object."""
166- Process = Union [ Workflow , CommandLineTool , ExpressionTool , cwl_v1_2 .Operation ]
160+ Process : TypeAlias = Workflow | CommandLineTool | ExpressionTool | cwl_v1_2 .Operation
167161"""Type Union for a CWL v1.x Process object."""
168- ProcessRequirement = Union [
169- cwl_v1_0 .ProcessRequirement ,
170- cwl_v1_1 .ProcessRequirement ,
171- cwl_v1_2 .ProcessRequirement ,
172- ]
162+ ProcessRequirement : TypeAlias = (
163+ cwl_v1_0 .ProcessRequirement
164+ | cwl_v1_1 .ProcessRequirement
165+ | cwl_v1_2 .ProcessRequirement
166+ )
173167"""Type Union for a CWL v1.x ProcessRequirement object."""
174168ProcessRequirementTypes = (
175169 cwl_v1_0 .ProcessRequirement ,
176170 cwl_v1_1 .ProcessRequirement ,
177171 cwl_v1_2 .ProcessRequirement ,
178172)
179- SoftwareRequirement = Union [
180- cwl_v1_0 .SoftwareRequirement ,
181- cwl_v1_1 .SoftwareRequirement ,
182- cwl_v1_2 .SoftwareRequirement ,
183- ]
173+ SoftwareRequirement : TypeAlias = (
174+ cwl_v1_0 .SoftwareRequirement
175+ | cwl_v1_1 .SoftwareRequirement
176+ | cwl_v1_2 .SoftwareRequirement
177+ )
184178SoftwareRequirementTypes = (
185179 cwl_v1_0 .SoftwareRequirement ,
186180 cwl_v1_1 .SoftwareRequirement ,
187181 cwl_v1_2 .SoftwareRequirement ,
188182)
189183"""Type union for a CWL v1.x SoftwareRequirement object."""
190- ArraySchema = Union [cwl_v1_0 .ArraySchema , cwl_v1_1 .ArraySchema , cwl_v1_2 .ArraySchema ]
191- InputArraySchema = Union [
192- cwl_v1_0 .InputArraySchema , cwl_v1_1 .InputArraySchema , cwl_v1_2 .InputArraySchema
193- ]
184+ ArraySchema : TypeAlias = (
185+ cwl_v1_0 .ArraySchema | cwl_v1_1 .ArraySchema | cwl_v1_2 .ArraySchema
186+ )
187+ InputArraySchema : TypeAlias = (
188+ cwl_v1_0 .InputArraySchema | cwl_v1_1 .InputArraySchema | cwl_v1_2 .InputArraySchema
189+ )
194190InputArraySchemaTypes = (
195191 cwl_v1_0 .InputArraySchema ,
196192 cwl_v1_1 .InputArraySchema ,
197193 cwl_v1_2 .InputArraySchema ,
198194)
199195"""Type Union for a CWL v1.x ArraySchema object."""
200- EnumSchema = Union [ cwl_v1_0 .EnumSchema , cwl_v1_1 .EnumSchema , cwl_v1_2 .EnumSchema ]
201- InputEnumSchema = Union [
202- cwl_v1_0 .InputEnumSchema , cwl_v1_1 .InputEnumSchema , cwl_v1_2 .InputEnumSchema
203- ]
196+ EnumSchema : TypeAlias = cwl_v1_0 .EnumSchema | cwl_v1_1 .EnumSchema | cwl_v1_2 .EnumSchema
197+ InputEnumSchema : TypeAlias = (
198+ cwl_v1_0 .InputEnumSchema | cwl_v1_1 .InputEnumSchema | cwl_v1_2 .InputEnumSchema
199+ )
204200InputEnumSchemaTypes = (
205201 cwl_v1_0 .InputEnumSchema ,
206202 cwl_v1_1 .InputEnumSchema ,
207203 cwl_v1_2 .InputEnumSchema ,
208204)
209205"""Type Union for a CWL v1.x EnumSchema object."""
210- RecordSchema = Union [
211- cwl_v1_0 .RecordSchema , cwl_v1_1 .RecordSchema , cwl_v1_2 .RecordSchema
212- ]
213- InputRecordSchema = Union [
214- cwl_v1_0 .InputRecordSchema , cwl_v1_1 .InputRecordSchema , cwl_v1_2 .InputRecordSchema
215- ]
206+ RecordSchema : TypeAlias = (
207+ cwl_v1_0 .RecordSchema | cwl_v1_1 .RecordSchema | cwl_v1_2 .RecordSchema
208+ )
209+ InputRecordSchema : TypeAlias = (
210+ cwl_v1_0 .InputRecordSchema | cwl_v1_1 .InputRecordSchema | cwl_v1_2 .InputRecordSchema
211+ )
216212InputRecordSchemaTypes = (
217213 cwl_v1_0 .InputRecordSchema ,
218214 cwl_v1_1 .InputRecordSchema ,
219215 cwl_v1_2 .InputRecordSchema ,
220216)
221217"""Type Union for a CWL v1.x RecordSchema object."""
222- File = Union [ cwl_v1_0 .File , cwl_v1_1 .File , cwl_v1_2 .File ]
218+ File : TypeAlias = cwl_v1_0 .File | cwl_v1_1 .File | cwl_v1_2 .File
223219"""Type Union for a CWL v1.x File object."""
224- SecondaryFileSchema = Union [cwl_v1_1 .SecondaryFileSchema , cwl_v1_2 .SecondaryFileSchema ]
220+ SecondaryFileSchema : TypeAlias = (
221+ cwl_v1_1 .SecondaryFileSchema | cwl_v1_2 .SecondaryFileSchema
222+ )
225223"""Type Union for a CWL v1.x SecondaryFileSchema object."""
226- Directory = Union [ cwl_v1_0 .Directory , cwl_v1_1 .Directory , cwl_v1_2 .Directory ]
224+ Directory : TypeAlias = cwl_v1_0 .Directory | cwl_v1_1 .Directory | cwl_v1_2 .Directory
227225"""Type Union for a CWL v1.x Directory object."""
228- Dirent = Union [ cwl_v1_0 .Dirent , cwl_v1_1 .Dirent , cwl_v1_2 .Dirent ]
226+ Dirent : TypeAlias = cwl_v1_0 .Dirent | cwl_v1_1 .Dirent | cwl_v1_2 .Dirent
229227"""Type Union for a CWL v1.x Dirent object."""
230- LoadContents = Union [
231- cwl_v1_1 .CommandInputParameter ,
232- cwl_v1_2 .CommandInputParameter ,
233- cwl_v1_1 .CommandOutputBinding ,
234- cwl_v1_2 .CommandOutputBinding ,
235- cwl_v1_1 .InputBinding ,
236- cwl_v1_2 .InputBinding ,
237- cwl_v1_1 .InputRecordField ,
238- cwl_v1_2 .InputRecordField ,
239- cwl_v1_1 .WorkflowInputParameter ,
240- cwl_v1_2 .WorkflowInputParameter ,
241- cwl_v1_1 .WorkflowStepInput ,
242- cwl_v1_2 .WorkflowStepInput ,
243- ]
228+ LoadContents : TypeAlias = (
229+ cwl_v1_1 .CommandInputParameter
230+ | cwl_v1_2 .CommandInputParameter
231+ | cwl_v1_1 .CommandOutputBinding
232+ | cwl_v1_2 .CommandOutputBinding
233+ | cwl_v1_1 .InputBinding
234+ | cwl_v1_2 .InputBinding
235+ | cwl_v1_1 .InputRecordField
236+ | cwl_v1_2 .InputRecordField
237+ | cwl_v1_1 .WorkflowInputParameter
238+ | cwl_v1_2 .WorkflowInputParameter
239+ | cwl_v1_1 .WorkflowStepInput
240+ | cwl_v1_2 .WorkflowStepInput
241+ )
244242"""Type Union for a CWL v1.x LoadContents object."""
245-
246- _Loader = Union [cwl_v1_0 ._Loader , cwl_v1_1 ._Loader , cwl_v1_2 ._Loader ]
243+ _Loader : TypeAlias = cwl_v1_0 ._Loader | cwl_v1_1 ._Loader | cwl_v1_2 ._Loader
247244"""Type union for a CWL v1.x _Loader."""
248245
249246
0 commit comments