Skip to content

Commit 86f17eb

Browse files
authored
Update documentation to prevent markdown rendering of underscores as italics (#6255)
1 parent 6e38a27 commit 86f17eb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cirq-core/cirq/protocols/json_serialization.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _register_resolver(dict_factory: Callable[[], Dict[str, ObjectFactory]]) ->
113113
class SupportsJSON(Protocol):
114114
"""An object that can be turned into JSON dictionaries.
115115
116-
The magic method _json_dict_ must return a trivially json-serializable
116+
The magic method `_json_dict_` must return a trivially json-serializable
117117
type or other objects that support the SupportsJSON protocol.
118118
119119
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
150150
"""Construct a dictionary containing attributes from obj
151151
152152
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.
154154
155155
In addition to keys and values specified by `attribute_names`, the
156156
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
169169

170170
# pylint: enable=redefined-builtin
171171
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.
173173
174174
Dataclasses keep track of their relevant fields, so we can automatically generate these.
175175
@@ -607,7 +607,7 @@ def to_json(
607607
cls: Passed to json.dump; the default value of CirqEncoder
608608
enables the serialization of Cirq objects which implement
609609
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
611611
to your classes rather than overriding this default.
612612
"""
613613
if has_serializable_by_keys(obj):

0 commit comments

Comments
 (0)