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:
|
def main(environment: str, email: str) -> None:
|
||||||
if environment == 'prod':
|
if environment == "prod":
|
||||||
adapters = Adapters()
|
adapters = Adapters()
|
||||||
elif environment == 'test':
|
elif environment == "test":
|
||||||
adapters = TestAdapters()
|
adapters = TestAdapters()
|
||||||
else:
|
else:
|
||||||
raise RuntimeError('Unknown environment')
|
raise RuntimeError("Unknown environment")
|
||||||
|
|
||||||
use_cases = UseCases(adapters=adapters)
|
use_cases = UseCases(adapters=adapters)
|
||||||
|
|
||||||
|
@ -19,5 +19,5 @@ def main(environment: str, email: str) -> None:
|
||||||
use_case.execute(email)
|
use_case.execute(email)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main(*sys.argv[1:])
|
main(*sys.argv[1:])
|
||||||
|
|
|
@ -13,10 +13,10 @@ class EmailSender(metaclass=abc.ABCMeta):
|
||||||
class SmtpEmailSender:
|
class SmtpEmailSender:
|
||||||
|
|
||||||
def send(self, to: str, body: str) -> None:
|
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:
|
class EchoEmailSender:
|
||||||
|
|
||||||
def send(self, to: str, body: str) -> None:
|
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
|
self.email_sender = email_sender
|
||||||
|
|
||||||
def execute(self, email: str) -> None:
|
def execute(self, email: str) -> None:
|
||||||
print(f'Sign up user {email}')
|
print(f"Sign up user {email}")
|
||||||
self.email_sender.send(email, f'Welcome, {email}')
|
self.email_sender.send(email, f"Welcome, {email}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user