Rename set_parent() to assign_parent()

This commit is contained in:
Roman Mogylatov 2021-02-11 18:06:47 -05:00
parent dd6b0caffd
commit b68d4d8d08
6 changed files with 830 additions and 833 deletions

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ class Container:
def parent_name(self) -> str: ...
@property
def parent(self) -> ProviderParent: ...
def set_parent(self, parent: ProviderParent) -> None: ...
def assign_parent(self, parent: ProviderParent) -> None: ...
@overload
def traverse(self, types: Optional[Iterable[Type[TT]]] = None) -> Iterator[TT]: ...
@classmethod

View File

@ -119,7 +119,7 @@ class DynamicContainer(Container):
self.providers[name] = value
if isinstance(value, (providers.Dependency, providers.DependenciesContainer, providers.Container)):
value.set_parent(self)
value.assign_parent(self)
super(DynamicContainer, self).__setattr__(name, value)
@ -313,8 +313,8 @@ class DynamicContainer(Container):
return self.declarative_parent.__name__
def set_parent(self, parent):
"""Set parent."""
def assign_parent(self, parent):
"""Assign parent."""
self.parent = parent
def resolve_provider_name(self, provider):
@ -348,8 +348,6 @@ class DeclarativeContainerMetaClass(type):
if isinstance(provider, providers.Provider) and not isinstance(provider, providers.Self)
}
# TODO: set dependencies parent
inherited_providers = {
name: provider
for base in bases
@ -394,7 +392,6 @@ class DeclarativeContainerMetaClass(type):
_check_provider_type(cls, value)
cls.providers[name] = value
cls.cls_providers[name] = value
# TODO: set dependencies parent
super(DeclarativeContainerMetaClass, cls).__setattr__(name, value)
def __delattr__(cls, str name):

View File

@ -3779,7 +3779,6 @@ static const char __pyx_k_overriding[] = "overriding";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_set_kwargs[] = "set_kwargs";
static const char __pyx_k_set_parent[] = "set_parent";
static const char __pyx_k_set_result[] = "set_result";
static const char __pyx_k_shutdowner[] = "shutdowner";
static const char __pyx_k_startswith[] = "startswith";
@ -3818,6 +3817,7 @@ static const char __pyx_k_BaseSingleton[] = "BaseSingleton";
static const char __pyx_k_Configuration[] = "Configuration";
static const char __pyx_k_Factory___get[] = "Factory.__get__";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_assign_parent[] = "assign_parent";
static const char __pyx_k_async_provide[] = "_async_provide";
static const char __pyx_k_asyncio_tasks[] = "asyncio.tasks";
static const char __pyx_k_class_getitem[] = "__class_getitem__";
@ -4241,6 +4241,7 @@ static PyObject *__pyx_n_s_anext;
static PyObject *__pyx_n_s_apply_overridings;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_asend;
static PyObject *__pyx_n_s_assign_parent;
static PyObject *__pyx_n_s_async_create_gen_callback;
static PyObject *__pyx_n_s_async_init_callback;
static PyObject *__pyx_n_s_async_init_instance;
@ -4493,7 +4494,6 @@ static PyObject *__pyx_n_s_set_attributes;
static PyObject *__pyx_n_s_set_container;
static PyObject *__pyx_n_s_set_exception;
static PyObject *__pyx_n_s_set_kwargs;
static PyObject *__pyx_n_s_set_parent;
static PyObject *__pyx_n_s_set_result;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
@ -4602,7 +4602,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_8__repr_
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_11instance_of___get__(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_7default___get__(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_6parent___get__(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_10set_parent(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_10assign_parent(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_7related___get__(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_12provided_by(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_14_async_provide(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_future_result, PyObject *__pyx_v_future); /* proto */
@ -4623,7 +4623,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_12resolve_provider_name(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_11parent_name___get__(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_6parent___get__(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14set_parent(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14assign_parent(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_16_override_providers(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_container); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_18__reduce_cython__(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_20__setstate_cython__(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
@ -4879,7 +4879,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_6override(
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_8apply_overridings(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_11parent_name___get__(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_6parent___get__(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_10set_parent(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_10assign_parent(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self, PyObject *__pyx_v_parent); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_7related___get__(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_12_provide(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_14__reduce_cython__(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self); /* proto */
@ -14810,7 +14810,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_2__deepc
* if is_provider(self.__parent) or is_container_instance(self.__parent)
* else self.__parent # <<<<<<<<<<<<<<
* )
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*/
__Pyx_INCREF(__pyx_v_self->__pyx___parent);
__pyx_t_1 = __pyx_v_self->__pyx___parent;
@ -14821,11 +14821,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_2__deepc
/* "dependency_injector/providers.pyx":647
* else self.__parent
* )
* copied.set_parent(copied_parent) # <<<<<<<<<<<<<<
* copied.assign_parent(copied_parent) # <<<<<<<<<<<<<<
*
* self._copy_overridings(copied, memo)
*/
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_set_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 647, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 647, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
@ -14845,7 +14845,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_2__deepc
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "dependency_injector/providers.pyx":649
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*
* self._copy_overridings(copied, memo) # <<<<<<<<<<<<<<
*
@ -16072,7 +16072,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_6parent_
* """Return parent."""
* return self.__parent # <<<<<<<<<<<<<<
*
* def set_parent(self, parent):
* def assign_parent(self, parent):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->__pyx___parent);
@ -16097,33 +16097,33 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_6parent_
/* "dependency_injector/providers.pyx":723
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
/* Python wrapper */
static PyObject *__pyx_pw_19dependency_injector_9providers_10Dependency_11set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_10Dependency_10set_parent[] = "Set parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_10Dependency_11set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pw_19dependency_injector_9providers_10Dependency_11assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_10Dependency_10assign_parent[] = "Assign parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_10Dependency_11assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_10Dependency_10set_parent(((struct __pyx_obj_19dependency_injector_9providers_Dependency *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
__Pyx_RefNannySetupContext("assign_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_10Dependency_10assign_parent(((struct __pyx_obj_19dependency_injector_9providers_Dependency *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_10set_parent(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_10assign_parent(struct __pyx_obj_19dependency_injector_9providers_Dependency *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent", 0);
__Pyx_RefNannySetupContext("assign_parent", 0);
/* "dependency_injector/providers.pyx":725
* def set_parent(self, parent):
* """Set parent."""
* def assign_parent(self, parent):
* """Assign parent."""
* self.__parent = parent # <<<<<<<<<<<<<<
*
* @property
@ -16137,8 +16137,8 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_10Dependency_10set_pa
/* "dependency_injector/providers.pyx":723
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
@ -17993,7 +17993,7 @@ static int __pyx_pf_19dependency_injector_9providers_21DependenciesContainer___i
*
* for provider in dependencies.items(): # <<<<<<<<<<<<<<
* if isinstance(provider, (Dependency, DependenciesContainer, Container)):
* provider.set_parent(self)
* provider.assign_parent(self)
*/
__pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_dependencies); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 838, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
@ -18044,7 +18044,7 @@ static int __pyx_pf_19dependency_injector_9providers_21DependenciesContainer___i
*
* for provider in dependencies.items():
* if isinstance(provider, (Dependency, DependenciesContainer, Container)): # <<<<<<<<<<<<<<
* provider.set_parent(self)
* provider.assign_parent(self)
*
*/
__pyx_t_6 = __Pyx_TypeCheck(__pyx_v_provider, __pyx_ptype_19dependency_injector_9providers_Dependency);
@ -18071,11 +18071,11 @@ static int __pyx_pf_19dependency_injector_9providers_21DependenciesContainer___i
/* "dependency_injector/providers.pyx":840
* for provider in dependencies.items():
* if isinstance(provider, (Dependency, DependenciesContainer, Container)):
* provider.set_parent(self) # <<<<<<<<<<<<<<
* provider.assign_parent(self) # <<<<<<<<<<<<<<
*
* self.__parent = None
*/
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_set_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 840, __pyx_L1_error)
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 840, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
@ -18098,7 +18098,7 @@ static int __pyx_pf_19dependency_injector_9providers_21DependenciesContainer___i
*
* for provider in dependencies.items():
* if isinstance(provider, (Dependency, DependenciesContainer, Container)): # <<<<<<<<<<<<<<
* provider.set_parent(self)
* provider.assign_parent(self)
*
*/
}
@ -18108,13 +18108,13 @@ static int __pyx_pf_19dependency_injector_9providers_21DependenciesContainer___i
*
* for provider in dependencies.items(): # <<<<<<<<<<<<<<
* if isinstance(provider, (Dependency, DependenciesContainer, Container)):
* provider.set_parent(self)
* provider.assign_parent(self)
*/
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "dependency_injector/providers.pyx":842
* provider.set_parent(self)
* provider.assign_parent(self)
*
* self.__parent = None # <<<<<<<<<<<<<<
*
@ -18421,7 +18421,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
* if is_provider(self.parent) or is_container_instance(self.parent)
* else self.parent # <<<<<<<<<<<<<<
* )
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parent); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 864, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
@ -18434,11 +18434,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
/* "dependency_injector/providers.pyx":866
* else self.parent
* )
* copied.set_parent(copied_parent) # <<<<<<<<<<<<<<
* copied.assign_parent(copied_parent) # <<<<<<<<<<<<<<
*
* self._copy_overridings(copied, memo)
*/
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_copied), __pyx_n_s_set_parent); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 866, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_copied), __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 866, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
@ -18458,7 +18458,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "dependency_injector/providers.pyx":868
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*
* self._copy_overridings(copied, memo) # <<<<<<<<<<<<<<
*
@ -18683,7 +18683,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
* provider = self.__providers.get(name)
* if not provider: # <<<<<<<<<<<<<<
* provider = Dependency()
* provider.set_parent(self)
* provider.assign_parent(self)
*/
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_provider); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 881, __pyx_L1_error)
__pyx_t_5 = ((!__pyx_t_1) != 0);
@ -18693,7 +18693,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
* provider = self.__providers.get(name)
* if not provider:
* provider = Dependency() # <<<<<<<<<<<<<<
* provider.set_parent(self)
* provider.assign_parent(self)
*
*/
__pyx_t_3 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Dependency)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 882, __pyx_L1_error)
@ -18704,11 +18704,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
/* "dependency_injector/providers.pyx":883
* if not provider:
* provider = Dependency()
* provider.set_parent(self) # <<<<<<<<<<<<<<
* provider.assign_parent(self) # <<<<<<<<<<<<<<
*
* self.__providers[name] = provider
*/
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_set_parent); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 883, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 883, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
@ -18728,7 +18728,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "dependency_injector/providers.pyx":885
* provider.set_parent(self)
* provider.assign_parent(self)
*
* self.__providers[name] = provider # <<<<<<<<<<<<<<
*
@ -18866,7 +18866,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
* provider = self.__providers.get(name)
* if not provider: # <<<<<<<<<<<<<<
* provider = Dependency()
* provider.set_parent(self)
* provider.assign_parent(self)
*/
}
@ -20170,7 +20170,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
* """Return parent."""
* return self.__parent # <<<<<<<<<<<<<<
*
* def set_parent(self, parent):
* def assign_parent(self, parent):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->__pyx___parent);
@ -20195,33 +20195,33 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
/* "dependency_injector/providers.pyx":963
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
/* Python wrapper */
static PyObject *__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_14set_parent[] = "Set parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_14assign_parent[] = "Assign parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14set_parent(((struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
__Pyx_RefNannySetupContext("assign_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14assign_parent(((struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14set_parent(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContainer_14assign_parent(struct __pyx_obj_19dependency_injector_9providers_DependenciesContainer *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent", 0);
__Pyx_RefNannySetupContext("assign_parent", 0);
/* "dependency_injector/providers.pyx":965
* def set_parent(self, parent):
* """Set parent."""
* def assign_parent(self, parent):
* """Assign parent."""
* self.__parent = parent # <<<<<<<<<<<<<<
*
* cpdef object _override_providers(self, object container):
@ -20235,8 +20235,8 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_21DependenciesContain
/* "dependency_injector/providers.pyx":963
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
@ -67169,7 +67169,7 @@ static int __pyx_pf_19dependency_injector_9providers_9Container___init__(struct
*
* if container is None: # <<<<<<<<<<<<<<
* container = container_cls()
* container.set_parent(self)
* container.assign_parent(self)
*/
__pyx_t_1 = (__pyx_v_container == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
@ -67179,7 +67179,7 @@ static int __pyx_pf_19dependency_injector_9providers_9Container___init__(struct
*
* if container is None:
* container = container_cls() # <<<<<<<<<<<<<<
* container.set_parent(self)
* container.assign_parent(self)
* self.__container = container
*/
__Pyx_INCREF(__pyx_v_container_cls);
@ -67204,11 +67204,11 @@ static int __pyx_pf_19dependency_injector_9providers_9Container___init__(struct
/* "dependency_injector/providers.pyx":3529
* if container is None:
* container = container_cls()
* container.set_parent(self) # <<<<<<<<<<<<<<
* container.assign_parent(self) # <<<<<<<<<<<<<<
* self.__container = container
*
*/
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_container, __pyx_n_s_set_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3529, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_container, __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
@ -67232,13 +67232,13 @@ static int __pyx_pf_19dependency_injector_9providers_9Container___init__(struct
*
* if container is None: # <<<<<<<<<<<<<<
* container = container_cls()
* container.set_parent(self)
* container.assign_parent(self)
*/
}
/* "dependency_injector/providers.pyx":3530
* container = container_cls()
* container.set_parent(self)
* container.assign_parent(self)
* self.__container = container # <<<<<<<<<<<<<<
*
* if self.__container and self.__overriding_providers:
@ -67671,7 +67671,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_2__deepcop
* if is_provider(self.parent) or is_container_instance(self.parent)
* else self.parent # <<<<<<<<<<<<<<
* )
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*/
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3558, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
@ -67684,11 +67684,11 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_2__deepcop
/* "dependency_injector/providers.pyx":3560
* else self.parent
* )
* copied.set_parent(copied_parent) # <<<<<<<<<<<<<<
* copied.assign_parent(copied_parent) # <<<<<<<<<<<<<<
*
* return copied
*/
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_copied), __pyx_n_s_set_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3560, __pyx_L1_error)
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_copied), __pyx_n_s_assign_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = NULL;
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
@ -67708,7 +67708,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_2__deepcop
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "dependency_injector/providers.pyx":3562
* copied.set_parent(copied_parent)
* copied.assign_parent(copied_parent)
*
* return copied # <<<<<<<<<<<<<<
*
@ -68475,7 +68475,7 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_6parent___
* """Return parent."""
* return self.__parent # <<<<<<<<<<<<<<
*
* def set_parent(self, parent):
* def assign_parent(self, parent):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->__pyx___parent);
@ -68500,33 +68500,33 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_6parent___
/* "dependency_injector/providers.pyx":3606
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
/* Python wrapper */
static PyObject *__pyx_pw_19dependency_injector_9providers_9Container_11set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_9Container_10set_parent[] = "Set parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_9Container_11set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pw_19dependency_injector_9providers_9Container_11assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/
static char __pyx_doc_19dependency_injector_9providers_9Container_10assign_parent[] = "Assign parent.";
static PyObject *__pyx_pw_19dependency_injector_9providers_9Container_11assign_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_9Container_10set_parent(((struct __pyx_obj_19dependency_injector_9providers_Container *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
__Pyx_RefNannySetupContext("assign_parent (wrapper)", 0);
__pyx_r = __pyx_pf_19dependency_injector_9providers_9Container_10assign_parent(((struct __pyx_obj_19dependency_injector_9providers_Container *)__pyx_v_self), ((PyObject *)__pyx_v_parent));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_10set_parent(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self, PyObject *__pyx_v_parent) {
static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_10assign_parent(struct __pyx_obj_19dependency_injector_9providers_Container *__pyx_v_self, PyObject *__pyx_v_parent) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_parent", 0);
__Pyx_RefNannySetupContext("assign_parent", 0);
/* "dependency_injector/providers.pyx":3608
* def set_parent(self, parent):
* """Set parent."""
* def assign_parent(self, parent):
* """Assign parent."""
* self.__parent = parent # <<<<<<<<<<<<<<
*
* @property
@ -68540,8 +68540,8 @@ static PyObject *__pyx_pf_19dependency_injector_9providers_9Container_10set_pare
/* "dependency_injector/providers.pyx":3606
* return self.__parent
*
* def set_parent(self, parent): # <<<<<<<<<<<<<<
* """Set parent."""
* def assign_parent(self, parent): # <<<<<<<<<<<<<<
* """Assign parent."""
* self.__parent = parent
*/
@ -110648,7 +110648,7 @@ static PyObject *__pyx_getprop_19dependency_injector_9providers_10Dependency_rel
static PyMethodDef __pyx_methods_19dependency_injector_9providers_Dependency[] = {
{"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10Dependency_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_10Dependency_2__deepcopy__},
{"set_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10Dependency_11set_parent, METH_O, __pyx_doc_19dependency_injector_9providers_10Dependency_10set_parent},
{"assign_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10Dependency_11assign_parent, METH_O, __pyx_doc_19dependency_injector_9providers_10Dependency_10assign_parent},
{"provided_by", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10Dependency_13provided_by, METH_O, __pyx_doc_19dependency_injector_9providers_10Dependency_12provided_by},
{"_async_provide", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_19dependency_injector_9providers_10Dependency_15_async_provide, METH_VARARGS|METH_KEYWORDS, 0},
{"_check_instance_type", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10Dependency_17_check_instance_type, METH_O, 0},
@ -110920,7 +110920,7 @@ static PyMethodDef __pyx_methods_19dependency_injector_9providers_DependenciesCo
{"reset_last_overriding", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_9reset_last_overriding, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_8reset_last_overriding},
{"reset_override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_11reset_override, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_10reset_override},
{"resolve_provider_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_13resolve_provider_name, METH_O, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_12resolve_provider_name},
{"set_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15set_parent, METH_O, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_14set_parent},
{"assign_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_15assign_parent, METH_O, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_14assign_parent},
{"_override_providers", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_17_override_providers, METH_O, __pyx_doc_19dependency_injector_9providers_21DependenciesContainer_16_override_providers},
{"__reduce_cython__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_19__reduce_cython__, METH_NOARGS, 0},
{"__setstate_cython__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_21DependenciesContainer_21__setstate_cython__, METH_O, 0},
@ -114778,7 +114778,7 @@ static PyMethodDef __pyx_methods_19dependency_injector_9providers_Container[] =
{"__getattr__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_5__getattr__, METH_O|METH_COEXIST, __pyx_doc_19dependency_injector_9providers_9Container_4__getattr__},
{"override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_7override, METH_O, __pyx_doc_19dependency_injector_9providers_9Container_6override},
{"apply_overridings", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_9apply_overridings, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9Container_8apply_overridings},
{"set_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_11set_parent, METH_O, __pyx_doc_19dependency_injector_9providers_9Container_10set_parent},
{"assign_parent", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_11assign_parent, METH_O, __pyx_doc_19dependency_injector_9providers_9Container_10assign_parent},
{"_provide", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_19dependency_injector_9providers_9Container_13_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9Container_12_provide},
{"__reduce_cython__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_15__reduce_cython__, METH_NOARGS, 0},
{"__setstate_cython__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Container_17__setstate_cython__, METH_O, 0},
@ -119460,6 +119460,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_apply_overridings, __pyx_k_apply_overridings, sizeof(__pyx_k_apply_overridings), 0, 0, 1, 1},
{&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
{&__pyx_n_s_asend, __pyx_k_asend, sizeof(__pyx_k_asend), 0, 0, 1, 1},
{&__pyx_n_s_assign_parent, __pyx_k_assign_parent, sizeof(__pyx_k_assign_parent), 0, 0, 1, 1},
{&__pyx_n_s_async_create_gen_callback, __pyx_k_async_create_gen_callback, sizeof(__pyx_k_async_create_gen_callback), 0, 0, 1, 1},
{&__pyx_n_s_async_init_callback, __pyx_k_async_init_callback, sizeof(__pyx_k_async_init_callback), 0, 0, 1, 1},
{&__pyx_n_s_async_init_instance, __pyx_k_async_init_instance, sizeof(__pyx_k_async_init_instance), 0, 0, 1, 1},
@ -119712,7 +119713,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s_set_container, __pyx_k_set_container, sizeof(__pyx_k_set_container), 0, 0, 1, 1},
{&__pyx_n_s_set_exception, __pyx_k_set_exception, sizeof(__pyx_k_set_exception), 0, 0, 1, 1},
{&__pyx_n_s_set_kwargs, __pyx_k_set_kwargs, sizeof(__pyx_k_set_kwargs), 0, 0, 1, 1},
{&__pyx_n_s_set_parent, __pyx_k_set_parent, sizeof(__pyx_k_set_parent), 0, 0, 1, 1},
{&__pyx_n_s_set_result, __pyx_k_set_result, sizeof(__pyx_k_set_result), 0, 0, 1, 1},
{&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
{&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},

View File

@ -108,7 +108,7 @@ class Dependency(Provider[T]):
def default(self) -> Provider[T]: ...
@property
def parent(self) -> ProviderParent: ...
def set_parent(self, parent: ProviderParent) -> None: ...
def assign_parent(self, parent: ProviderParent) -> None: ...
def provided_by(self, provider: Provider) -> OverridingContext: ...
@ -125,7 +125,7 @@ class DependenciesContainer(Object):
def parent_name(self) -> str: ...
@property
def parent(self) -> ProviderParent: ...
def set_parent(self, parent: ProviderParent) -> None: ...
def assign_parent(self, parent: ProviderParent) -> None: ...
class Callable(Provider[T]):
@ -372,7 +372,7 @@ class Container(Provider[T]):
def parent_name(self) -> str: ...
@property
def parent(self) -> ProviderParent: ...
def set_parent(self, parent: ProviderParent) -> None: ...
def assign_parent(self, parent: ProviderParent) -> None: ...
class Selector(Provider[Any]):

View File

@ -644,7 +644,7 @@ cdef class Dependency(Provider):
if is_provider(self.__parent) or is_container_instance(self.__parent)
else self.__parent
)
copied.set_parent(copied_parent)
copied.assign_parent(copied_parent)
self._copy_overridings(copied, memo)
@ -720,8 +720,8 @@ cdef class Dependency(Provider):
"""Return parent."""
return self.__parent
def set_parent(self, parent):
"""Set parent."""
def assign_parent(self, parent):
"""Assign parent."""
self.__parent = parent
@property
@ -837,7 +837,7 @@ cdef class DependenciesContainer(Object):
for provider in dependencies.items():
if isinstance(provider, (Dependency, DependenciesContainer, Container)):
provider.set_parent(self)
provider.assign_parent(self)
self.__parent = None
@ -863,7 +863,7 @@ cdef class DependenciesContainer(Object):
if is_provider(self.parent) or is_container_instance(self.parent)
else self.parent
)
copied.set_parent(copied_parent)
copied.assign_parent(copied_parent)
self._copy_overridings(copied, memo)
@ -880,7 +880,7 @@ cdef class DependenciesContainer(Object):
provider = self.__providers.get(name)
if not provider:
provider = Dependency()
provider.set_parent(self)
provider.assign_parent(self)
self.__providers[name] = provider
@ -960,8 +960,8 @@ cdef class DependenciesContainer(Object):
"""Return parent."""
return self.__parent
def set_parent(self, parent):
"""Set parent."""
def assign_parent(self, parent):
"""Assign parent."""
self.__parent = parent
cpdef object _override_providers(self, object container):
@ -3526,7 +3526,7 @@ cdef class Container(Provider):
if container is None:
container = container_cls()
container.set_parent(self)
container.assign_parent(self)
self.__container = container
if self.__container and self.__overriding_providers:
@ -3557,7 +3557,7 @@ cdef class Container(Provider):
if is_provider(self.parent) or is_container_instance(self.parent)
else self.parent
)
copied.set_parent(copied_parent)
copied.assign_parent(copied_parent)
return copied
@ -3603,8 +3603,8 @@ cdef class Container(Provider):
"""Return parent."""
return self.__parent
def set_parent(self, parent):
"""Set parent."""
def assign_parent(self, parent):
"""Assign parent."""
self.__parent = parent
@property