Skip to content

Commit 7687f47

Browse files
committed
add the new hints even if there isn't a hints section
1 parent cc747b2 commit 7687f47

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

cwlupgrader/main.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,19 @@ def _v1_0_to_v1_1(document):
117117
move_up_loadcontents(document)
118118
network_access = has_hint_or_req(document, "NetworkAccess")
119119
listing = has_hint_or_req(document, "LoadListingRequirement")
120-
if 'hints' in document:
121-
if isinstance(document['hints'], MutableSequence):
122-
if not network_access:
123-
document['hints'].append({"class": "NetworkAcess", "networkAccess": True})
124-
if not listing:
125-
document['hints'].append({"class": "LoadListingRequirement", "loadListing": "deep_listing"})
126-
elif isinstance(document['hints'], MutableMapping):
127-
if not network_access:
128-
document['hints']["NetworkAcess"] = {"networkAccess": True}
129-
if not listing:
130-
document['hints']["LoadListingRequirement"] = {"loadListing": "deep_listing"}
120+
hints = document.get('hints', {})
121+
if isinstance(hints, MutableSequence):
122+
if not network_access:
123+
hints.append({"class": "NetworkAcess", "networkAccess": True})
124+
if not listing:
125+
hints.append({"class": "LoadListingRequirement", "loadListing": "deep_listing"})
126+
elif isinstance(hints, MutableMapping):
127+
if not network_access:
128+
hints["NetworkAcess"] = {"networkAccess": True}
129+
if not listing:
130+
hints["LoadListingRequirement"] = {"loadListing": "deep_listing"}
131+
if 'hints' not in document:
132+
document['hints'] = hints
131133
elif document['class'] == 'ExpressionTool':
132134
move_up_loadcontents(document)
133135
cleanup_v1_0_input_bindings(document)

0 commit comments

Comments
 (0)