python-dependency-injector/examples/di_demo/di_example.py

16 lines
421 B
Python
Raw Normal View History

2016-03-29 20:17:12 +03:00
"""The Code, powered by Dependency Injector."""
from dependency_injector import catalogs, providers
from ioc_example import Service, Client
class Components(catalogs.DeclarativeCatalog):
"""Components catalog."""
service = providers.Factory(Service)
2016-03-31 21:13:28 +03:00
client = providers.Factory(Client, service=service)
2016-03-29 20:17:12 +03:00
if __name__ == '__main__':
2016-03-30 11:45:41 +03:00
client = Components.client() # Application creates Client's instance