mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-06-20 13:33:13 +03:00
Merge branch 'release/4.0.4' into master
This commit is contained in:
commit
ca9a2a5692
|
@ -7,6 +7,10 @@ that were made in every particular version.
|
||||||
From version 0.7.6 *Dependency Injector* framework strictly
|
From version 0.7.6 *Dependency Injector* framework strictly
|
||||||
follows `Semantic versioning`_
|
follows `Semantic versioning`_
|
||||||
|
|
||||||
|
4.0.4
|
||||||
|
-----
|
||||||
|
- Fix typing stubs for ``container.override()`` method.
|
||||||
|
|
||||||
4.0.3
|
4.0.3
|
||||||
-----
|
-----
|
||||||
- Deprecate ``@containers.override()`` and ``@containers.copy()`` decorators.
|
- Deprecate ``@containers.override()`` and ``@containers.copy()`` decorators.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Top-level package."""
|
"""Top-level package."""
|
||||||
|
|
||||||
__version__ = '4.0.3'
|
__version__ = '4.0.4'
|
||||||
"""Version number.
|
"""Version number.
|
||||||
|
|
||||||
:type: str
|
:type: str
|
||||||
|
|
|
@ -4,6 +4,11 @@ from typing import Type, Dict, Tuple, Optional, Any, Union, ClassVar, Callable a
|
||||||
from .providers import Provider
|
from .providers import Provider
|
||||||
|
|
||||||
|
|
||||||
|
C_Base = TypeVar('C_Base', bound='Container')
|
||||||
|
C = TypeVar('C', bound='DeclarativeContainer')
|
||||||
|
C_Overriding = TypeVar('C_Overriding', bound='DeclarativeContainer')
|
||||||
|
|
||||||
|
|
||||||
class Container:
|
class Container:
|
||||||
provider_type: Type[Provider] = Provider
|
provider_type: Type[Provider] = Provider
|
||||||
providers: Dict[str, Provider]
|
providers: Dict[str, Provider]
|
||||||
|
@ -13,7 +18,7 @@ class Container:
|
||||||
def __setattr__(self, name: str, value: Union[Provider, Any]) -> None: ...
|
def __setattr__(self, name: str, value: Union[Provider, Any]) -> None: ...
|
||||||
def __delattr__(self, name: str) -> None: ...
|
def __delattr__(self, name: str) -> None: ...
|
||||||
def set_providers(self, **providers: Provider): ...
|
def set_providers(self, **providers: Provider): ...
|
||||||
def override(self, overriding: DynamicContainer) -> None: ...
|
def override(self, overriding: C_Base) -> None: ...
|
||||||
def override_providers(self, **overriding_providers: Provider) -> None: ...
|
def override_providers(self, **overriding_providers: Provider) -> None: ...
|
||||||
def reset_last_overriding(self) -> None: ...
|
def reset_last_overriding(self) -> None: ...
|
||||||
def reset_override(self) -> None: ...
|
def reset_override(self) -> None: ...
|
||||||
|
@ -31,9 +36,6 @@ class DeclarativeContainer(Container):
|
||||||
def __init__(self, **overriding_providers: Union[Provider, Any]) -> None: ...
|
def __init__(self, **overriding_providers: Union[Provider, Any]) -> None: ...
|
||||||
|
|
||||||
|
|
||||||
C = TypeVar('C', bound=DeclarativeContainer)
|
|
||||||
C_Overriding = TypeVar('C_Overriding', bound=DeclarativeContainer)
|
|
||||||
|
|
||||||
|
|
||||||
def override(container: Type[C]) -> _Callable[[Type[C_Overriding]], Type[C_Overriding]]: ...
|
def override(container: Type[C]) -> _Callable[[Type[C_Overriding]], Type[C_Overriding]]: ...
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,11 @@ class Container31(containers.DeclarativeContainer):
|
||||||
@containers.copy(Container31)
|
@containers.copy(Container31)
|
||||||
class Container32(containers.DeclarativeContainer):
|
class Container32(containers.DeclarativeContainer):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
# Test 4: to override()
|
||||||
|
class Container4(containers.DeclarativeContainer):
|
||||||
|
provider = providers.Factory(int)
|
||||||
|
|
||||||
|
container4 = Container4()
|
||||||
|
container4.override(Container4())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user