Implement override API

This commit is contained in:
Roman Mogylatov 2021-03-02 19:20:32 -05:00
parent 2bf3601695
commit a04827822e
2 changed files with 1970 additions and 1458 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3578,7 +3578,32 @@ cdef class Container(Provider):
raise Error('Container provider {0} can be overridden only by providers container'.format(self))
self.__container.override_providers(**provider.providers)
super().override(provider)
return super().override(provider)
def reset_last_overriding(self):
"""Reset last overriding provider.
:raise: :py:exc:`dependency_injector.errors.Error` if provider is not
overridden.
:rtype: None
"""
super().reset_last_overriding()
for provider in self.__container.providers.values():
if not provider.overridden:
continue
provider.reset_last_overriding()
def reset_override(self):
"""Reset all overriding providers.
:rtype: None
"""
super().reset_override()
for provider in self.__container.providers.values():
if not provider.overridden:
continue
provider.reset_override()
def apply_overridings(self):
"""Apply container overriding.