|View source on GitHub|
Return a dictionary suitable for _jsondict from a dataclass.
cirq.protocols.dataclass_json_dict( obj: Any, namespace: str = None ) -> Dict[str, Any]
Dataclasses keep track of their relevant fields, so we can automatically generate these.
Dataclasses are implemented with somewhat complex metaprogramming, and tooling (PyCharm, mypy)
have special cases for dealing with classes decorated with @dataclass. There is very little
support (and no plans for support) for decorators that wrap @dataclass (like
@cirq.json_serializable_dataclass) or combining additional decorators with @dataclass.
Although not as elegant, you may want to consider explicitly defining
_json_dict_ on your
dataclasses which simply