OverrideManager
Enables overriding of injectables registered with the container.
Functions¶
clear()
¶
Clear active injectable overrides.
delete(target, qualifier=None)
¶
Clear active override for the target injectable.
injectable(target, new, qualifier=None)
¶
Override the target injectable with new for the duration of the context manager.
Future requests to inject target will result in new being injected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
type
|
The target injectable to override. |
required |
qualifier
|
Qualifier | None
|
The qualifier of the injectable to override. Set this if injectable is registered with the qualifier parameter set to a value. |
None
|
new
|
Any
|
The new object to be injected instead of |
required |
injectables(overrides)
¶
Override a number of injectables with new for the duration of the context manager.
service(target, new, qualifier=None)
¶
Override the target injectable with new for the duration of the context manager.
Future requests to inject target will result in new being injected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
type
|
The target injectable to override. |
required |
qualifier
|
Qualifier | None
|
The qualifier of the injectable to override. Set this if injectable is registered with the qualifier parameter set to a value. |
None
|
new
|
Any
|
The new object to be injected instead of |
required |
services(overrides)
¶
Override a number of injectables with new for the duration of the context manager.
set(target, new, qualifier=None)
¶
Override the target injectable with new.
Future requests to inject target will result in new being injected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
type
|
The target injectable to override. |
required |
qualifier
|
Qualifier | None
|
The qualifier of the injectable to override. Set this if injectable is registered with the qualifier parameter set to a value. |
None
|
new
|
Any
|
The new object to be injected instead of |
required |