mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Update docs & examples
This commit is contained in:
parent
832518582a
commit
c5d8032e95
BIN
docs/images/providers/dependency.png
Normal file
BIN
docs/images/providers/dependency.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Before Width: | Height: | Size: 41 KiB |
|
@ -1,9 +1,9 @@
|
|||
External dependency providers
|
||||
-----------------------------
|
||||
Dependency providers
|
||||
--------------------
|
||||
|
||||
.. currentmodule:: dependency_injector.providers
|
||||
|
||||
:py:class:`ExternalDependency` provider can be useful for development of
|
||||
:py:class:`Dependency` provider can be useful for development of
|
||||
self-sufficient libraries / modules / applications that have required external
|
||||
dependencies.
|
||||
|
||||
|
@ -35,11 +35,10 @@ Example:
|
|||
Instead of this, ``UsersService`` has external dependency, that has to
|
||||
be satisfied by cleint's code, out of library's scope.
|
||||
|
||||
.. image:: /images/providers/external_dependency.png
|
||||
.. image:: /images/providers/dependency.png
|
||||
|
||||
.. literalinclude:: ../../examples/providers/external_dependency.py
|
||||
.. literalinclude:: ../../examples/providers/dependency.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
|
||||
.. disqus::
|
|
@ -21,6 +21,6 @@ Providers package API docs - :py:mod:`dependency_injector.providers`
|
|||
singleton
|
||||
callable
|
||||
object
|
||||
external_dependency
|
||||
dependency
|
||||
overriding
|
||||
custom
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""`ExternalDependency` providers example."""
|
||||
"""`Dependency` providers example."""
|
||||
|
||||
import sqlite3
|
||||
import contextlib
|
||||
|
@ -45,7 +45,7 @@ class UsersService(object):
|
|||
|
||||
|
||||
# Database and UsersService providers:
|
||||
database = providers.ExternalDependency(instance_of=sqlite3.dbapi2.Connection)
|
||||
database = providers.Dependency(instance_of=sqlite3.dbapi2.Connection)
|
||||
users_service_factory = providers.Factory(UsersService,
|
||||
database=database)
|
||||
|
Loading…
Reference in New Issue
Block a user