qecx.ref¶
- qecx.ref(anchor)¶
Open a reference chain anchored at a document section.
Accepts a model section object or its class; walks are driven by the dataclass field tables of the model classes, not by instance data, so a chain can be built without a populated section (e.g. over an empty sequence field). The document section, and with it the leading path segment, is inferred from the anchor type. Attribute access on the returned node extends the chain;
eachprojects over a sequence field. Paths the walker cannot reach are addressed by direct construction (ScalarRef("some.path")).- Parameters:
anchor (object) – Model section object, or model section class, anchoring the chain (e.g. a code-data object or class).
- Returns:
Extendable root node addressing the anchored section.
- Return type:
- Raises:
ValueError – If the anchor type maps to no document section.
Examples
ref(code).dyieldsScalarRef("code.d").ref(code).d.XyieldsScalarRef("code.d.X").ref(layout).cell_complex.faces.each.coloryieldsSequenceRef("qubit_layout.cell_complex.faces.*.color").