mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-02 03:13:15 +03:00
Edit object docs
This commit is contained in:
parent
aef7c1d0df
commit
d573c990b0
|
@ -9,9 +9,8 @@ follows `Semantic versioning`_
|
|||
|
||||
Development version
|
||||
-------------------
|
||||
- Update ``Singleton`` provider documentation and rework examples.
|
||||
- Update ``Callable`` provider documentation and rework examples.
|
||||
- Update ``Coroutine`` provider documentation and rework examples.
|
||||
- Update documentation and rework examples for: ``Singleton``, ``Callable``, ``Coroutine``,
|
||||
``Object`` providers.
|
||||
|
||||
3.34.0
|
||||
------
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
Object providers
|
||||
----------------
|
||||
Object provider
|
||||
---------------
|
||||
|
||||
.. meta::
|
||||
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Object
|
||||
:description: Object provider provides an object "as is". This page demonstrates how to use an
|
||||
Object provider.
|
||||
|
||||
.. currentmodule:: dependency_injector.providers
|
||||
|
||||
:py:class:`Object` provider returns provided instance "as is".
|
||||
|
||||
Example:
|
||||
:py:class:`Object` provider returns an object "as is".
|
||||
|
||||
.. literalinclude:: ../../examples/providers/object.py
|
||||
:language: python
|
||||
|
||||
:lines: 3-
|
||||
|
||||
.. disqus::
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Object providers example."""
|
||||
"""`Object` provider example."""
|
||||
|
||||
import dependency_injector.providers as providers
|
||||
from dependency_injector import providers
|
||||
|
||||
|
||||
# Creating object provider:
|
||||
object_provider = providers.Object(1)
|
||||
|
||||
# Making some asserts:
|
||||
|
||||
if __name__ == '__main__':
|
||||
assert object_provider() == 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user