Skip to content

Commit 9b0ba78

Browse files
committed
Revert "switch to ruamel.yaml, use C loader if available, only load safely (#63)"
This reverts commit 6e0c04f.
1 parent 6e0c04f commit 9b0ba78

File tree

7 files changed

+12
-21
lines changed

7 files changed

+12
-21
lines changed

cwltool/cwltest.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
import sys
88
import shutil
99
import tempfile
10-
import ruamel.yaml as yaml
11-
try:
12-
from ruamel.yaml import CSafeLoader as SafeLoader
13-
except ImportError:
14-
from ruamel.yaml import SafeLoader
15-
10+
import yaml
11+
import yaml.scanner
1612
import pipes
1713
import logging
1814
import schema_salad.ref_resolver
@@ -90,7 +86,7 @@ def run_test(args, i, t): # type: (argparse.Namespace, Any, Dict[str,str]) -> i
9086
t["job"]]
9187

9288
outstr = subprocess.check_output(test_command)
93-
out = yaml.load(outstr, Loader=SafeLoader)
89+
out = yaml.load(outstr)
9490
if not isinstance(out, dict):
9591
raise ValueError("Non-dict value parsed from output string.")
9692
except ValueError as v:
@@ -159,7 +155,7 @@ def main(): # type: () -> int
159155
return 1
160156

161157
with open(args.test) as f:
162-
tests = yaml.load(f, Loader=SafeLoader)
158+
tests = yaml.load(f)
163159

164160
failures = 0
165161
unsupported = 0

cwltool/draft2tool.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
import os
77
from .pathmapper import PathMapper, DockerPathMapper
88
from .job import CommandLineJob
9-
import ruamel.yaml as yaml
10-
try:
11-
from ruamel.yaml import CSafeLoader as SafeLoader
12-
except ImportError:
13-
from ruamel.yaml import SafeLoader
9+
import yaml
1410
import glob
1511
import logging
1612
import hashlib
@@ -302,7 +298,7 @@ def collect_output_ports(self, ports, builder, outdir):
302298
custom_output = os.path.join(outdir, "cwl.output.json")
303299
if builder.fs_access.exists(custom_output):
304300
with builder.fs_access.open(custom_output, "r") as f:
305-
ret = yaml.load(f, Loader=SafeLoader)
301+
ret = yaml.load(f)
306302
_logger.debug(u"Raw output from %s: %s", custom_output, json.dumps(ret, indent=4))
307303
adjustFileObjs(ret, remove_hostfs)
308304
adjustFileObjs(ret,

cwltool/expression.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import os
77
from .errors import WorkflowException
8+
import yaml
89
import schema_salad.validate as validate
910
import schema_salad.ref_resolver
1011
from . import sandboxjs

cwltool/job.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import tempfile
55
import glob
66
import json
7+
import yaml
78
import logging
89
import sys
910
import requests

cwltool/main.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
import tempfile
1414
import schema_salad.jsonld_context
1515
import schema_salad.makedoc
16-
import ruamel.yaml as yaml
17-
try:
18-
from ruamel.yaml import CSafeLoader as SafeLoader
19-
except ImportError:
20-
from ruamel.yaml import SafeLoader
16+
import yaml
2117
import urlparse
2218
from . import process
2319
from . import job
@@ -423,7 +419,7 @@ def load_job_order(args, t, parser, stdin, print_input_deps=False, relative_deps
423419
if len(args.job_order) == 1 and args.job_order[0][0] != "-":
424420
job_order_file = args.job_order[0]
425421
elif len(args.job_order) == 1 and args.job_order[0] == "-":
426-
job_order_object = yaml.load(stdin, Loader=SafeLoader)
422+
job_order_object = yaml.load(stdin)
427423
job_order_object, _ = loader.resolve_all(job_order_object, "")
428424
else:
429425
job_order_file = None

cwltool/process.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import schema_salad.validate as validate
66
import copy
7+
import yaml
78
import copy
89
import logging
910
import pprint

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
'schemas/draft-3/salad/schema_salad/metaschema/*.md']},
3333
install_requires=[
3434
'requests',
35-
'ruamel.yaml',
35+
'PyYAML',
3636
'rdflib >= 4.1.0',
3737
'rdflib-jsonld >= 0.3.0',
3838
'shellescape',

0 commit comments

Comments
 (0)