Skip to content
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

Add a new sweep metadata from/to proto approach #6925

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BichengYing
Copy link
Collaborator

Continue #6869

This PR added a new path to encode and decode metadata to this corresponding proto. Notice this is a side path if the metadata in sweep is not encoded as Metadata class, the code path is still old and same for from_proto case. If the proto does not contain metadata proto field, the code still convert back as the old style

@BichengYing BichengYing requested review from wcourtney, vtomole, verult and a team as code owners January 7, 2025 00:04
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jan 7, 2025
Copy link
Collaborator

@senecameeks senecameeks left a comment

Choose a reason for hiding this comment

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

Some nits

)
return Metadata(
device_parameters=device_parameters or None,
label=metadata.label if metadata.HasField("label") else None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

by default protobuf will return the empty string if the label field was not populated, which is falsy and will act the same as passing None to an Optional[str] . So I don't think you need else None here

Same for param.idx above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants