kiara_modules.core.generic¶
        JsonSerializationConfig
  
      pydantic-model
  
¶
    
  
        RestoreFromJsonDictModule
¶
    
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 core/generic.py
          def create_input_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:
    return {
        "base_path": {
            "type": "string",
            "doc": "The folder that contains the serialized dict.",
        },
        "file_name": {
            "type": "string",
            "doc": "The file name of the serialized dict.",
        },
    }
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 core/generic.py
          def create_output_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:
    return {"value_item": {"type": "dict", "doc": "The deserialized dict value."}}
        RestoreScalarModule
¶
    Utility module, only used internally.
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 core/generic.py
          def create_input_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:
    return {
        "scalar_data": {
            "type": self.get_config_value("value_type"),
            "doc": "The scalar value.",
        }
    }
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 core/generic.py
          def create_output_schema(
    self,
) -> typing.Mapping[
    str, typing.Union[ValueSchema, typing.Mapping[str, typing.Any]]
]:
    return {
        "value_item": {
            "type": self.get_config_value("value_type"),
            "doc": "The loaded item.",
        }
    }
        RestoreScalarModuleConfig
  
      pydantic-model
  
¶
    
value_type: str
  
      pydantic-field
      required
  
¶
    The value type of the scalar to load.
        StoreScalarModule
¶
    
store_value(self, value, base_path)
¶
    Save the value, and return the load config needed to load it again.
Source code in core/generic.py
          def store_value(self, value: Value, base_path: str) -> typing.Dict[str, typing.Any]:
    data = value.get_value_data()
    load_config = {
        "module_type": "generic.restore_scalar",
        "module_config": {"value_type": self.get_config_value("value_type")},
        "base_path_input_name": None,
        "inputs": {"scalar_data": data},
        "output_name": "value_item",
    }
    return load_config