Skip to content

DependencyInitializationContext

Contains information about initializing a particular dependency.

Use in cases where you want to avoid using .wire calls for parameter injection.

Functions

__init__()

Initialize an empty context.

add_param(klass, argument_name, parameter_ref)

Add a parameter to the context.

Parameters:

Name Type Description Default
klass type

The class type which this parameter belongs to

required
argument_name str

The name of the parameter in the klass initializer.

required
parameter_ref ParameterReference

A reference to a parameter in the bag.

required

update(klass, params)

Merge the context information for a particular type.

Updates the context with the values from the new dictionary. Parameters from the argument will overwrite any existing ones with the same name. Behaves the same as the standard dict.update. Parameter values will be wrapped in ParameterWrapper.

Parameters:

Name Type Description Default
klass type

The class type to be updated

required
params dict[str, ParameterReference]

A dictionary of parameter references. Keys map to the parameter name and values contain references to parameters in the bag.

required