grapher.warm_formula_shapes()
Intern punched AST shapes keyed by each formula node’s NodeKey.
Usage
grapher.warm_formula_shapes(
graph,
*,
parsed=None,
)Node.formula_ast (when present) is the source of truth for formula meaning. The returned table is an optional acceleration overlay for eval and codegen; assign it to graph.formula_shapes to install it. Missing or dropped shapes fall back to AST. Correctness does not require the overlay to be warm.
Prefer Node.formula_ast when present. Duplicate formula strings still share a skeleton; each cell gets its own binding. Pass parsed from warm_preparsed_formulas to avoid a second parse for nodes that have no stored AST. That overlay is absolute-bound; shapes for those nodes intern the bound tree.
Shapes are opt-in. create_dependency_graph defaults to warm_formula_shapes=False; pass True there or call this function and assign the result.
Compression, formula rewrite, and JSON/pickle load drop or omit graph.formula_shapes (None, not serialized). After those events, call this function again and assign the result if you want the overlay. The graph does not auto-rewarm.
A live FormulaEvaluator compiles shape helpers from graph.formula_shapes at construction. Rewarming the overlay on the graph does not refresh _shape_fns on an existing evaluator; construct a new FormulaEvaluator after rewarming.
Returns
FormulaShapeTable-
Interned
install the overlay.FormulaShapeTable. Assign tograph.formula_shapesto
Raises
FormulaParseError- If any distinct normalized formula is syntactically invalid (fail-fast, same contract as warm_preparsed_formulas).