yacmmal.load package

Submodules

yacmmal.load.base module

class yacmmal.load.base.AbstractLoader[source]

Bases: abc.ABC

Abstract class for config loaders.

abstract add_path(path: str, name: str, dclass: Type[pydantic.main.BaseModel]) yacmmal.load.base.AbstractLoader[source]
abstract extract() yacmmal.types.config.Config[source]
abstract load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]
class yacmmal.load.base.Loader(base_path: str)[source]

Bases: yacmmal.load.base.AbstractLoader

Base class for loading config files.

add_path(path: str, name: Union[str, yacmmal.types.config.ConfigAttrs], dclass: Type[pydantic.main.BaseModel]) yacmmal.load.base.Loader[source]

Adds a path to the loader.

Parameters
  • path (str) – Path to the config file.

  • name (Union[str, ConfigAttrs]) – Name of the config file.

  • dclass (Type[BaseModel]) – The dataclass to use.

Returns

The current loader.

Return type

Loader

extract() yacmmal.types.config.Config[source]

Extracts the config object.

Returns

The config object.

Return type

Config

yacmmal.load.conf module

class yacmmal.load.conf.CONFLoader(base_path: str)[source]

Bases: yacmmal.load.base.Loader

Loader for CONF files.

base_path

The base path of the config files.

Type

str

load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]

Loads a TOML file as a dataclass.

Parameters
  • path (str) – The path to the CONF file.

  • dclass (Type[BaseModel]) – The dataclass to load the CONF file as.

Returns

The loaded dataclass.

Return type

BaseModel

class yacmmal.load.conf.INILoader(base_path: str)[source]

Bases: yacmmal.load.conf.CONFLoader

Loader for INI files.

base_path

The base path of the config files.

Type

str

load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]

Loads a INI file as a dataclass.

Parameters
  • path (str) – The path to the INI file.

  • dclass (Type[BaseModel]) – The dataclass to load the INI file as.

yacmmal.load.json module

class yacmmal.load.json.JSONLoader(base_path: str)[source]

Bases: yacmmal.load.base.Loader

Loader for JSON files.

base_path

The base path of the config files.

Type

str

load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]

Loads a JSON file as a dataclass.

Parameters
  • path (str) – The path to the JSON file.

  • dclass (Type[BaseModel]) – The dataclass to load the JSON file as.

Returns

The loaded dataclass.

Return type

BaseModel

yacmmal.load.toml module

class yacmmal.load.toml.TOMLLoader(base_path: str)[source]

Bases: yacmmal.load.base.Loader

Loader for TOML files.

base_path

The base path of the config files.

Type

str

load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]

Loads a TOML file as a dataclass.

Parameters
  • path (str) – The path to the TOML file.

  • dclass (Type[BaseModel]) – The dataclass to load the TOML file as.

Returns

The loaded dataclass.

Return type

BaseModel

yacmmal.load.yaml module

class yacmmal.load.yaml.YAMLLoader(base_path: str = './')[source]

Bases: yacmmal.load.base.Loader

Loader for YAML files.

base_path

The base path to the YAML files.

Type

str

load(path: str, dclass: Type[pydantic.main.BaseModel]) pydantic.main.BaseModel[source]

Loads a YAML file.

Parameters
  • path (str) – The path to the YAML file.

  • dclass (Type[BaseModel]) – The dataclass to use.

Returns

The loaded model.

Return type

BaseModel

Module contents