@@ -425,9 +425,7 @@ def get_engine(self):
425
425
entry = engines [self .engine ]
426
426
except KeyError :
427
427
raise ContainerEngineException (
428
- "Container engine '{}' not found. Available engines: {}" .format (
429
- self .engine , "," .join (engines .keys ())
430
- )
428
+ f"Container engine '{ self .engine } ' not found. Available engines: { ',' .join (engines .keys ())} "
431
429
)
432
430
engine_class = entry .load ()
433
431
return engine_class (parent = self )
@@ -447,16 +445,11 @@ def fetch(self, url, ref, checkout_path):
447
445
spec = cp .detect (url , ref = ref )
448
446
if spec is not None :
449
447
picked_content_provider = cp
450
- self .log .info (
451
- "Picked {cp} content "
452
- "provider.\n " .format (cp = cp .__class__ .__name__ )
453
- )
448
+ self .log .info (f"Picked { cp .__class__ .__name__ } content provider.\n " )
454
449
break
455
450
456
451
if picked_content_provider is None :
457
- self .log .error (
458
- "No matching content provider found for " "{url}." .format (url = url )
459
- )
452
+ self .log .error (f"No matching content provider found for { url } ." )
460
453
461
454
swh_token = self .config .get ("swh_token" , self .swh_token )
462
455
if swh_token and isinstance (picked_content_provider , contentproviders .Swhid ):
@@ -488,8 +481,7 @@ def json_excepthook(self, etype, evalue, traceback):
488
481
Avoids non-JSON output on errors when using --json-logs
489
482
"""
490
483
self .log .error (
491
- "Error during build: %s" ,
492
- evalue ,
484
+ f"Error during build: { evalue } " ,
493
485
exc_info = (etype , evalue , traceback ),
494
486
extra = dict (phase = R2dState .FAILED ),
495
487
)
@@ -619,11 +611,9 @@ def start_container(self):
619
611
run_cmd = [
620
612
"jupyter" ,
621
613
"notebook" ,
622
- "--ip" ,
623
- "0.0.0.0" ,
624
- "--port" ,
625
- container_port ,
626
- f"--NotebookApp.custom_display_url=http://{ host_name } :{ host_port } "
614
+ "--ip=0.0.0.0" ,
615
+ f"--port={ container_port } " ,
616
+ f"--NotebookApp.custom_display_url=http://{ host_name } :{ host_port } " ,
627
617
"--NotebookApp.default_url=/lab" ,
628
618
]
629
619
else :
@@ -730,7 +720,7 @@ def build(self):
730
720
try :
731
721
docker_client = self .get_engine ()
732
722
except ContainerEngineException as e :
733
- self .log .error ("\n Container engine initialization error: %s \n " , e )
723
+ self .log .error (f "\n Container engine initialization error: { e } \n " )
734
724
self .exit (1 )
735
725
736
726
# If the source to be executed is a directory, continue using the
@@ -751,8 +741,7 @@ def build(self):
751
741
752
742
if self .find_image ():
753
743
self .log .info (
754
- "Reusing existing image ({}), not "
755
- "building." .format (self .output_image_spec )
744
+ f"Reusing existing image ({ self .output_image_spec } ), not building."
756
745
)
757
746
# no need to build, so skip to the end by `return`ing here
758
747
# this will still execute the finally clause and let's us
@@ -763,8 +752,7 @@ def build(self):
763
752
checkout_path = os .path .join (checkout_path , self .subdir )
764
753
if not os .path .isdir (checkout_path ):
765
754
self .log .error (
766
- "Subdirectory %s does not exist" ,
767
- self .subdir ,
755
+ f"Subdirectory { self .subdir } does not exist" ,
768
756
extra = dict (phase = R2dState .FAILED ),
769
757
)
770
758
raise FileNotFoundError (f"Could not find { checkout_path } " )
@@ -808,8 +796,7 @@ def build(self):
808
796
)
809
797
810
798
self .log .info (
811
- "Using %s builder\n " ,
812
- bp .__class__ .__name__ ,
799
+ f"Using { bp .__class__ .__name__ } builder\n " ,
813
800
extra = dict (phase = R2dState .BUILDING ),
814
801
)
815
802
0 commit comments