Skip to content

Add bytes to cirq_google proto #7201

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

Merged
merged 2 commits into from
Mar 31, 2025

Conversation

dstrain115
Copy link
Collaborator

  • Adds bytes to the cirq_google Arg proto
  • Adds hooks in arg_func_langs to serialize and deserialize it.

- Adds bytes to the cirq_google Arg proto
- Adds hooks in arg_func_langs to serialize and
deserialize it.
@dstrain115 dstrain115 requested review from wcourtney, vtomole, verult and a team as code owners March 31, 2025 13:28
Copy link

codecov bot commented Mar 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (c50ce1e) to head (98afc38).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7201      +/-   ##
==========================================
- Coverage   98.14%   98.14%   -0.01%     
==========================================
  Files        1100     1100              
  Lines       96147    96244      +97     
==========================================
+ Hits        94365    94458      +93     
- Misses       1782     1786       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dstrain115 dstrain115 requested a review from senecameeks March 31, 2025 13:47
Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

Please see comments before merging.

@@ -291,6 +293,8 @@ def arg_from_proto(
return [str(v) for v in arg_value.string_values.values]
if which_val == 'value_with_unit':
return tunits.Value.from_proto(arg_value.value_with_unit)
if which_val == 'bytes_value':
return bytes(arg_value.bytes_value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note (no change necessary) - perhaps these iffs could be converted to a match-case block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SGTM, maybe in a follow-up PR.

@@ -55,6 +56,14 @@ def _json_format_kwargs() -> Dict[str, bool]:
[
(1.0, {'arg_value': {'float_value': 1.0}}),
(1, {'arg_value': {'float_value': 1.0}}),
(
bytes('abcdef', 'utf-8'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit - consider replacing bytes('abcdef', 'utf-8') --> b'abcdef'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@dstrain115 dstrain115 added this pull request to the merge queue Mar 31, 2025
Merged via the queue into quantumlib:main with commit 75f0dd3 Mar 31, 2025
38 checks passed
@dstrain115 dstrain115 deleted the add_bytes_to_proto branch March 31, 2025 23:26
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
* Add bytes to cirq_google proto

- Adds bytes to the cirq_google Arg proto
- Adds hooks in arg_func_langs to serialize and
deserialize it.

* Changed bytes to b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants