hyped.core.ops.mapping module

This module defines a collection of data processors that implement common mapping operations.

class hyped.core.ops.mapping.MappingGetItem(*args: Any, **kwargs: Any)[source]

Bases: BaseDataProcessor[MappingGetItemConfig]

Processor to retrieve a value from a mapping based on a specified key.

This processor extracts the value associated with a given key from a mapping structure. The key is defined in the processor’s configuration.

process(ctx: RunContext, mapping: _MappingFeature) wrapped_resolver, json_schema_input_type=PydanticUndefined)][source]

Retrieve a value from a mapping using a specified key.

Parameters:
  • ctx (RunContext) – Context object containing runtime information.

  • mapping (Mapping) – Input mapping structure (e.g., dictionary-like or struct).

Returns:

The value associated with the specified key in the mapping.

Return type:

Feature

class hyped.core.ops.mapping.MappingGetItemConfig(*, key: str)[source]

Bases: BaseDataProcessorConfig

Configuration class for the MappingGetItem processor.

key: str

The key used to retrieve the value from the mapping.

model_config = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

hyped.core.ops.mapping.mapping_get_item(mapping: _MappingFeature, key: str) Feature | Any | list[Any] | Scalar | Array[source]

Retrieve a value from a mapping by key using the MappingGetItem processor.

This method retrieves the value associated with a given key in the mapping. If the key is not present in the mapping’s defined schema, an error is raised.

Parameters:
  • mapping (Mapping) – Input mapping feature.

  • key (str) – The key used to retrieve the value from the mapping.

Returns:

The value associated with the specified key in the mapping.

Return type:

Feature

Raises:

KeyError – If the specified key is not present in the mapping’s schema.