mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-01-31 03:36:41 +03:00
Update catalogs API docs
This commit is contained in:
parent
1ca17fdeff
commit
99cd7bfda6
|
@ -30,13 +30,21 @@ class CatalogBundle(object):
|
||||||
:py:class:`CatalogBundle` is considered to be dependable on catalogs
|
:py:class:`CatalogBundle` is considered to be dependable on catalogs
|
||||||
(:py:class:`DeclarativeCatalog` or :py:class:`DynamicCatalog`) entity by
|
(:py:class:`DeclarativeCatalog` or :py:class:`DynamicCatalog`) entity by
|
||||||
its design.
|
its design.
|
||||||
|
|
||||||
|
.. py:attribute:: catalog
|
||||||
|
|
||||||
|
Bundle's catalog.
|
||||||
|
|
||||||
|
:type: :py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog`
|
||||||
|
|
||||||
|
.. py:attribute:: providers
|
||||||
|
|
||||||
|
Dictionary of all providers.
|
||||||
|
|
||||||
|
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
catalog = None
|
catalog = None
|
||||||
"""Bundle's catalog.
|
|
||||||
|
|
||||||
:type: :py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog`
|
|
||||||
"""
|
|
||||||
|
|
||||||
__IS_CATALOG_BUNDLE__ = True
|
__IS_CATALOG_BUNDLE__ = True
|
||||||
__slots__ = ('providers', '__dict__')
|
__slots__ = ('providers', '__dict__')
|
||||||
|
@ -57,15 +65,9 @@ class CatalogBundle(object):
|
||||||
:type providers: tuple[
|
:type providers: tuple[
|
||||||
:py:class:`dependency_injector.providers.Provider`]
|
:py:class:`dependency_injector.providers.Provider`]
|
||||||
"""
|
"""
|
||||||
self.providers = dict()
|
self.providers = dict((self.catalog.get_provider_bind_name(provider),
|
||||||
"""Dictionary of all providers.
|
provider)
|
||||||
|
for provider in providers)
|
||||||
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
for provider in providers:
|
|
||||||
provider_name = self.catalog.get_provider_bind_name(provider)
|
|
||||||
self.providers[provider_name] = provider
|
|
||||||
self.__dict__.update(self.providers)
|
self.__dict__.update(self.providers)
|
||||||
super(CatalogBundle, self).__init__()
|
super(CatalogBundle, self).__init__()
|
||||||
|
|
||||||
|
@ -137,6 +139,33 @@ class DynamicCatalog(object):
|
||||||
users=providers.Factory(UsersService))
|
users=providers.Factory(UsersService))
|
||||||
|
|
||||||
users_service = services.users()
|
users_service = services.users()
|
||||||
|
|
||||||
|
.. py:attribute:: Bundle
|
||||||
|
|
||||||
|
Catalog's bundle class.
|
||||||
|
|
||||||
|
:type: :py:class:`CatalogBundle`
|
||||||
|
|
||||||
|
.. py:attribute:: name
|
||||||
|
|
||||||
|
Catalog's name.
|
||||||
|
|
||||||
|
By default, it is catalog's module + catalog's class name.
|
||||||
|
|
||||||
|
:type: str
|
||||||
|
|
||||||
|
.. py:attribute:: providers
|
||||||
|
|
||||||
|
Dictionary of all providers.
|
||||||
|
|
||||||
|
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
|
|
||||||
|
.. py:attribute:: overridden_by
|
||||||
|
|
||||||
|
Tuple of overriding catalogs.
|
||||||
|
|
||||||
|
:type: tuple[
|
||||||
|
:py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog`]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__IS_CATALOG__ = True
|
__IS_CATALOG__ = True
|
||||||
|
@ -151,35 +180,11 @@ class DynamicCatalog(object):
|
||||||
dict[str, :py:class:`dependency_injector.providers.Provider`]
|
dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
"""
|
"""
|
||||||
self.Bundle = CatalogBundle.sub_cls_factory(self)
|
self.Bundle = CatalogBundle.sub_cls_factory(self)
|
||||||
"""Catalog's bundle class.
|
|
||||||
|
|
||||||
:type: :py:class:`CatalogBundle`
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.name = '.'.join((self.__class__.__module__,
|
self.name = '.'.join((self.__class__.__module__,
|
||||||
self.__class__.__name__))
|
self.__class__.__name__))
|
||||||
"""Catalog's name.
|
|
||||||
|
|
||||||
By default, it is catalog's module + catalog's class name.
|
|
||||||
|
|
||||||
:type: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.providers = dict()
|
self.providers = dict()
|
||||||
"""Dictionary of all providers.
|
|
||||||
|
|
||||||
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.provider_names = dict()
|
self.provider_names = dict()
|
||||||
|
|
||||||
self.overridden_by = tuple()
|
self.overridden_by = tuple()
|
||||||
"""Tuple of overriding catalogs.
|
|
||||||
|
|
||||||
:type: tuple[
|
|
||||||
:py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.bind_providers(providers)
|
self.bind_providers(providers)
|
||||||
super(DynamicCatalog, self).__init__()
|
super(DynamicCatalog, self).__init__()
|
||||||
|
|
||||||
|
@ -568,58 +573,71 @@ class DeclarativeCatalog(object):
|
||||||
users = providers.Factory(UsersService)
|
users = providers.Factory(UsersService)
|
||||||
|
|
||||||
users_service = Services.users()
|
users_service = Services.users()
|
||||||
|
|
||||||
|
.. py:attribute:: Bundle
|
||||||
|
|
||||||
|
Catalog's bundle class.
|
||||||
|
|
||||||
|
:type: :py:class:`CatalogBundle`
|
||||||
|
|
||||||
|
.. py:attribute:: name
|
||||||
|
|
||||||
|
Read-only property that represents catalog's name.
|
||||||
|
|
||||||
|
Catalog's name is catalog's module + catalog's class name.
|
||||||
|
|
||||||
|
:type: str
|
||||||
|
|
||||||
|
.. py:attribute:: cls_providers
|
||||||
|
|
||||||
|
Read-only dictionary of current catalog providers.
|
||||||
|
|
||||||
|
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
|
|
||||||
|
.. py:attribute:: inherited_providers
|
||||||
|
|
||||||
|
Read-only dictionary of inherited providers.
|
||||||
|
|
||||||
|
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
|
|
||||||
|
.. py:attribute:: providers
|
||||||
|
|
||||||
|
Read-only dictionary of all providers.
|
||||||
|
|
||||||
|
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
||||||
|
|
||||||
|
.. py:attribute:: overridden_by
|
||||||
|
|
||||||
|
Tuple of overriding catalogs.
|
||||||
|
|
||||||
|
:type: tuple[:py:class:`DeclarativeCatalog` |
|
||||||
|
:py:class:`DynamicCatalog`]
|
||||||
|
|
||||||
|
.. py:attribute:: is_overridden
|
||||||
|
|
||||||
|
Read-only property that is set to ``True`` if catalog is overridden.
|
||||||
|
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
.. py:attribute:: is_overridden
|
||||||
|
|
||||||
|
Read-only reference to the last overriding catalog, if any.
|
||||||
|
|
||||||
|
:type: :py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog` |
|
||||||
|
None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Bundle = CatalogBundle
|
Bundle = CatalogBundle
|
||||||
"""Catalog's bundle class.
|
|
||||||
|
|
||||||
:type: :py:class:`CatalogBundle`
|
|
||||||
"""
|
|
||||||
|
|
||||||
name = str()
|
name = str()
|
||||||
"""Read-only property that represents catalog's name.
|
|
||||||
|
|
||||||
Catalog's name is catalog's module + catalog's class name.
|
|
||||||
|
|
||||||
:type: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
cls_providers = dict()
|
cls_providers = dict()
|
||||||
"""Read-only dictionary of current catalog providers.
|
|
||||||
|
|
||||||
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
inherited_providers = dict()
|
inherited_providers = dict()
|
||||||
"""Read-only dictionary of inherited providers.
|
|
||||||
|
|
||||||
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
providers = dict()
|
providers = dict()
|
||||||
"""Read-only dictionary of all providers.
|
|
||||||
|
|
||||||
:type: dict[str, :py:class:`dependency_injector.providers.Provider`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
overridden_by = tuple()
|
overridden_by = tuple()
|
||||||
"""Tuple of overriding catalogs.
|
|
||||||
|
|
||||||
:type: tuple[:py:class:`DeclarativeCatalog` |
|
|
||||||
:py:class:`DynamicCatalog`]
|
|
||||||
"""
|
|
||||||
|
|
||||||
is_overridden = bool
|
is_overridden = bool
|
||||||
"""Read-only property that is set to ``True`` if catalog is overridden.
|
|
||||||
|
|
||||||
:type: bool
|
|
||||||
"""
|
|
||||||
|
|
||||||
last_overriding = None
|
last_overriding = None
|
||||||
"""Read-only reference to the last overriding catalog, if any.
|
|
||||||
|
|
||||||
:type: :py:class:`DeclarativeCatalog` | :py:class:`DynamicCatalog` | None
|
|
||||||
"""
|
|
||||||
|
|
||||||
_catalog = DynamicCatalog
|
_catalog = DynamicCatalog
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user