qiskit-community / qiskit-qec

Qiskit quantum error correction framework
https://qiskit-community.github.io/qiskit-qec/
Apache License 2.0
79 stars 34 forks source link

Out dated access to qc.data #436

Closed drewvandeth closed 1 month ago

drewvandeth commented 1 month ago

Steps to reproduce the problem

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.