mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-04 20:33:13 +03:00
Merge branch 'release/4.0.2' into master
This commit is contained in:
commit
11ac677d42
|
@ -7,6 +7,12 @@ 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.2
|
||||||
|
-----
|
||||||
|
- Fix typing stubs for ``@container.override()`` and ``@containers.copy()`` decorators (
|
||||||
|
see `PR 302 <https://github.com/ets-labs/python-dependency-injector/pull/302>`_). Thanks
|
||||||
|
to `JarnoRFB <https://github.com/JarnoRFB>`_ for reporting the issue.
|
||||||
|
|
||||||
4.0.1
|
4.0.1
|
||||||
-----
|
-----
|
||||||
- Extend ``Configuration.from_ini()`` and ``Configuration.from_yaml()`` typing stubs to
|
- Extend ``Configuration.from_ini()`` and ``Configuration.from_yaml()`` typing stubs to
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Top-level package."""
|
"""Top-level package."""
|
||||||
|
|
||||||
__version__ = '4.0.1'
|
__version__ = '4.0.2'
|
||||||
"""Version number.
|
"""Version number.
|
||||||
|
|
||||||
:type: str
|
:type: str
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Type, Dict, Tuple, Optional, Any, Union, ClassVar, Callable as _Callable, Iterable
|
from typing import Type, Dict, Tuple, Optional, Any, Union, ClassVar, Callable as _Callable, Iterable, TypeVar
|
||||||
|
|
||||||
from .providers import Provider
|
from .providers import Provider
|
||||||
|
|
||||||
|
@ -31,9 +31,14 @@ class DeclarativeContainer(Container):
|
||||||
def __init__(self, **overriding_providers: Union[Provider, Any]) -> None: ...
|
def __init__(self, **overriding_providers: Union[Provider, Any]) -> None: ...
|
||||||
|
|
||||||
|
|
||||||
def override(container: Container) -> _Callable[[Container], Container]: ...
|
C = TypeVar('C', bound=DeclarativeContainer)
|
||||||
|
C_Overriding = TypeVar('C_Overriding', bound=DeclarativeContainer)
|
||||||
|
|
||||||
|
|
||||||
def copy(container: Container) -> _Callable[[Container], Container]: ...
|
def override(container: Type[C]) -> _Callable[[Type[C_Overriding]], Type[C_Overriding]]: ...
|
||||||
|
|
||||||
|
|
||||||
|
def copy(container: Type[C]) -> _Callable[[Type[C_Overriding]], Type[C_Overriding]]: ...
|
||||||
|
|
||||||
|
|
||||||
def is_container(instance: Any) -> bool: ...
|
def is_container(instance: Any) -> bool: ...
|
||||||
|
|
|
@ -10,3 +10,23 @@ container1 = Container1()
|
||||||
container1_type: containers.Container = Container1()
|
container1_type: containers.Container = Container1()
|
||||||
provider1: providers.Provider = container1.provider
|
provider1: providers.Provider = container1.provider
|
||||||
val1: int = container1.provider(3)
|
val1: int = container1.provider(3)
|
||||||
|
|
||||||
|
|
||||||
|
# Test 2: to check @override decorator
|
||||||
|
class Container21(containers.DeclarativeContainer):
|
||||||
|
provider = providers.Factory(int)
|
||||||
|
|
||||||
|
|
||||||
|
@containers.override(Container21)
|
||||||
|
class Container22(containers.DeclarativeContainer):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
# Test 3: to check @copy decorator
|
||||||
|
class Container31(containers.DeclarativeContainer):
|
||||||
|
provider = providers.Factory(int)
|
||||||
|
|
||||||
|
|
||||||
|
@containers.copy(Container31)
|
||||||
|
class Container32(containers.DeclarativeContainer):
|
||||||
|
...
|
||||||
|
|
Loading…
Reference in New Issue
Block a user