flowrep.parsers.item_parser module

The [key] link of a data-access chain (see chain_parser).

d[k] becomes one std.getitem node. Its key comes from a symbol (d[i]) or a ConstantRecipe peer (d[0], d["mass"]).

Labels come from chain_parser._label_base(), so an injected node carries exactly the label – and its constant peer exactly the numbering – that parsing std.getitem(d, k) would produce. That makes d[k] and std.getitem(d, k) the same recipe, which is why item access round-trips through the compiler with no desugaring: the compiler emits the call form, and re-parsing it lands back here.

class flowrep.parsers.item_parser.ItemHandler[source]

Bases: object

One std.getitem node per [key] link, plus any key constant.

feed_key(link: expr, symbol_map: SymbolScope, nodes: dict[Annotated[str, BeforeValidator(func=_validate_label, json_schema_input_type=PydanticUndefined)], Annotated[AtomicRecipe | ConstantRecipe | ForEachRecipe | IfRecipe | TryRecipe | WhileRecipe | WorkflowRecipe, FieldInfo(annotation=NoneType, required=True, discriminator='type')]], label: str, port: str) None[source]
port_base(link: expr) str[source]
property recipe: AtomicRecipe