Skip to content

Commit

Permalink
Fix deprecations under Qiskit 1.2 (#636)
Browse files Browse the repository at this point in the history
```
test/cutting/test_wire_cutting_transforms.py: 88 warnings
test/cutting/test_cutting_workflows.py: 4 warnings
  /home/runner/work/circuit-knitting-toolbox/circuit-knitting-toolbox/circuit_knitting/cutting/wire_cutting_transforms.py:79: 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.
    other=instructions[0],

test/utils/test_transforms.py: 76 warnings
  /home/runner/work/circuit-knitting-toolbox/circuit-knitting-toolbox/test/utils/test_transforms.py:40: 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.
    if len(gate[1]) == 2:
```
  • Loading branch information
garrison authored Jul 10, 2024
1 parent 1ca5b0c commit 14acf91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion circuit_knitting/cutting/wire_cutting_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _transform_cut_wires(
mapping[gate_index[0]] += 1
else:
new_circuit.compose(
other=instructions[0],
other=instructions.operation,
qubits=[mapping[index] for index in gate_index],
inplace=True,
)
Expand Down
2 changes: 1 addition & 1 deletion test/utils/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def prepare_hwea():

# Exchange CNOTs with gates we support
for i, gate in enumerate(circuit.data):
if len(gate[1]) == 2:
if len(gate.qubits) == 2:
q1 = circuit.find_bit(gate.qubits[0])[0]
q2 = circuit.find_bit(gate.qubits[1])[0]
circuit.data[i] = CircuitInstruction(RZZGate(np.pi / 4), qubits=[q1, q2])
Expand Down

0 comments on commit 14acf91

Please sign in to comment.