47
47
from .pathmapper import get_listing
48
48
from .process import shortname , Process # pylint: disable=unused-import
49
49
from .stdfsaccess import StdFsAccess # pylint: disable=unused-import
50
- from .utils import versionstring
50
+ from .utils import versionstring , json_dumps
51
51
52
52
GET_PW_NAM = None # type: Optional[Callable[[str], struct_passwd]]
53
53
try :
@@ -306,7 +306,7 @@ def _valid_orcid(orcid): # type: (Optional[Text]) -> Optional[Text]
306
306
class CreateProvProfile ():
307
307
"""
308
308
Provenance profile.
309
-
309
+
310
310
Populated as the workflow runs.
311
311
"""
312
312
@@ -727,7 +727,7 @@ def declare_artefact(self, value):
727
727
data_id , {provM .PROV_TYPE : WFPROV ["Artifact" ],
728
728
provM .PROV_VALUE : str (value )})
729
729
730
- if isinstance (value , dict ):
730
+ if isinstance (value , MutableMapping ):
731
731
if "@id" in value :
732
732
# Already processed this value, but it might not be in this PROV
733
733
entities = self .document .get_record (value ["@id" ])
@@ -1315,7 +1315,7 @@ def _write_ro_manifest(self):
1315
1315
manifest ["aggregates" ] = self ._ro_aggregates ()
1316
1316
manifest ["annotations" ] = self ._ro_annotations ()
1317
1317
1318
- json_manifest = json . dumps (manifest , indent = 4 , ensure_ascii = False )
1318
+ json_manifest = json_dumps (manifest , indent = 4 , ensure_ascii = False )
1319
1319
rel_path = posixpath .join (_posix_path (METADATA ), filename )
1320
1320
with self .write_bag_file (rel_path ) as manifest_file :
1321
1321
manifest_file .write (json_manifest + "\n " )
@@ -1371,7 +1371,7 @@ def generate_snapshot(self, prov_dep):
1371
1371
pass # FIXME: avoids duplicate snapshotting; need better solution
1372
1372
elif key in ("secondaryFiles" , "listing" ):
1373
1373
for files in value :
1374
- if isinstance (files , dict ):
1374
+ if isinstance (files , MutableMapping ):
1375
1375
self .generate_snapshot (files )
1376
1376
else :
1377
1377
pass
@@ -1502,7 +1502,7 @@ def create_job(self,
1502
1502
relativised_input_objecttemp = {} # type: Dict[Any, Any]
1503
1503
self ._relativise_files (copied )
1504
1504
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 )
1506
1506
with self .write_bag_file (rel_path ) as file_path :
1507
1507
file_path .write (j + u"\n " )
1508
1508
_logger .debug (u"[provenance] Generated customised job file: %s" ,
@@ -1513,7 +1513,7 @@ def create_job(self,
1513
1513
# 2) for other attributes, the actual value.
1514
1514
relativised_input_objecttemp = {}
1515
1515
for key , value in copied .items ():
1516
- if isinstance (value , dict ):
1516
+ if isinstance (value , MutableMapping ):
1517
1517
if value .get ("class" ) in ("File" , "Directory" ):
1518
1518
relativised_input_objecttemp [key ] = value
1519
1519
else :
@@ -1528,7 +1528,7 @@ def _relativise_files(self, structure):
1528
1528
# Base case - we found a File we need to update
1529
1529
_logger .debug (u"[provenance] Relativising: %s" , structure )
1530
1530
1531
- if isinstance (structure , dict ):
1531
+ if isinstance (structure , MutableMapping ):
1532
1532
if structure .get ("class" ) == "File" :
1533
1533
relative_path = None
1534
1534
if "checksum" in structure :
0 commit comments