Skip to content
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/grid_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ def _repr_pretty_(self, p: Any, cycle: bool) -> None:
def __repr__(self) -> str:
return f'cirq_google.GridDevice({repr(self._metadata)})'

@classmethod
def _json_namespace_(cls) -> str:
return 'cirq.google'

def _json_dict_(self):
return {'metadata': self._metadata}

Expand Down
2 changes: 1 addition & 1 deletion cirq-google/cirq_google/json_resolver_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def _class_resolver_dictionary() -> Dict[str, ObjectFactory]:
'GoogleNoiseProperties': cirq_google.GoogleNoiseProperties,
'SycamoreGate': cirq_google.SycamoreGate,
'GateTabulation': cirq_google.GateTabulation,
'GridDevice': cirq_google.GridDevice,
Copy link
Collaborator

Choose a reason for hiding this comment

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

[No change needed] As discussed, this is safe because GridDevice has not yet appeared in a Cirq release.

'PhysicalZTag': cirq_google.PhysicalZTag,
'FSimGateFamily': cirq_google.FSimGateFamily,
'FloquetPhasedFSimCalibrationOptions': cirq_google.FloquetPhasedFSimCalibrationOptions,
Expand Down Expand Up @@ -67,4 +66,5 @@ def _class_resolver_dictionary() -> Dict[str, ObjectFactory]:
'cirq.google.HardcodedQubitPlacer': cirq_google.HardcodedQubitPlacer,
# pylint: enable=line-too-long
'cirq.google.EngineResult': cirq_google.EngineResult,
'cirq.google.GridDevice': cirq_google.GridDevice,
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cirq_type": "GridDevice",
"cirq_type": "cirq.google.GridDevice",
"metadata": {
"cirq_type": "GridDeviceMetadata",
"qubit_pairs": [
Expand Down
1 change: 1 addition & 0 deletions cirq-google/cirq_google/json_test_data/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'SimulatedProcessorRecord',
'SimulatedProcessorWithLocalDeviceRecord',
'EngineResult',
'GridDevice',
]
},
resolver_cache=_class_resolver_dictionary(),
Expand Down