|
1 | 1 | import copy |
2 | 2 | import logging |
3 | | -import json |
4 | 3 | import glob |
5 | 4 | import os |
6 | 5 | from pathlib import Path |
7 | 6 | import re |
8 | | -import sys |
9 | 7 | import tempfile |
10 | | -import traceback |
11 | 8 | from typing import Any, Dict, Union |
12 | 9 |
|
13 | 10 | import cwltool.load_tool |
|
16 | 13 | import docker |
17 | 14 |
|
18 | 15 |
|
19 | | -from . import input_output as io, utils_cwl, cli |
20 | | -from .python_cwl_adapter import import_python_file |
| 16 | +from . import utils_cwl, cli |
21 | 17 | from .wic_types import Cwl, NodeData, RoseTree, StepId, Tool, Tools, Json |
22 | 18 |
|
23 | 19 |
|
@@ -182,19 +178,21 @@ def cwl_update_inline_runtag(cwl: Cwl, path: Path, relative_run_path: bool) -> C |
182 | 178 | cwl_mod = copy.deepcopy(cwl) |
183 | 179 | for step in cwl_mod['steps']: |
184 | 180 | runtag_orig = step.get('run', '') |
185 | | - if isinstance(runtag_orig, str) and runtag_orig.endswith('.cwl'): |
186 | | - if relative_run_path: |
187 | | - yml_path = Path.cwd() / path / runtag_orig |
188 | | - else: |
189 | | - yml_path = Path(runtag_orig) # Assume absolute path in the runtag |
190 | | - with open(yml_path, mode='r', encoding='utf-8') as f: |
191 | | - runtag_raw = yaml.safe_load(f.read()) |
192 | | - # local $namespace and $schema tag shouldn't be in inline cwl steps |
193 | | - runtag_raw.pop('$namespaces', None) |
194 | | - runtag_raw.pop('$schemas', None) |
195 | | - step['run'] = runtag_raw |
196 | | - else: |
197 | | - pass # We only care if the runtag is a cwl filepath |
| 181 | + match runtag_orig: |
| 182 | + case str(): |
| 183 | + if runtag_orig.endswith('.cwl'): |
| 184 | + if relative_run_path: |
| 185 | + yml_path = Path.cwd() / path / runtag_orig |
| 186 | + else: |
| 187 | + yml_path = Path(runtag_orig) # Assume absolute path in the runtag |
| 188 | + with open(yml_path, mode='r', encoding='utf-8') as f: |
| 189 | + runtag_raw = yaml.safe_load(f.read()) |
| 190 | + # local $namespace and $schema tag shouldn't be in inline cwl steps |
| 191 | + runtag_raw.pop('$namespaces', None) |
| 192 | + runtag_raw.pop('$schemas', None) |
| 193 | + step['run'] = runtag_raw |
| 194 | + case _: |
| 195 | + pass # We only care if the runtag is a cwl filepath |
198 | 196 | return cwl_mod |
199 | 197 |
|
200 | 198 |
|
|
0 commit comments