Skip to content

Commit

Permalink
Replace qml.QubitDevice with qml.devices.QubitDevice (#195)
Browse files Browse the repository at this point in the history
* replace qml.QubitDevice with qml.devices.QubitDevice

* Update order of imports to make CodeFactor happy
  • Loading branch information
Alex-Preciado authored Sep 17, 2024
1 parent 725ef8f commit 4668f36
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pennylane_cirq/qsim_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""
This module provides the ``QSimDevice`` and ``QSimhDevice`` from Cirq.
"""
import cirq
import numpy as np
import cirq
import pennylane as qml

try:
Expand Down Expand Up @@ -151,7 +151,7 @@ def capabilities(self): # pylint: disable=missing-function-docstring
return capabilities

def expval(self, observable, shot_range=None, bin_size=None):
return qml.QubitDevice.expval(self, observable, shot_range, bin_size)
return qml.devices.QubitDevice.expval(self, observable, shot_range, bin_size)

def apply(self, operations, **kwargs):
# pylint: disable=missing-function-docstring
Expand Down
4 changes: 2 additions & 2 deletions pennylane_cirq/simulator_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
----
"""
import cirq
import numpy as np
import cirq
import pennylane as qml

from .cirq_device import CirqDevice
Expand Down Expand Up @@ -266,7 +266,7 @@ def expval(self, observable, shot_range=None, bin_size=None):
try:
return super().expval(observable, shot_range, bin_size)
except ValueError:
return qml.QubitDevice.expval(self, observable, shot_range, bin_size)
return qml.devices.QubitDevice.expval(self, observable, shot_range, bin_size)

def _apply_basis_state(self, basis_state_operation):
super()._apply_basis_state(basis_state_operation)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mixed_simulator_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ def circuit():
qml.apply(gate)
return qml.expval(qml.PauliZ(0))

spy = mocker.spy(qml.QubitDevice, "expval")
spy = mocker.spy(qml.devices.QubitDevice, "expval")

if use_super:
mock_simulate = mocker.patch("cirq.DensityMatrixSimulator.simulate_expectation_values")
Expand Down

0 comments on commit 4668f36

Please sign in to comment.