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:
if environment == 'prod':
adapters = Adapters()
elif environment == 'test':
adapters = TestAdapters()
2020-09-07 19:31:59 +03:00
else:
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
if __name__ == '__main__':
main(*sys.argv[1:])