Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate decompose_operation in cirq_google. #4924

Merged
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
4 changes: 4 additions & 0 deletions cirq-google/cirq_google/devices/xmon_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def metadata(self) -> cirq.GridDeviceMetadata:
def qubit_set(self) -> FrozenSet[cirq.GridQubit]:
return self.qubits

@_compat.deprecated(
deadline='v0.15',
fix='XmonDevice.decompose_operation is deperecated. Please use ConvertToXmonGates().',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/deperecated/deprecated
s/ConvertToXmonGates()/cirq_google.ConvertToXmonGates()

)
def decompose_operation(self, operation: cirq.Operation) -> cirq.OP_TREE:
return convert_to_xmon_gates.ConvertToXmonGates().convert(operation)

Expand Down
8 changes: 8 additions & 0 deletions cirq-google/cirq_google/devices/xmon_device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ def test_validate_measurement_non_adjacent_qubits_ok():
)


@mock.patch.dict(os.environ, clear='CIRQ_TESTING')
def test_decompose_operation_deprecated():
d = square_device(3, 3)

with cirq.testing.assert_deprecated('decompose', deadline='v0.15'):
_ = d.decompose_operation(cirq.H(cirq.GridQubit(1, 1)))


@mock.patch.dict(os.environ, clear='CIRQ_TESTING')
def test_validate_operation_existing_qubits():
d = square_device(3, 3, holes=[cirq.GridQubit(1, 1)])
Expand Down