mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Update services miniapp example
This commit is contained in:
parent
88b563269d
commit
98ac4d902e
10
README.rst
10
README.rst
|
@ -99,13 +99,13 @@ defined above:
|
||||||
|
|
||||||
"""Dependency Injector @inject decorator example."""
|
"""Dependency Injector @inject decorator example."""
|
||||||
|
|
||||||
import dependency_injector.injections as di
|
from dependency_injector.injections import inject
|
||||||
import containers
|
from containers import Services
|
||||||
|
|
||||||
|
|
||||||
@di.inject(users_service=containers.Services.users)
|
@inject(users_service=Services.users)
|
||||||
@di.inject(auth_service=containers.Services.auth)
|
@inject(auth_service=Services.auth)
|
||||||
@di.inject(photos_service=containers.Services.photos)
|
@inject(photos_service=Services.photos)
|
||||||
def main(users_service, auth_service, photos_service):
|
def main(users_service, auth_service, photos_service):
|
||||||
"""Main function."""
|
"""Main function."""
|
||||||
user = users_service.get_user('user')
|
user = users_service.get_user('user')
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
"""Dependency Injector @inject decorator example."""
|
"""Dependency Injector @inject decorator example."""
|
||||||
|
|
||||||
import dependency_injector.injections as di
|
from dependency_injector.injections import inject
|
||||||
import containers
|
from containers import Services
|
||||||
|
|
||||||
|
|
||||||
@di.inject(users_service=containers.Services.users)
|
@inject(users_service=Services.users)
|
||||||
@di.inject(auth_service=containers.Services.auth)
|
@inject(auth_service=Services.auth)
|
||||||
@di.inject(photos_service=containers.Services.photos)
|
@inject(photos_service=Services.photos)
|
||||||
def main(users_service, auth_service, photos_service):
|
def main(users_service, auth_service, photos_service):
|
||||||
"""Main function."""
|
"""Main function."""
|
||||||
user = users_service.get_user('user')
|
user = users_service.get_user('user')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user