Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite CircuitInstruction as iterable to avoid deprecation warning of Qiskit 1.2 #2198

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qiskit_aer/backends/aer_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def _inline_initialize(self, circ, optype):
if isinstance(optype, set) and Initialize not in optype:
return circ

for inst, _, _ in circ.data:
for datum in circ.data:
inst = datum.operation
if isinstance(inst, Initialize) and (
(not isinstance(inst.params[0], complex)) or (len(inst.params) == 1)
):
Expand All @@ -133,7 +134,8 @@ def _inline_initialize(self, circ, optype):

new_circ = circ.copy()
new_circ.data = []
for inst, qargs, cargs in circ.data:
for datum in circ.data:
inst, qargs, cargs = datum.operation, datum.qubits, datum.clbits
if isinstance(inst, Initialize) and (
(not isinstance(inst.params[0], complex)) or (len(inst.params) == 1)
):
Expand Down
3 changes: 2 additions & 1 deletion qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ def _assemble_noise_model(self, circuits, optypes, **run_options):
):
updated_circ = False
new_data = []
for inst, qargs, cargs in circ.data:
for datum in circ.data:
inst, qargs, cargs = datum.operation, datum.qubits, datum.clbits
if isinstance(inst, QuantumChannelInstruction):
updated_circ = True
if not updated_noise:
Expand Down
Loading