mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
updating readme
This commit is contained in:
parent
98435c953f
commit
2bfdae8949
|
@ -58,7 +58,7 @@ assert b1 is not b2
|
||||||
assert a1.db is a2.db is b1.db is b2.db is AppCatalog.database()
|
assert a1.db is a2.db is b1.db is b2.db is AppCatalog.database()
|
||||||
|
|
||||||
|
|
||||||
# Dependency injection (The Python Way) into class.
|
# Dependencies injection (The Python Way) into class.
|
||||||
class Consumer(object):
|
class Consumer(object):
|
||||||
|
|
||||||
dependencies = AppCatalog(AppCatalog.object_a,
|
dependencies = AppCatalog(AppCatalog.object_a,
|
||||||
|
@ -86,7 +86,7 @@ class Consumer(object):
|
||||||
Consumer().test()
|
Consumer().test()
|
||||||
|
|
||||||
|
|
||||||
# Dependency injection (The Python Way) into a callback.
|
# Dependencies injection (The Python Way) into a callback.
|
||||||
def consumer_callback(dependencies=AppCatalog(AppCatalog.object_a,
|
def consumer_callback(dependencies=AppCatalog(AppCatalog.object_a,
|
||||||
AppCatalog.object_b)):
|
AppCatalog.object_b)):
|
||||||
a1 = dependencies.object_a()
|
a1 = dependencies.object_a()
|
||||||
|
|
|
@ -49,7 +49,7 @@ assert b1 is not b2
|
||||||
assert a1.db is a2.db is b1.db is b2.db is AppCatalog.database()
|
assert a1.db is a2.db is b1.db is b2.db is AppCatalog.database()
|
||||||
|
|
||||||
|
|
||||||
# Dependency injection (The Python Way) into class.
|
# Dependencies injection (The Python Way) into class.
|
||||||
class Consumer(object):
|
class Consumer(object):
|
||||||
|
|
||||||
dependencies = AppCatalog(AppCatalog.object_a,
|
dependencies = AppCatalog(AppCatalog.object_a,
|
||||||
|
@ -77,7 +77,7 @@ class Consumer(object):
|
||||||
Consumer().test()
|
Consumer().test()
|
||||||
|
|
||||||
|
|
||||||
# Dependency injection (The Python Way) into a callback.
|
# Dependencies injection (The Python Way) into a callback.
|
||||||
def consumer_callback(dependencies=AppCatalog(AppCatalog.object_a,
|
def consumer_callback(dependencies=AppCatalog(AppCatalog.object_a,
|
||||||
AppCatalog.object_b)):
|
AppCatalog.object_b)):
|
||||||
a1 = dependencies.object_a()
|
a1 = dependencies.object_a()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user