DictWrapper
Wrap accesses to a dictionary so that certain values (those starting with the specified prefix) are passed through a function before being returned. The prefix is removed before looking up the real value.
Attributes
| Attribute | Type | Description |
|---|---|---|
| func | callable | The transformation function applied to dictionary values when the requested key starts with the specified prefix. |
| prefix | string | The string prefix used to identify keys whose values should be processed by the transformation function before being returned. |
Constructor
Signature
def DictWrapper(
data: dict,
func: callable,
prefix: string
)
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict | The initial dictionary data to be wrapped. |
| func | callable | The function to apply to values when their keys match the specified prefix. |
| prefix | string | The string prefix used to identify keys that should have their values processed by func. |
Signature
def DictWrapper(
data: dict,
func: callable,
prefix: string
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict | The source dictionary containing the raw values to be wrapped. |
| func | callable | The transformation function applied to values when their keys are accessed with the specified prefix. |
| prefix | string | The string prefix that triggers the transformation function and is stripped before the actual dictionary lookup. |