DictContextHandlerMixin#
- class tollan.pipeline.DictContextHandlerMixin[source]#
Bases:
ContextHandlerMixinBase,GenericA helper class to access context stored in dict.
Methods Summary
get_context(data)Get context from dictionary.
get_context_dict(data)Get dictionary storing contexts.
has_context(data)Check if context key exists in dictionary.
set_context(data, context_obj)Set context in dictionary.
Methods Documentation
- classmethod get_context(data: Any) ContextT[source]#
Get context from dictionary.
Validates and converts raw context data to proper type if needed.
- Parameters:
data (Any) – Dictionary containing context
- Returns:
The context object (validated and typed)
- Return type:
ContextT
- classmethod get_context_dict(data: Any) dict[KeyT, ContextT][source]#
Get dictionary storing contexts.
- Parameters:
data (Any) – Data object (should be a dict)
- Returns:
Dictionary containing contexts keyed by handler name
- Return type:
dict[KeyT, ContextT]