Skip to content

Commit b3e5da9

Browse files
author
Peter Amstutz
committed
Fix provenance tests
1 parent 81038c9 commit b3e5da9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cwltool/provenance.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from .pathmapper import get_listing
4848
from .process import shortname, Process # pylint: disable=unused-import
4949
from .stdfsaccess import StdFsAccess # pylint: disable=unused-import
50-
from .utils import versionstring
50+
from .utils import versionstring, json_dumps
5151

5252
GET_PW_NAM = None # type: Optional[Callable[[str], struct_passwd]]
5353
try:
@@ -306,7 +306,7 @@ def _valid_orcid(orcid): # type: (Optional[Text]) -> Optional[Text]
306306
class CreateProvProfile():
307307
"""
308308
Provenance profile.
309-
309+
310310
Populated as the workflow runs.
311311
"""
312312

@@ -727,7 +727,7 @@ def declare_artefact(self, value):
727727
data_id, {provM.PROV_TYPE: WFPROV["Artifact"],
728728
provM.PROV_VALUE: str(value)})
729729

730-
if isinstance(value, dict):
730+
if isinstance(value, MutableMapping):
731731
if "@id" in value:
732732
# Already processed this value, but it might not be in this PROV
733733
entities = self.document.get_record(value["@id"])
@@ -1315,7 +1315,7 @@ def _write_ro_manifest(self):
13151315
manifest["aggregates"] = self._ro_aggregates()
13161316
manifest["annotations"] = self._ro_annotations()
13171317

1318-
json_manifest = json.dumps(manifest, indent=4, ensure_ascii=False)
1318+
json_manifest = json_dumps(manifest, indent=4, ensure_ascii=False)
13191319
rel_path = posixpath.join(_posix_path(METADATA), filename)
13201320
with self.write_bag_file(rel_path) as manifest_file:
13211321
manifest_file.write(json_manifest + "\n")
@@ -1371,7 +1371,7 @@ def generate_snapshot(self, prov_dep):
13711371
pass # FIXME: avoids duplicate snapshotting; need better solution
13721372
elif key in ("secondaryFiles", "listing"):
13731373
for files in value:
1374-
if isinstance(files, dict):
1374+
if isinstance(files, MutableMapping):
13751375
self.generate_snapshot(files)
13761376
else:
13771377
pass
@@ -1502,7 +1502,7 @@ def create_job(self,
15021502
relativised_input_objecttemp = {} # type: Dict[Any, Any]
15031503
self._relativise_files(copied)
15041504
rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-job.json")
1505-
j = json.dumps(copied, indent=4, ensure_ascii=False)
1505+
j = json_dumps(copied, indent=4, ensure_ascii=False)
15061506
with self.write_bag_file(rel_path) as file_path:
15071507
file_path.write(j + u"\n")
15081508
_logger.debug(u"[provenance] Generated customised job file: %s",
@@ -1513,7 +1513,7 @@ def create_job(self,
15131513
# 2) for other attributes, the actual value.
15141514
relativised_input_objecttemp = {}
15151515
for key, value in copied.items():
1516-
if isinstance(value, dict):
1516+
if isinstance(value, MutableMapping):
15171517
if value.get("class") in ("File", "Directory"):
15181518
relativised_input_objecttemp[key] = value
15191519
else:
@@ -1528,7 +1528,7 @@ def _relativise_files(self, structure):
15281528
# Base case - we found a File we need to update
15291529
_logger.debug(u"[provenance] Relativising: %s", structure)
15301530

1531-
if isinstance(structure, dict):
1531+
if isinstance(structure, MutableMapping):
15321532
if structure.get("class") == "File":
15331533
relative_path = None
15341534
if "checksum" in structure:

0 commit comments

Comments
 (0)