qgis_deployment_toolbelt.scenarios.scenario_reader module

Read and validate scenario files.

Author: Julien Moura (https://github.com/guts, Oslandia)

class qgis_deployment_toolbelt.scenarios.scenario_reader.ScenarioReader(in_yaml: str | Path | BufferedIOBase)

Bases: object

Read and validate scenario files.

__init__(in_yaml: str | Path | BufferedIOBase)

Instanciating YAML scenario reader.

check_yaml_buffer(yaml_buffer: BufferedIOBase) BufferedIOBase

Perform some checks on passed yaml file.

Parameters:

yaml_buffer – bytes reader of the yaml file to check

Returns:

checked bytes object

Return type:

BufferedIOBase

check_yaml_file(yaml_path: str | Path) Path

Perform some checks on passed yaml file and load it as Path object.

Parameters:

yaml_path – path to the yaml file to check

Returns:

sanitized yaml path

Return type:

Path

property metadata: dict

Get metadata from scenario.

Returns:

metadata

Return type:

dict

scenario: dict = None
property settings: dict

Get toolbelt settings from scenario.

Returns:

settings

Return type:

dict

property steps: list[dict]

Get steps from scenario.

Returns:

steps

Return type:

List[dict]

validate_scenario() tuple[bool, list[str]]

Validate scenario file.

TODO: use json schema to validate scenario file.

Returns:

True if scenario is valid, False otherwise and a report of validation

errors (which is None if the scenario is valid). :rtype: Tuple[bool, List[str]]