Update quotes in single container example

This commit is contained in:
Roman Mogylatov 2021-09-29 17:01:22 -04:00
parent 9227e9c3f3
commit 0bd2903e60
3 changed files with 11 additions and 11 deletions

View File

@ -22,10 +22,10 @@ def main(
photo_service.upload_photo(user, photo)
if __name__ == '__main__':
if __name__ == "__main__":
container = Container()
container.init_resources()
container.config.from_ini('config.ini')
container.config.from_ini("config.ini")
container.wire(modules=[__name__])
main(*sys.argv[1:])

View File

@ -15,7 +15,7 @@ class Container(containers.DeclarativeContainer):
logging = providers.Resource(
logging.config.fileConfig,
fname='logging.ini',
fname="logging.ini",
)
# Gateways
@ -27,7 +27,7 @@ class Container(containers.DeclarativeContainer):
s3_client = providers.Singleton(
boto3.client,
service_name='s3',
service_name="s3",
aws_access_key_id=config.aws.access_key_id,
aws_secret_access_key=config.aws.secret_access_key,
)

View File

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