MCPcopy
hub / github.com/Qiskit/qiskit / iter_captures

Method iter_captures

qiskit/circuit/quantumcircuit.py:2713–2723  ·  view source on GitHub ↗

Get an iterable over all identifiers are captured by this circuit scope from a containing scope. This excludes input variables (see :meth:`iter_input_vars`) and locally declared variables and stretches (see :meth:`iter_declared_vars` and :meth:`iter_declared_stretches`).

(self)

Source from the content-addressed store, hash-verified

2711 return self._data.get_input_vars()
2712
2713 def iter_captures(self) -> typing.Iterable[expr.Var | expr.Stretch]:
2714 """Get an iterable over all identifiers are captured by this circuit scope from a
2715 containing scope. This excludes input variables (see :meth:`iter_input_vars`)
2716 and locally declared variables and stretches (see :meth:`iter_declared_vars`
2717 and :meth:`iter_declared_stretches`)."""
2718 if self._control_flow_scopes:
2719 return itertools.chain(
2720 self._control_flow_scopes[-1].iter_captured_vars(),
2721 self._control_flow_scopes[-1].iter_captured_stretches(),
2722 )
2723 return itertools.chain(self._data.get_captured_vars(), self._data.get_captured_stretches())
2724
2725 def iter_captured_vars(self) -> typing.Iterable[expr.Var]:
2726 """Get an iterable over all real-time classical variables that are captured by this circuit

Callers 8

contractFunction · 0.80
copy_with_remappingMethod · 0.80
appendMethod · 0.80
extract_localMethod · 0.80

Calls 2

iter_captured_varsMethod · 0.45