InitializationContext
Bases: Generic[__T]
The initialization context for registered targets. A map between an injection target and its dependencies.
Container uses this to determine what to inject for each target.
Attributes
dependencies: Mapping[AutowireTarget[__T], dict[str, AnnotatedParameter[__T]]]
property
Read-only view of the dependency definitions.
lifetime: Mapping[type[__T], ServiceLifetime]
property
Read-only view of service lifetime mapping.
Functions
__init__()
Create a new InitializationContext.
add_dependency(target, parameter_name, value)
Update the mapping of dependencies for a particular target.
Registers a new dependency for the parameter in parameter_name. Target must have been already initialized prior to calling this.
init_target(target, lifetime=None)
Initialize the context for a particular target.
Returns true on first call. If the target is already registered it returns False.
remove_dependencies(target, names_to_remove)
Remove dependencies with names in names_to_remove
from the given target.
Target must have been already initialized prior to calling this.