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

24 lines
486 B
Python
Raw Permalink Normal View History

2020-09-07 19:31:59 +03:00
"""Main module."""
import sys
2020-09-07 19:31:59 +03:00
from .containers import UseCases, Adapters, TestAdapters
2020-09-07 19:31:59 +03:00
def main(environment: str, email: str) -> None:
2021-10-01 02:01:31 +03:00
if environment == "prod":
adapters = Adapters()
2021-10-01 02:01:31 +03:00
elif environment == "test":
adapters = TestAdapters()
2020-09-07 19:31:59 +03:00
else:
2021-10-01 02:01:31 +03:00
raise RuntimeError("Unknown environment")
use_cases = UseCases(adapters=adapters)
use_case = use_cases.signup()
use_case.execute(email)
2020-09-07 19:31:59 +03:00
2021-10-01 02:01:31 +03:00
if __name__ == "__main__":
2020-09-07 19:31:59 +03:00
main(*sys.argv[1:])