mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Deprecate declarative container decorators (#303)
This commit is contained in:
parent
11ac677d42
commit
f1867b6bf4
|
@ -7,6 +7,11 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
Development version
|
||||
-------------------
|
||||
- Deprecate ``@containers.override()`` and ``@containers.copy()`` decorators.
|
||||
- Update changelog of version ``4.0.0`` so it lists all deprecated features.
|
||||
|
||||
4.0.2
|
||||
-----
|
||||
- Fix typing stubs for ``@container.override()`` and ``@containers.copy()`` decorators (
|
||||
|
@ -33,6 +38,8 @@ Deprecations:
|
|||
- Deprecate ``ext.aiohttp`` module in favor of ``wiring`` feature.
|
||||
- Deprecate ``ext.flask`` module in favor of ``wiring`` feature.
|
||||
- Deprecate ``.delegate()`` provider method in favor of ``.provider`` attribute.
|
||||
- Deprecate ``@containers.override()`` decorator in favor of overriding container on instance level.
|
||||
- Deprecate ``@containers.copy()`` decorator.
|
||||
|
||||
Removals:
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
|||
"""Containers module."""
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
import six
|
||||
|
||||
|
@ -427,6 +428,11 @@ def override(object container):
|
|||
:return: Declarative container's overriding decorator.
|
||||
:rtype: callable(:py:class:`DeclarativeContainer`)
|
||||
"""
|
||||
warnings.warn(
|
||||
'Decorator "@override()" is deprecated since version 4.0.3. '
|
||||
'Use overriding on instance level instead "container.override(AnotherContainer())".',
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
def _decorator(object overriding_container):
|
||||
"""Overriding decorator."""
|
||||
container.override(overriding_container)
|
||||
|
@ -447,6 +453,10 @@ def copy(object container):
|
|||
:return: Declarative container's copying decorator.
|
||||
:rtype: callable(:py:class:`DeclarativeContainer`)
|
||||
"""
|
||||
warnings.warn(
|
||||
'Decorator "@copy()" is deprecated since version 4.0.3.',
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
def _decorator(copied_container):
|
||||
cdef dict memo = dict()
|
||||
for name, provider in six.iteritems(copied_container.cls_providers):
|
||||
|
|
Loading…
Reference in New Issue
Block a user