From 4c20f9c968ef410862e9fbb4a0d649a152710926 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Sun, 4 Jan 2015 16:28:02 +0200 Subject: [PATCH] adding provides keywords in concept --- README.md | 10 +++++++--- examples/concept.py | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 619ced27..01241cac 100644 --- a/README.md +++ b/README.md @@ -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 """ diff --git a/examples/concept.py b/examples/concept.py index 5b16c5da..0bfadb7c 100644 --- a/examples/concept.py +++ b/examples/concept.py @@ -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 """