Skip to content

Commit 1c25ba6

Browse files
authored
Merge pull request #944 from common-workflow-language/update_update
remove unused updater code
2 parents 1424504 + 767d3ed commit 1c25ba6

File tree

1 file changed

+1
-89
lines changed

1 file changed

+1
-89
lines changed

cwltool/update.py

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -16,95 +16,6 @@
1616
from .utils import visit_class
1717

1818

19-
def find_id(doc, frg): # type: (Any, Any) -> Optional[MutableMapping]
20-
if isinstance(doc, MutableMapping):
21-
if "id" in doc and doc["id"] == frg:
22-
return doc
23-
for key in doc:
24-
found = find_id(doc[key], frg)
25-
if found:
26-
return found
27-
if isinstance(doc, MutableSequence):
28-
for entry in doc:
29-
found = find_id(entry, frg)
30-
if found:
31-
return found
32-
return None
33-
34-
35-
def fixType(doc): # type: (Any) -> Any
36-
if isinstance(doc, MutableSequence):
37-
for i, f in enumerate(doc):
38-
doc[i] = fixType(f)
39-
return doc
40-
41-
if isinstance(doc, string_types):
42-
if doc not in (
43-
"null", "boolean", "int", "long", "float", "double", "string",
44-
"File", "record", "enum", "array", "Any") and "#" not in doc:
45-
return "#" + doc
46-
return doc
47-
48-
digits = re.compile(r"\d+")
49-
50-
51-
def updateScript(sc): # type: (Text) -> Text
52-
sc = sc.replace("$job", "inputs")
53-
sc = sc.replace("$tmpdir", "runtime.tmpdir")
54-
sc = sc.replace("$outdir", "runtime.outdir")
55-
sc = sc.replace("$self", "self")
56-
return sc
57-
58-
59-
def _updateDev2Script(ent): # type: (Any) -> Any
60-
if isinstance(ent, MutableMapping) and "engine" in ent:
61-
if ent["engine"] == "https://w3id.org/cwl/cwl#JsonPointer":
62-
sp = ent["script"].split("/")
63-
if sp[0] in ("tmpdir", "outdir"):
64-
return u"$(runtime.%s)" % sp[0]
65-
if not sp[0]:
66-
sp.pop(0)
67-
front = sp.pop(0)
68-
sp = [Text(i) if digits.match(i) else "'" + i + "'"
69-
for i in sp]
70-
if front == "job":
71-
return u"$(inputs[%s])" % ']['.join(sp)
72-
if front == "context":
73-
return u"$(self[%s])" % ']['.join(sp)
74-
else:
75-
sc = updateScript(ent["script"])
76-
if sc[0] == "{":
77-
return "$" + sc
78-
return u"$(%s)" % sc
79-
return ent
80-
81-
def traverseImport(doc, loader, baseuri, func):
82-
# type: (Any, Loader, Text, Callable[[Any, Loader, Text], Any]) -> Any
83-
if "$import" in doc:
84-
if doc["$import"][0] == "#":
85-
return doc["$import"]
86-
imp = urllib.parse.urljoin(baseuri, doc["$import"])
87-
impLoaded = loader.fetch(imp)
88-
r = {} # type: MutableMapping[Text, Any]
89-
if isinstance(impLoaded, MutableSequence):
90-
r = {"$graph": impLoaded}
91-
elif isinstance(impLoaded, MutableMapping):
92-
r = impLoaded
93-
else:
94-
raise Exception("Unexpected code path.")
95-
r["id"] = imp
96-
_, frag = urllib.parse.urldefrag(imp)
97-
if frag:
98-
frag = "#" + frag
99-
r = find_id(r, frag) # type: ignore
100-
return func(r, loader, imp)
101-
102-
def v1_0dev4to1_0(doc, loader, baseuri): # pylint: disable=unused-argument
103-
# type: (Any, Loader, Text) -> Tuple[Any, Text]
104-
"""Public updater for v1.0.dev4 to v1.0."""
105-
return (doc, "v1.0")
106-
107-
10819
def v1_0to1_1_0dev1(doc, loader, baseuri): # pylint: disable=unused-argument
10920
# type: (Any, Loader, Text) -> Tuple[Any, Text]
11021
"""Public updater for v1.0 to v1.1.0-dev1."""
@@ -134,6 +45,7 @@ def add_networkaccess(t):
13445
ALLUPDATES.update(DEVUPDATES)
13546

13647
LATEST = u"v1.0"
48+
#LATEST = u"v1.1.0-dev1"
13749

13850

13951
def identity(doc, loader, baseuri): # pylint: disable=unused-argument

0 commit comments

Comments
 (0)