load_panel#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.frontends.yaml_front.load_panel(path)[source]#
Read and validate a single-panel document from disk.
- Parameters:
path (
Path) – A*.panel.yamlfile.- Return type:
- Returns:
The validated scene graph. No coordinates yet – that is the solver’s job.
- Raises:
FileReadError – The file cannot be read: a
MissingFileError, also aFileNotFoundError, when it is not there.PanelSyntaxError – The document is malformed, invalid, or not UTF-8. The path is in the message.
Note
Only the document is read; files it names are read when it is compiled.
Example
>>> from pathlib import Path >>> from tempfile import TemporaryDirectory >>> from scenet import load_panel >>> with TemporaryDirectory() as folder: ... path = Path(folder) / "hello.panel.yaml" ... _ = path.write_text("cast: {a: {reference: alice}}", encoding="utf-8") ... panel = load_panel(path) >>> list(panel.cast) ['a']
See also
parse_panel, for text.compile_file, to compile the file.