spec.load_unit

spec.load_unit(path)

Read one regen/units/<unit>.toml file.

Parameters

Name Type Description Default
path Path Path of the file. required

Returns

Name Type Description
Unit Unit The parsed unit.

Raises

Name Type Description
SpecError If a required field is missing, a vocabulary value is unknown or an intent id repeats.

Examples

from pathlib import Path
from tempfile import TemporaryDirectory

from spotregen import load_unit, make_sample_repo

with TemporaryDirectory() as tmp:
    root = make_sample_repo(Path(tmp) / "demo")
    unit = load_unit(root / "regen" / "units" / "core.calc.toml")
    print(unit.name, [item.id for item in unit.intent])
samplepkg.core.calc ['C-1']