Skip to content

Commit e6b0d7f

Browse files
committed
Fix lint in controlled circuit and Instruction.definition change (qiskit-community#1100)
* Fix lint in controlled circuit * Fixed change to Instruction.definition
1 parent 991d3b5 commit e6b0d7f

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

.pylintdict

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,8 @@ subscriptable
644644
subspaces
645645
succ
646646
sudo
647-
SummedOps
647+
summands
648+
summedops
648649
superclass
649650
superfast
650651
suzuki

qiskit/aqua/operators/primitive_ops/circuit_op.py

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

229230
def permute(self, permutation: List[int]) -> 'CircuitOp':

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)