Skip to content

kiara.operations.merge_values

ValueMergeModule

Base class for operations that merge several values into one.

NOT USED YET.

create_input_schema(self)

Abstract method to implement by child classes, returns a description of the input schema of this module.

If returning a dictionary of dictionaries, the format of the return value is as follows (items with '*' are optional):

{ "[input_field_name]: { "type": "[value_type]", "doc*": "[a description of this input]", "optional*': [boolean whether this input is optional or required (defaults to 'False')] "[other_input_field_name]: { "type: ... ... }

Source code in kiara/operations/merge_values.py
def create_input_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:

    input_schema_dicts: typing.Mapping[
        str, typing.Mapping[str, typing.Any]
    ] = self.get_config_value("input_schemas")
    if not input_schema_dicts:
        raise Exception("No input schemas provided.")

    input_schemas: typing.Dict[str, ValueSchema] = {}
    for k, v in input_schema_dicts.items():
        input_schemas[k] = ValueSchema(**v)

    return input_schemas

create_output_schema(self)

Abstract method to implement by child classes, returns a description of the output schema of this module.

If returning a dictionary of dictionaries, the format of the return value is as follows (items with '*' are optional):

{ "[output_field_name]: { "type": "[value_type]", "doc*": "[a description of this output]" "[other_input_field_name]: { "type: ... ... }

Source code in kiara/operations/merge_values.py
def create_output_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:

    return {"merged_value": {"type": self.get_config_value("output_type")}}

ValueMergeModuleConfig pydantic-model

input_schemas: Dict[str, Mapping[str, Any]] pydantic-field required

The schemas for all of the expected inputs.

output_type: str pydantic-field required

The result type of the merged value.