@@ -134,6 +134,7 @@ def cwl_version(yaml: Any) -> Optional[str]:
134
134
def load_document_by_uri (
135
135
path : Union [str , Path ],
136
136
loadingOptions : Optional [LoadingOptions ] = None ,
137
+ load_all : bool = False ,
137
138
) -> Any :
138
139
"""Load a CWL object from a URI or a path."""
139
140
if isinstance (path , str ):
@@ -153,44 +154,47 @@ def load_document_by_uri(
153
154
loadingOptions = cwl_v1_2 .LoadingOptions (fileuri = baseuri )
154
155
155
156
doc = loadingOptions .fetcher .fetch_text (real_path )
156
- return load_document_by_string (doc , baseuri , loadingOptions , id_ )
157
+ return load_document_by_string (doc , baseuri , loadingOptions , id_ , load_all )
157
158
158
159
159
160
def load_document (
160
161
doc : Any ,
161
162
baseuri : Optional [str ] = None ,
162
163
loadingOptions : Optional [LoadingOptions ] = None ,
163
164
id_ : Optional [str ] = None ,
165
+ load_all : bool = False ,
164
166
) -> Any :
165
167
"""Load a CWL object from a serialized YAML string or a YAML object."""
166
168
if baseuri is None :
167
169
baseuri = cwl_v1_0 .file_uri (os .getcwd ()) + "/"
168
170
if isinstance (doc , str ):
169
171
return load_document_by_string (doc , baseuri , loadingOptions , id_ )
170
- return load_document_by_yaml (doc , baseuri , loadingOptions , id_ )
172
+ return load_document_by_yaml (doc , baseuri , loadingOptions , id_ , load_all )
171
173
172
174
173
175
def load_document_by_string (
174
176
string : str ,
175
177
uri : str ,
176
178
loadingOptions : Optional [LoadingOptions ] = None ,
177
179
id_ : Optional [str ] = None ,
180
+ load_all : bool = False ,
178
181
) -> Any :
179
182
"""Load a CWL object from a serialized YAML string."""
180
183
yaml = yaml_no_ts ()
181
184
result = yaml .load (string )
182
- return load_document_by_yaml (result , uri , loadingOptions , id_ )
185
+ return load_document_by_yaml (result , uri , loadingOptions , id_ , load_all )
183
186
184
187
185
188
def load_document_by_yaml (
186
189
yaml : Any ,
187
190
uri : str ,
188
191
loadingOptions : Optional [LoadingOptions ] = None ,
189
192
id_ : Optional [str ] = None ,
193
+ load_all : bool = False ,
190
194
) -> Any :
191
195
"""Load a CWL object from a YAML object."""
192
196
version = cwl_version (yaml )
193
- if "$graph" in yaml :
197
+ if "$graph" in yaml and not load_all :
194
198
yaml = _get_id_from_graph (yaml , id_ )
195
199
yaml ["cwlVersion" ] = version
196
200
if version == "v1.0" :
0 commit comments