mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Update quotes in use-cases example
This commit is contained in:
parent
b64c9b7a05
commit
8bea62eeee
|
@ -6,12 +6,12 @@ from .containers import UseCases, Adapters, TestAdapters
|
|||
|
||||
|
||||
def main(environment: str, email: str) -> None:
|
||||
if environment == 'prod':
|
||||
if environment == "prod":
|
||||
adapters = Adapters()
|
||||
elif environment == 'test':
|
||||
elif environment == "test":
|
||||
adapters = TestAdapters()
|
||||
else:
|
||||
raise RuntimeError('Unknown environment')
|
||||
raise RuntimeError("Unknown environment")
|
||||
|
||||
use_cases = UseCases(adapters=adapters)
|
||||
|
||||
|
@ -19,5 +19,5 @@ def main(environment: str, email: str) -> None:
|
|||
use_case.execute(email)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main(*sys.argv[1:])
|
||||
|
|
|
@ -13,10 +13,10 @@ class EmailSender(metaclass=abc.ABCMeta):
|
|||
class SmtpEmailSender:
|
||||
|
||||
def send(self, to: str, body: str) -> None:
|
||||
print(f'Sending an email to {to} over SMTP, body="{body}"')
|
||||
print(f"Sending an email to {to} over SMTP, body=\"{body}\"")
|
||||
|
||||
|
||||
class EchoEmailSender:
|
||||
|
||||
def send(self, to: str, body: str) -> None:
|
||||
print(f'Fake sending an email to {to}, body="{body}"')
|
||||
print(f"Fake sending an email to {to}, body=\"{body}\"")
|
||||
|
|
|
@ -18,5 +18,5 @@ class SignupUseCase:
|
|||
self.email_sender = email_sender
|
||||
|
||||
def execute(self, email: str) -> None:
|
||||
print(f'Sign up user {email}')
|
||||
self.email_sender.send(email, f'Welcome, {email}')
|
||||
print(f"Sign up user {email}")
|
||||
self.email_sender.send(email, f"Welcome, {email}")
|
||||
|
|
Loading…
Reference in New Issue
Block a user