Skip to content

Commit 3147a93

Browse files
Fix lint in controlled circuit and Instruction.definition change (qiskit-community/qiskit-aqua#1100)
* Fix lint in controlled circuit * Fixed change to Instruction.definition
1 parent 227d588 commit 3147a93

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

qiskit/aqua/operators/primitive_ops/circuit_op.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ def reduce(self) -> OperatorBase:
223223
# Check if Identity or empty instruction (need to check that type is exactly
224224
# Instruction because some gates have lazy gate.definition population)
225225
# pylint: disable=unidiomatic-typecheck
226-
if isinstance(gate, IGate) or (type(gate) == Instruction and gate.definition == []):
226+
if isinstance(gate, IGate) or (type(gate) == Instruction and
227+
gate.definition.data == []):
227228
del self.primitive.data[i] # type: ignore
228229
return self
229230

qiskit/aqua/operators/state_fns/circuit_state_fn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ def reduce(self) -> OperatorBase:
349349
# Check if Identity or empty instruction (need to check that type is exactly
350350
# Instruction because some gates have lazy gate.definition population)
351351
# pylint: disable=unidiomatic-typecheck
352-
if isinstance(gate, IGate) or (type(gate) == Instruction and gate.definition == []):
352+
if isinstance(gate, IGate) or (type(gate) == Instruction and
353+
gate.definition.data == []):
353354
del self.primitive.data[i]
354355
return self
355356

qiskit/aqua/utils/controlled_circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def get_controlled_circuit(circuit, ctl_qubit, tgt_circuit=None, use_basis_gates
122122
elif op[0].name == 'u3':
123123
apply_cu3(qc, *op[0].params, ctl_qubit, op[1][0], use_basis_gates=use_basis_gates)
124124
elif op[0].name == 'cx':
125-
apply_ccx(qc, ctl_qubit, *op[1], use_basis_gates=use_basis_gates)
125+
apply_ccx(qc, ctl_qubit, op[1][0], op[1][1], use_basis_gates=use_basis_gates)
126126
elif op[0].name == 'measure':
127127
qc.measure(op[1], op[2])
128128
elif op[0].name == 'barrier':

0 commit comments

Comments
 (0)