from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
for gate in qc.data:
print(gate[1])
Parts of Qiskit-qec access qc.data is the above manner or similar approaches that give the same warning. Ran tox to see. Others may exist that are not seen when running tox. These should be updated as they arise.
What is the current behavior?
This will give the following error:
DeprecationWarning: Treating CircuitInstruction as an iterable is deprecated legacy behavior since Qiskit 1.2, and will be removed in Qiskit 2.0. Instead, use the `operation`, `qubits` and `clbits` named attributes.
print(gate[1])
What is the expected behavior?
There should be no deprecation Warning. Need to switch to access via attributes.
Steps to reproduce the problem
Parts of Qiskit-qec access qc.data is the above manner or similar approaches that give the same warning. Ran tox to see. Others may exist that are not seen when running tox. These should be updated as they arise.
What is the current behavior?
This will give the following error:
What is the expected behavior?
There should be no deprecation Warning. Need to switch to access via attributes.