mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Update @di.inject examples comments
This commit is contained in:
parent
62df0bb853
commit
e1fc8dde39
|
@ -5,18 +5,15 @@ import flask
|
|||
import dependency_injector as di
|
||||
|
||||
|
||||
# Database and `ObjectA` providers.
|
||||
database = di.Singleton(sqlite3.Connection,
|
||||
database=':memory:',
|
||||
timeout=30,
|
||||
detect_types=True,
|
||||
isolation_level='EXCLUSIVE')
|
||||
|
||||
# Flask application:
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
|
||||
# Flask view with @inject decorator:
|
||||
@app.route('/')
|
||||
@di.inject(database=database)
|
||||
def hello(database):
|
||||
|
|
|
@ -9,7 +9,7 @@ dependency_injector_factory = di.Factory(object)
|
|||
@di.inject(new_object=dependency_injector_factory)
|
||||
@di.inject(some_setting=1334)
|
||||
def example_callback(new_object, some_setting):
|
||||
"""Example callback that does some asserts with input args."""
|
||||
"""Example callback that does some asserts for input args."""
|
||||
assert isinstance(new_object, object)
|
||||
assert some_setting == 1334
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user