Skip to main content

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

AttributeTypeDescription
funccallableThe transformation function applied to dictionary values when the requested key starts with the specified prefix.
prefixstringThe 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

NameTypeDescription
datadictThe initial dictionary data to be wrapped.
funccallableThe function to apply to values when their keys match the specified prefix.
prefixstringThe 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

NameTypeDescription
datadictThe source dictionary containing the raw values to be wrapped.
funccallableThe transformation function applied to values when their keys are accessed with the specified prefix.
prefixstringThe string prefix that triggers the transformation function and is stripped before the actual dictionary lookup.