From 4e00a708345a157608aa9ea0c7e1e3acd678009a Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Wed, 30 Mar 2016 11:45:41 +0300 Subject: [PATCH] Update di example --- examples/di_demo/di_example.py | 5 +---- examples/di_demo/example.py | 3 +-- examples/di_demo/ioc_example.py | 7 ++----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/examples/di_demo/di_example.py b/examples/di_demo/di_example.py index 43bb406d..75224b7b 100644 --- a/examples/di_demo/di_example.py +++ b/examples/di_demo/di_example.py @@ -8,13 +8,10 @@ class Components(catalogs.DeclarativeCatalog): """Components catalog.""" service = providers.Factory(Service) - """:type: providers.Factory -> Service""" client = providers.Factory(Client, service=service) - """:type: providers.Factory -> Client""" if __name__ == '__main__': - # Application creates Client's instance using its provider - client = Components.client() # equivalent of Client(service=Service()) + client = Components.client() # Application creates Client's instance diff --git a/examples/di_demo/example.py b/examples/di_demo/example.py index 3d498d9c..3a0d8036 100644 --- a/examples/di_demo/example.py +++ b/examples/di_demo/example.py @@ -14,5 +14,4 @@ class Client(object): if __name__ == '__main__': - # Application just creates Client's instance - client = Client() + client = Client() # Application creates Client's instance diff --git a/examples/di_demo/ioc_example.py b/examples/di_demo/ioc_example.py index 08d2fa88..26568096 100644 --- a/examples/di_demo/ioc_example.py +++ b/examples/di_demo/ioc_example.py @@ -14,8 +14,5 @@ class Client(object): if __name__ == '__main__': - # Application creates Service instance - service = Service() - - # and inject Service instance into the Client - client = Client(service) + service = Service() # Application creates Service instance + client = Client(service) # and inject Service instance into the Client