-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use @dataclass for cirq.google.[De]SerializingArg #2494
Conversation
cirq/google/op_deserializer.py
Outdated
"""Specification of the arguments to deserialize an argument to a gate. | ||
|
||
Attributes: | ||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this looks silly. But in my experimentation sphynx only seemed to understand the Args section, not the Attributes section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could try digging into the napoleon documentation to see if there's some flag you need to set. IIRC napoleon (used for turning google-style docstrings into sphinx/rst) has a lot of flags you can set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted attributes->args change (will address in later PR if needed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love dataclasses
cirq/google/op_serializer.py
Outdated
('gate_getter', | ||
Union[str, Callable[['cirq.Gate'], arg_func_langs.ArgValue]]), | ||
('required', bool)])): | ||
@dataclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider @dataclass(frozen=True)
for immutability and hashability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Automerge cancelled: A status check is failing. |
Automerge cancelled: There are merge conflicts. |
# Conflicts: # cirq/google/serializable_gate_set.py
No description provided.