adding provides keywords in concept

This commit is contained in:
Roman Mogilatov 2015-01-04 16:28:02 +02:00
parent aea9d2b3eb
commit 4c20f9c968
2 changed files with 10 additions and 6 deletions

View File

@ -7,6 +7,10 @@ Python catalogs of objects providers.
Example:
```python
"""
Concept example of objects catalogs.
"""
import objects
import sqlite3
@ -27,15 +31,15 @@ class Catalog(objects.Catalog):
Objects catalog.
"""
database = objects.Singleton(sqlite3.Connection,
database = objects.Singleton(provides=sqlite3.Connection,
database='example.db')
""" :type: (objects.Provider) -> sqlite3.Connection """
object_a = objects.NewInstance(A,
object_a = objects.NewInstance(provides=A,
db=database)
""" :type: (objects.Provider) -> A """
object_b = objects.NewInstance(B,
object_b = objects.NewInstance(provides=B,
a=object_a,
db=database)
""" :type: (objects.Provider) -> B """

View File

@ -22,15 +22,15 @@ class Catalog(objects.Catalog):
Objects catalog.
"""
database = objects.Singleton(sqlite3.Connection,
database = objects.Singleton(provides=sqlite3.Connection,
database='example.db')
""" :type: (objects.Provider) -> sqlite3.Connection """
object_a = objects.NewInstance(A,
object_a = objects.NewInstance(provides=A,
db=database)
""" :type: (objects.Provider) -> A """
object_b = objects.NewInstance(B,
object_b = objects.NewInstance(provides=B,
a=object_a,
db=database)
""" :type: (objects.Provider) -> B """