mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Update quotes in single container example
This commit is contained in:
parent
9227e9c3f3
commit
0bd2903e60
|
@ -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:])
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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"],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user