@@ -78,7 +78,6 @@ def copy_job_order(
7878 return customised_job
7979
8080
81-
8281class ProvenanceProfile :
8382 """
8483 Provenance profile.
@@ -261,11 +260,9 @@ def evaluate(
261260 # # add nested annotations
262261 # # how much of this can we reuse from _add_nested_annotations?
263262 # # how do we identify the correct file to write to? self.workflow_run_uri?
264- # #
263+ # #
265264 # pass
266265
267-
268-
269266 def record_process_start (
270267 self , process : Process , job : JobsType , process_run_id : Optional [str ] = None
271268 ) -> Optional [str ]:
@@ -314,14 +311,16 @@ def record_process_end(
314311 self .generate_output_prov (outputs , process_run_id , process_name )
315312 self .document .wasEndedBy (process_run_id , None , self .workflow_run_uri , when )
316313
317- def _add_nested_annotations (self , annotation_key , annotation_value , e : ProvEntity ) -> ProvEntity :
314+ def _add_nested_annotations (
315+ self , annotation_key , annotation_value , e : ProvEntity
316+ ) -> ProvEntity :
318317 """Propagate input data annotations to provenance."""
319318 # Change https:// into http:// first
320- schema2_uri = "https://schema.org/"
319+ schema2_uri = "https://schema.org/"
321320 if schema2_uri in annotation_key :
322- annotation_key = SCHEMA [annotation_key .replace (schema2_uri , '' )].uri
323-
324- if not isinstance (annotation_value , (MutableSequence , MutableMapping )):
321+ annotation_key = SCHEMA [annotation_key .replace (schema2_uri , "" )].uri
322+
323+ if not isinstance (annotation_value , (MutableSequence , MutableMapping )):
325324 e .add_attributes ({annotation_key : str (annotation_value )})
326325 elif isinstance (annotation_value , MutableSequence ):
327326 for item_value in annotation_value :
@@ -331,8 +330,10 @@ def _add_nested_annotations(self, annotation_key, annotation_value, e: ProvEntit
331330 nested_entity = self .document .entity (nested_id )
332331 e .add_attributes ({annotation_key : nested_entity .identifier })
333332 for nested_key in annotation_value :
334- nested_value = annotation_value [nested_key ]
335- nested_entity = self ._add_nested_annotations (nested_key , nested_value , nested_entity )
333+ nested_value = annotation_value [nested_key ]
334+ nested_entity = self ._add_nested_annotations (
335+ nested_key , nested_value , nested_entity
336+ )
336337 return e
337338
338339 def declare_file (self , value : CWLObjectType ) -> Tuple [ProvEntity , ProvEntity , str ]:
@@ -396,15 +397,21 @@ def declare_file(self, value: CWLObjectType) -> Tuple[ProvEntity, ProvEntity, st
396397 self .document .specializationOf (file_entity , entity )
397398
398399 # Identify all schema annotations
399- schema_annotations = dict ([(v , value [v ]) for v in value .keys () if 'schema.org' in v ])
400+ schema_annotations = dict (
401+ [(v , value [v ]) for v in value .keys () if "schema.org" in v ]
402+ )
400403
401404 # Transfer SCHEMA annotations to provenance
402405 for s in schema_annotations :
403406 if "additionalType" in s :
404- additional_type = schema_annotations [s ].split (sep = '/' )[- 1 ] # find better method?
405- file_entity .add_attributes ( {PROV_TYPE : SCHEMA [additional_type ]})
406- else :
407- file_entity = self ._add_nested_annotations (s , schema_annotations [s ], file_entity )
407+ additional_type = schema_annotations [s ].split (sep = "/" )[
408+ - 1
409+ ] # find better method?
410+ file_entity .add_attributes ({PROV_TYPE : SCHEMA [additional_type ]})
411+ else :
412+ file_entity = self ._add_nested_annotations (
413+ s , schema_annotations [s ], file_entity
414+ )
408415
409416 # Transfer format annotations to provenance:
410417 if "format" in value :
@@ -517,18 +524,22 @@ def declare_directory(self, value: CWLObjectType) -> ProvEntity:
517524
518525 coll .add_attributes (coll_attribs )
519526 coll_b .add_attributes (coll_b_attribs )
520-
527+
521528 # Identify all schema annotations
522- schema_annotations = dict ([(v , value [v ]) for v in value .keys () if 'schema.org' in v ])
529+ schema_annotations = dict (
530+ [(v , value [v ]) for v in value .keys () if "schema.org" in v ]
531+ )
523532
524533 # Transfer SCHEMA annotations to provenance
525534 for s in schema_annotations :
526535 if "additionalType" in s :
527- additional_type = schema_annotations [s ].split (sep = '/' )[- 1 ] # find better method?
528- coll .add_attributes ( {PROV_TYPE : SCHEMA [additional_type ]})
536+ additional_type = schema_annotations [s ].split (sep = "/" )[
537+ - 1
538+ ] # find better method?
539+ coll .add_attributes ({PROV_TYPE : SCHEMA [additional_type ]})
529540 elif "hasPart" not in s :
530541 coll = self ._add_nested_annotations (s , schema_annotations [s ], coll )
531-
542+
532543 # Also Save ORE Folder as annotation metadata
533544 ore_doc = ProvDocument ()
534545 ore_doc .add_namespace (ORE )
0 commit comments