Update quotes in multiple containers example

This commit is contained in:
Roman Mogylatov 2021-09-29 17:00:36 -04:00
parent 3dca5c2933
commit 9227e9c3f3
3 changed files with 10 additions and 10 deletions

View File

@ -22,9 +22,9 @@ def main(
photo_service.upload_photo(user, photo) photo_service.upload_photo(user, photo)
if __name__ == '__main__': if __name__ == "__main__":
application = Application() application = Application()
application.config.from_yaml('config.yml') application.config.from_yaml("config.yml")
application.core.init_resources() application.core.init_resources()
application.wire(modules=[__name__]) application.wire(modules=[__name__])

View File

@ -30,7 +30,7 @@ class Gateways(containers.DeclarativeContainer):
s3_client = providers.Singleton( s3_client = providers.Singleton(
boto3.client, boto3.client,
service_name='s3', service_name="s3",
aws_access_key_id=config.aws.access_key_id, aws_access_key_id=config.aws.access_key_id,
aws_secret_access_key=config.aws.secret_access_key, aws_secret_access_key=config.aws.secret_access_key,
) )

View File

@ -11,7 +11,7 @@ class BaseService:
def __init__(self) -> None: def __init__(self) -> None:
self.logger = logging.getLogger( self.logger = logging.getLogger(
f'{__name__}.{self.__class__.__name__}', f"{__name__}.{self.__class__.__name__}",
) )
@ -22,8 +22,8 @@ class UserService(BaseService):
super().__init__() super().__init__()
def get_user(self, email: str) -> Dict[str, str]: def get_user(self, email: str) -> Dict[str, str]:
self.logger.debug('User %s has been found in database', email) self.logger.debug("User %s has been found in database", email)
return {'email': email, 'password_hash': '...'} return {"email": email, "password_hash": "..."}
class AuthService(BaseService): class AuthService(BaseService):
@ -36,8 +36,8 @@ class AuthService(BaseService):
def authenticate(self, user: Dict[str, str], password: str) -> None: def authenticate(self, user: Dict[str, str], password: str) -> None:
assert password is not None assert password is not None
self.logger.debug( self.logger.debug(
'User %s has been successfully authenticated', "User %s has been successfully authenticated",
user['email'], user["email"],
) )
@ -50,7 +50,7 @@ class PhotoService(BaseService):
def upload_photo(self, user: Dict[str, str], photo_path: str) -> None: def upload_photo(self, user: Dict[str, str], photo_path: str) -> None:
self.logger.debug( self.logger.debug(
'Photo %s has been successfully uploaded by user %s', "Photo %s has been successfully uploaded by user %s",
photo_path, photo_path,
user['email'], user["email"],
) )