mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 03:23:58 +03:00
Update concept example in README
This commit is contained in:
parent
7b35909083
commit
4285205dca
|
@ -93,16 +93,17 @@ Examples
|
||||||
class Services(catalogs.DeclarativeCatalog):
|
class Services(catalogs.DeclarativeCatalog):
|
||||||
"""Catalog of service providers."""
|
"""Catalog of service providers."""
|
||||||
|
|
||||||
database = providers.Singleton(sqlite3.connect, ':memory:')
|
database = providers.Singleton(sqlite3.connect,
|
||||||
|
injections.Arg(':memory:'))
|
||||||
""":type: providers.Provider -> sqlite3.Connection"""
|
""":type: providers.Provider -> sqlite3.Connection"""
|
||||||
|
|
||||||
users = providers.Factory(UsersService,
|
users = providers.Factory(UsersService,
|
||||||
db=database)
|
injections.KwArg('db', database))
|
||||||
""":type: providers.Provider -> UsersService"""
|
""":type: providers.Provider -> UsersService"""
|
||||||
|
|
||||||
auth = providers.Factory(AuthService,
|
auth = providers.Factory(AuthService,
|
||||||
db=database,
|
injections.KwArg('db', database),
|
||||||
users_service=users)
|
injections.KwArg('users_service', users))
|
||||||
""":type: providers.Provider -> AuthService"""
|
""":type: providers.Provider -> AuthService"""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user