python-dependency-injector/examples/miniapps/use-cases/example/usecases.py

23 lines
445 B
Python
Raw Normal View History

2020-09-07 19:31:59 +03:00
"""Use cases module."""
import abc
from .adapters import EmailSender
class UseCase(metaclass=abc.ABCMeta):
@abc.abstractmethod
def execute(self) -> None:
...
class SignupUseCase:
def __init__(self, email_sender: EmailSender) -> None:
self.email_sender = email_sender
def execute(self, email: str) -> None:
2021-10-01 02:01:31 +03:00
print(f"Sign up user {email}")
self.email_sender.send(email, f"Welcome, {email}")