mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 19:43:58 +03:00
17 lines
423 B
Python
17 lines
423 B
Python
"""`@di.inject()` decorator simple example."""
|
|
|
|
import dependency_injector as di
|
|
|
|
|
|
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 for input args."""
|
|
assert isinstance(new_object, object)
|
|
assert some_setting == 1334
|
|
|
|
example_callback()
|