hermes.settings

Module Contents

Classes

TomlConfigSettingsSource

A simple settings source class that loads variables from a TOML file

class hermes.settings.TomlConfigSettingsSource(settings_cls, config_path)

Bases: pydantic_settings.PydanticBaseSettingsSource

A simple settings source class that loads variables from a TOML file at the project’s root.

Here we happen to choose to use the env_file_encoding from Config when reading config.json

get_field_value(field: pydantic.fields.FieldInfo, field_name: str) Tuple[Any, str, bool]

Gets the value, the key for model creation, and a flag to determine whether value is complex.

This is an abstract method that should be overridden in every settings source classes.

Parameters:
  • field – The field.

  • field_name – The field name.

Returns:

A tuple contains the key, value and a flag to determine whether value is complex.

prepare_field_value(field_name: str, field: pydantic.fields.FieldInfo, value: Any, value_is_complex: bool) Any

Prepares the value of a field.

Parameters:
  • field_name – The field name.

  • field – The field.

  • value – The value of the field that has to be prepared.

  • value_is_complex – A flag to determine whether value is complex.

Returns:

The prepared value.

__call__() Dict[str, Any]