Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Fix lint in controlled circuit and Instruction.definition change #1100

Merged
merged 2 commits into from
Jul 6, 2020
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
1 change: 1 addition & 0 deletions .pylintdict
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ subspaces
substrings
succ
sudo
summands
summedops
superclass
superfast
Expand Down
3 changes: 2 additions & 1 deletion qiskit/aqua/operators/primitive_ops/circuit_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def reduce(self) -> OperatorBase:
# Check if Identity or empty instruction (need to check that type is exactly
# Instruction because some gates have lazy gate.definition population)
# pylint: disable=unidiomatic-typecheck
if isinstance(gate, IGate) or (type(gate) == Instruction and gate.definition == []):
if isinstance(gate, IGate) or (type(gate) == Instruction and
gate.definition.data == []):
del self.primitive.data[i] # type: ignore
return self

Expand Down
3 changes: 2 additions & 1 deletion qiskit/aqua/operators/state_fns/circuit_state_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ def reduce(self) -> OperatorBase:
# Check if Identity or empty instruction (need to check that type is exactly
# Instruction because some gates have lazy gate.definition population)
# pylint: disable=unidiomatic-typecheck
if isinstance(gate, IGate) or (type(gate) == Instruction and gate.definition == []):
if isinstance(gate, IGate) or (type(gate) == Instruction and
gate.definition.data == []):
del self.primitive.data[i]
return self

Expand Down
2 changes: 1 addition & 1 deletion qiskit/aqua/utils/controlled_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_controlled_circuit(circuit, ctl_qubit, tgt_circuit=None, use_basis_gates
elif op[0].name == 'u3':
apply_cu3(qc, *op[0].params, ctl_qubit, op[1][0], use_basis_gates=use_basis_gates)
elif op[0].name == 'cx':
apply_ccx(qc, ctl_qubit, *op[1], use_basis_gates=use_basis_gates)
apply_ccx(qc, ctl_qubit, op[1][0], op[1][1], use_basis_gates=use_basis_gates)
elif op[0].name == 'measure':
qc.measure(op[1], op[2])
elif op[0].name == 'barrier':
Expand Down