Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
splch authored Apr 16, 2024
1 parent 003f9f4 commit 9e213bb
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions pennylane_ionq/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ def __init__(
sharpen=False,
):
if shots is None:
raise ValueError(
"The ionq device does not support analytic expectation values."
)
raise ValueError("The ionq device does not support analytic expectation values.")

super().__init__(wires=wires, shots=shots)
self.target = target
Expand Down Expand Up @@ -167,9 +165,7 @@ def apply(self, operations, **kwargs):
rotations = kwargs.pop("rotations", [])

if len(operations) == 0 and len(rotations) == 0:
warnings.warn(
"Circuit is empty. Empty circuits return failures. Submitting anyway."
)
warnings.warn("Circuit is empty. Empty circuits return failures. Submitting anyway.")

for i, operation in enumerate(operations):
if i > 0 and operation.name in {
Expand Down Expand Up @@ -253,8 +249,7 @@ def prob(self):
# Here, we rearrange the states to match the big-endian ordering
# expected by PennyLane.
basis_states = (
int(bin(int(k))[2:].rjust(self.num_wires, "0")[::-1], 2)
for k in self.histogram
int(bin(int(k))[2:].rjust(self.num_wires, "0")[::-1], 2) for k in self.histogram
)
idx = np.fromiter(basis_states, dtype=int)

Expand All @@ -274,9 +269,7 @@ def probability(self, wires=None, shot_range=None, bin_size=None):
if shot_range is None and bin_size is None:
return self.marginal_prob(self.prob, wires)

return self.estimate_probability(
wires=wires, shot_range=shot_range, bin_size=bin_size
)
return self.estimate_probability(wires=wires, shot_range=shot_range, bin_size=bin_size)


class SimulatorDevice(IonQDevice):
Expand Down

0 comments on commit 9e213bb

Please sign in to comment.