@@ -113,7 +113,7 @@ def _register_resolver(dict_factory: Callable[[], Dict[str, ObjectFactory]]) ->
113
113
class SupportsJSON (Protocol ):
114
114
"""An object that can be turned into JSON dictionaries.
115
115
116
- The magic method _json_dict_ must return a trivially json-serializable
116
+ The magic method ` _json_dict_` must return a trivially json-serializable
117
117
type or other objects that support the SupportsJSON protocol.
118
118
119
119
During deserialization, a class must be able to be resolved (see
@@ -150,7 +150,7 @@ def obj_to_dict_helper(obj: Any, attribute_names: Iterable[str]) -> Dict[str, An
150
150
"""Construct a dictionary containing attributes from obj
151
151
152
152
This is useful as a helper function in objects implementing the
153
- SupportsJSON protocol, particularly in the _json_dict_ method.
153
+ SupportsJSON protocol, particularly in the ` _json_dict_` method.
154
154
155
155
In addition to keys and values specified by `attribute_names`, the
156
156
returned dictionary has an additional key "cirq_type" whose value
@@ -169,7 +169,7 @@ def obj_to_dict_helper(obj: Any, attribute_names: Iterable[str]) -> Dict[str, An
169
169
170
170
# pylint: enable=redefined-builtin
171
171
def dataclass_json_dict (obj : Any ) -> Dict [str , Any ]:
172
- """Return a dictionary suitable for _json_dict_ from a dataclass.
172
+ """Return a dictionary suitable for ` _json_dict_` from a dataclass.
173
173
174
174
Dataclasses keep track of their relevant fields, so we can automatically generate these.
175
175
@@ -607,7 +607,7 @@ def to_json(
607
607
cls: Passed to json.dump; the default value of CirqEncoder
608
608
enables the serialization of Cirq objects which implement
609
609
the SupportsJSON protocol. To support serialization of 3rd
610
- party classes, prefer adding the _json_dict_ magic method
610
+ party classes, prefer adding the ` _json_dict_` magic method
611
611
to your classes rather than overriding this default.
612
612
"""
613
613
if has_serializable_by_keys (obj ):
0 commit comments