parse_panel#

Import

from scenet import parse_panel

Defined in

scenet.frontends.yaml_front (source)

Install

pip install scenet

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.parse_panel(text, *, source=None)[source]#

Parse panel source into validated IR, without compiling it.

What compile_source does first: everything an author can get wrong is found here, and nothing is placed.

Parameters:
  • text (str) – A single-panel document in the YAML surface syntax.

  • source (Path | None) – Path the text came from, prefixed to every error message.

Return type:

PanelIR

Returns:

The validated scene graph. No coordinates yet – that is the solver’s job.

Raises:

PanelSyntaxError – The document is malformed or invalid, with each fault’s place.

Note

A puppet the cast names is not looked up here, and a file the document names is not read: both are the compile’s. A document with panels: is refused.

Example

>>> from scenet import parse_panel
>>> panel = parse_panel("cast: {a: {reference: alice, at: left_third}}")
>>> panel.cast["a"].at
<AnchorX.LEFT_THIRD: 'left_third'>

See also

compile_ir, to compile what it returns. load_panel, to read a file.