BundleStage¶
- class BundleStage(name)[source]¶
Bases:
Stage[dict[tuple[tuple[str,Hashable], …],MetaCircuit],ExpansionResult],ABCAbstract stage that transforms a keyed MetaCircuit batch.
Subclasses declare two orthogonal contracts via class properties:
handles_measurement— this stage emits measurement QASMs and setsresult_format.consumes_dag_bodies— this stage reads (and typically mutates)meta.circuit_bodiesduringexpand.
The pipeline is transformative by design: every
BundleStageis expected to either handle measurement or consume body DAGs (or both). Declaring neither is almost always a misuse of the abstraction — metadata-only or logging passes belong outside theStageABC — so constructing such a stage emits aUserWarningat instantiation time.Attributes Summary
Whether this stage reads
meta.circuit_bodiesduringexpand.Whether this stage sets up measurement circuits and result format.
Methods Summary
expand(batch, env)Transform keyed MetaCircuit batch and return expansion lineage plus token.
reduce(results, env, token)Identity by default; override if this stage reduces results.
Attributes Documentation
- consumes_dag_bodies¶
Whether this stage reads
meta.circuit_bodiesduringexpand.Default
True— the safe assumption. Override withFalseon stages that only inspect measurement/observable metadata (e.g.MeasurementStage,PCECostStage). Used byParameterBindingStageto decide whether it can stay on the fast QASM-template render path.
- handles_measurement¶
Whether this stage sets up measurement circuits and result format.
Pipelines must contain at least one stage with this property True.
Methods Documentation