macaron.parsers.yaml package

Submodules

macaron.parsers.yaml.loader module

This module contains the loader for YAML files.

class macaron.parsers.yaml.loader.YamlLoader

Bases: object

The loader for loading yaml content from files.

classmethod validate_yaml_data(schema, data)

Validate the data according to the yaml schema using the yamale library.

Parameters:
  • schema (Schema) – The yamale schema.

  • data (list) – The data loaded by using yamale.make_data.

Returns:

True if the data is valid else False.

Return type:

bool

classmethod load(path, schema=None)

Load and return a Python object from a yaml file.

If schema is provided. This method will validate the loaded content against the schema.

Parameters:
  • path (os.PathLike) – The path to the yaml file.

  • schema (Schema) – The schema to validate the yaml content against (default None).

Returns:

The Python object from the yaml file or None if errors.

Return type:

Any