mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-30 05:23:59 +03:00
23 lines
447 B
Python
23 lines
447 B
Python
"""Adapters module."""
|
|
|
|
import abc
|
|
|
|
|
|
class EmailSender(metaclass=abc.ABCMeta):
|
|
|
|
@abc.abstractmethod
|
|
def send(self, to: str, body: str) -> None:
|
|
...
|
|
|
|
|
|
class SmtpEmailSender:
|
|
|
|
def send(self, to: str, body: str) -> None:
|
|
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}\"")
|