@@ -67,10 +67,10 @@ async def create(cls, max_retries=3, retry_delay=2.0) -> 'Database':
6767 if retry :
6868 if attempt == max_retries - 1 :
6969 container .stop ()
70- msg = f" Failed to initialize database container after { max_retries } attempts"
71- raise RuntimeError (f" { msg } : { error } " ) from error
70+ msg = f' Failed to initialize database container after { max_retries } attempts'
71+ raise RuntimeError (f' { msg } : { error } ' ) from error
7272 logging .warning (
73- " Container startup attempt %d failed: %s. Retrying in %s seconds..." ,
73+ ' Container startup attempt %d failed: %s. Retrying in %s seconds...' ,
7474 attempt + 1 , error , retry_delay
7575 )
7676 time .sleep (retry_delay )
@@ -92,7 +92,7 @@ async def create(cls, max_retries=3, retry_delay=2.0) -> 'Database':
9292
9393 return cls (Database .__create_key , with_authorization_client , with_invalid_url_client )
9494
95- raise RuntimeError (" Failed to create database: Unexpected error during retry loop" )
95+ raise RuntimeError (' Failed to create database: Unexpected error during retry loop' )
9696
9797 @staticmethod
9898 def _get_image_tag_from_dockerfile ():
@@ -109,17 +109,14 @@ def get_client(self, client_type: str = CLIENT_TYPE_WITH_AUTH) -> Client:
109109 if client_type == self .CLIENT_TYPE_INVALID_URL :
110110 return self .__with_invalid_url_client
111111
112- raise ValueError (f" Unknown client type: { client_type } " )
112+ raise ValueError (f' Unknown client type: { client_type } ' )
113113
114114 def get_base_url (self ) -> str :
115- """Get the base URL of the EventSourceDB container."""
116115 return self .__container .get_base_url ()
117116
118117 def get_api_token (self ) -> str :
119- """Get the API token for the EventSourceDB container."""
120118 return self .__container .get_api_token ()
121119
122120 async def stop (self ) -> None :
123- # Use walrus operator for concise access and check
124121 if (container := getattr (self .__class__ , '_Database__container' , None )):
125122 container .stop ()
0 commit comments