@@ -374,7 +374,7 @@ def _info_set(bag, key):
374374 if isinstance (v , list ):
375375 return set (v )
376376 else :
377- return set ([ v ])
377+ return { v }
378378
379379
380380def _simpler_uuid (uri ):
@@ -410,7 +410,7 @@ def _prov_attr(attr, elem):
410410 "provn" : 'text/provenance-notation; charset="UTF-8"' ,
411411 "nt" : "application/n-triples" ,
412412}
413- EXTENSIONS = dict (( v , k ) for (k , v ) in MEDIA_TYPES .items ())
413+ EXTENSIONS = { v : k for (k , v ) in MEDIA_TYPES .items ()}
414414
415415
416416def _prov_format (ro , uri , media_type ):
@@ -694,9 +694,9 @@ def validate_ro(self, full_validation=False):
694694 ro = self .ro
695695 args = self .args
696696 # If it has this prefix, it's probably OK
697- cwlprov = set (
697+ cwlprov = {
698698 p for p in ro .conformsTo if p .startswith ("https://w3id.org/cwl/prov/" )
699- )
699+ }
700700 if not cwlprov :
701701 if full_validation or not args .quiet :
702702 _logger .warning ("Missing CWLProv profile: %s" , ro .bag .path )
@@ -726,9 +726,9 @@ def info(self):
726726 if not args .quiet :
727727 self .print (ro .bag .info .get ("External-Description" , "Research Object" ))
728728 self .print ("Research Object ID: %s" % ro .id )
729- cwlprov = set (
729+ cwlprov = {
730730 p for p in ro .conformsTo if p .startswith ("https://w3id.org/cwl/prov/" )
731- )
731+ }
732732 if cwlprov :
733733 self .print ("Profile: %s" % many (cwlprov ))
734734 w = ro .workflow_id
@@ -835,7 +835,7 @@ def prov(self):
835835 if args .formats :
836836 format = ro .mediatype (prov ) or ""
837837 format = EXTENSIONS .get (format , format )
838- self .print ("%s %s" % ( format , (self ._resource_path (prov ))) )
838+ self .print (f" { format } { (self ._resource_path (prov ))} " )
839839 else :
840840 self .print ("%s" % self ._resource_path (prov ))
841841 else :
@@ -1112,7 +1112,7 @@ def runs(self):
11121112 return Status .UNKNOWN_RUN
11131113 label = first (activity .get_attribute ("prov:label" )) or ""
11141114 is_master = run == ro .workflow_id
1115- self .print ("%s %s %s" % (name , is_master and "*" or " " , label ))
1115+ self .print ("{} {} {}" . format (name , is_master and "*" or " " , label ))
11161116 else :
11171117 self .print (name )
11181118 if self .hints :
@@ -1166,7 +1166,7 @@ def rerun(self):
11661166 )
11671167 return Status .NOT_IMPLEMENTED
11681168 if run .startswith ("#" ):
1169- wf_arg = "%s%s" % ( wf_file , run )
1169+ wf_arg = f" { wf_file } { run } "
11701170 _logger .info ("Tool %s" , wf_arg )
11711171 else :
11721172 _logger .warning (
@@ -1262,7 +1262,7 @@ def _usage(self, activity_id, prov_doc):
12621262 time = _prov_attr (PROV_ATTR_TIME , u )
12631263 if args .start and args .end :
12641264 # 2 col timestamps
1265- time_part = "%s %s " % (
1265+ time_part = "{} {} " . format (
12661266 time or "(unknown usage time) " ,
12671267 TIME_PADDING ,
12681268 )
@@ -1271,7 +1271,7 @@ def _usage(self, activity_id, prov_doc):
12711271 time_part = "%s " % (time or "(unknown usage time) " )
12721272 else :
12731273 time_part = ""
1274- self .print ("%sIn %s < %s" % (time_part , entity_id , role or "" ))
1274+ self .print ("{}In {} < {}" . format (time_part , entity_id , role or "" ))
12751275
12761276 def _generation (self , activity_id , prov_doc ):
12771277 args = self .args
@@ -1287,7 +1287,7 @@ def _generation(self, activity_id, prov_doc):
12871287 time = _prov_attr (PROV_ATTR_TIME , g )
12881288 if args .start and args .end :
12891289 # 2 col timestamps
1290- time_part = "%s %s " % (
1290+ time_part = "{} {} " . format (
12911291 TIME_PADDING ,
12921292 time or "(unknown generation time)" ,
12931293 )
@@ -1296,7 +1296,7 @@ def _generation(self, activity_id, prov_doc):
12961296 time_part = "%s " % (time or "(unknown generation time)" )
12971297 else :
12981298 time_part = ""
1299- self .print ("%sOut %s > %s" % (time_part , entity_id , role or "" ))
1299+ self .print ("{}Out {} > {}" . format (time_part , entity_id , role or "" ))
13001300
13011301 def print (self , msg = "" , * args ):
13021302 if args and isinstance (msg , str ) and "%" in msg :
@@ -1343,11 +1343,11 @@ def run(self):
13431343 padded_start_time = ""
13441344 if args .end and args .start :
13451345 # 2 columns
1346- padded_start_time = "%s %s " % ( start_time , TIME_PADDING )
1346+ padded_start_time = f" { start_time } { TIME_PADDING } "
13471347 elif args .end or args .start :
13481348 # 1 column, we don't care which
13491349 padded_start_time = "%s " % (start_time )
1350- self .print ("%sFlow %s [%s" % ( padded_start_time , name , label ) )
1350+ self .print (f" { padded_start_time } Flow { name } [ { label } " )
13511351
13521352 # inputs
13531353 self ._usage (activity_id , prov_doc )
@@ -1411,7 +1411,7 @@ def run(self):
14111411 # end
14121412 padded_end_time = ""
14131413 if args .end and args .start :
1414- padded_end_time = "%s %s " % ( TIME_PADDING , end_time )
1414+ padded_end_time = f" { TIME_PADDING } { end_time } "
14151415 elif args .end or args .start :
14161416 padded_end_time = "%s " % (end_time )
14171417
@@ -1422,7 +1422,7 @@ def run(self):
14221422 else :
14231423 w_duration = " (unknown duration)"
14241424
1425- self .print ("%sFlow %s ]%s%s" % ( padded_end_time , name , label , w_duration ) )
1425+ self .print (f" { padded_end_time } Flow { name } ] { label } { w_duration } " )
14261426
14271427 if self .hints :
14281428 print ("Legend:" )
0 commit comments