Parse Yaml
hexa.parse_yaml
Summary
Parse a hexa YAML spec into a :class:PortNode tree.
The YAML grammar uses a nested mapping format built from three member kinds:
- attribute: a
name: typescalar (e.g.source_type: str) - nested struct: a
name:mapping of sub-attributes (e.g.source:) - port: a
name:mapping whose single key is a class whose value is a body, or a class key with a...body. A port carries a class shape.
Example::
1 2 3 4 5 6 7 8 9 10 11 12 | |
Disambiguation of a mapping value
A mapping with exactly one key whose value is a non-scalar body (a mapping,
..., or a list) is a port. Any other mapping (multiple keys, or all
scalar-typed values) is a nested struct of attributes.
See samples/minimal/sample.yaml and
samples/extraction_pipeline/extraction_pipeline.yaml for examples.
Classes
Functions
parse_yaml
Parse a hexa YAML spec file into a :class:PortNode tree.
Parameters
path : str | Path
Path to the .yaml file.
Returns
PortNode The root node of the parsed tree.
Raises
ValueError On structural errors in the YAML.