mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-28 04:23:59 +03:00
adding provides keywords in concept
This commit is contained in:
parent
aea9d2b3eb
commit
4c20f9c968
10
README.md
10
README.md
|
@ -7,6 +7,10 @@ Python catalogs of objects providers.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
"""
|
||||||
|
Concept example of objects catalogs.
|
||||||
|
"""
|
||||||
|
|
||||||
import objects
|
import objects
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
@ -27,15 +31,15 @@ class Catalog(objects.Catalog):
|
||||||
Objects catalog.
|
Objects catalog.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
database = objects.Singleton(sqlite3.Connection,
|
database = objects.Singleton(provides=sqlite3.Connection,
|
||||||
database='example.db')
|
database='example.db')
|
||||||
""" :type: (objects.Provider) -> sqlite3.Connection """
|
""" :type: (objects.Provider) -> sqlite3.Connection """
|
||||||
|
|
||||||
object_a = objects.NewInstance(A,
|
object_a = objects.NewInstance(provides=A,
|
||||||
db=database)
|
db=database)
|
||||||
""" :type: (objects.Provider) -> A """
|
""" :type: (objects.Provider) -> A """
|
||||||
|
|
||||||
object_b = objects.NewInstance(B,
|
object_b = objects.NewInstance(provides=B,
|
||||||
a=object_a,
|
a=object_a,
|
||||||
db=database)
|
db=database)
|
||||||
""" :type: (objects.Provider) -> B """
|
""" :type: (objects.Provider) -> B """
|
||||||
|
|
|
@ -22,15 +22,15 @@ class Catalog(objects.Catalog):
|
||||||
Objects catalog.
|
Objects catalog.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
database = objects.Singleton(sqlite3.Connection,
|
database = objects.Singleton(provides=sqlite3.Connection,
|
||||||
database='example.db')
|
database='example.db')
|
||||||
""" :type: (objects.Provider) -> sqlite3.Connection """
|
""" :type: (objects.Provider) -> sqlite3.Connection """
|
||||||
|
|
||||||
object_a = objects.NewInstance(A,
|
object_a = objects.NewInstance(provides=A,
|
||||||
db=database)
|
db=database)
|
||||||
""" :type: (objects.Provider) -> A """
|
""" :type: (objects.Provider) -> A """
|
||||||
|
|
||||||
object_b = objects.NewInstance(B,
|
object_b = objects.NewInstance(provides=B,
|
||||||
a=object_a,
|
a=object_a,
|
||||||
db=database)
|
db=database)
|
||||||
""" :type: (objects.Provider) -> B """
|
""" :type: (objects.Provider) -> B """
|
||||||
|
|
Loading…
Reference in New Issue
Block a user