Skip to content

Commit

Permalink
Deprecate decompose_operation in cirq_google. (quantumlib#4924)
Browse files Browse the repository at this point in the history
More of quantumlib#4744 .
  • Loading branch information
MichaelBroughton authored and rht committed May 1, 2023
1 parent 0d9c56b commit e91be48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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().',
)
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

0 comments on commit e91be48

Please sign in to comment.