Skip to content

Conversation

@dabacon
Copy link
Collaborator

@dabacon dabacon commented Jun 25, 2022

Adds missing json serialization for sweep objects.

@dabacon dabacon requested review from a team, cduck and vtomole as code owners June 25, 2022 00:22
@dabacon dabacon requested a review from 95-martin-orion June 25, 2022 00:22
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 25, 2022
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

LGTM (% one concern, below). What is the expected use case for this?

def __repr__(self) -> str:
return 'cirq.UnitSweep'

def _json_dict_(self) -> Dict[str, Any]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on the name, _Unit is a private class. Do we want it to be serializable?

If so, I think this needs a _from_json_dict_ classmethod.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This ends up being necessary in order to serialize UnitSweep. This is similar, I think to the Pauli singletons. My criteria was that with this PR it should serialize and deserialize cirq.UnitSweep correctly (should be UNIT_SWEEP btw), which it does. I think you can also use it to serialize and deserialize _Unit by going in and grabbing that class explicitly, but I don't know a way to stop this for this singleton pattern.

Copy link
Collaborator

Choose a reason for hiding this comment

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

SGTM. This can merge once the tests are sorted out.

@dabacon
Copy link
Collaborator Author

dabacon commented Jul 7, 2022

Use case is that objects that set our context for experiments should be serializable.

@dabacon
Copy link
Collaborator Author

dabacon commented Jul 12, 2022

Ugh bad merge fixing

@dabacon dabacon added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 12, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 12, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jul 12, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jul 12, 2022
@dabacon dabacon added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 12, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jul 12, 2022

Automerge cancelled: A required status check is not present.

Missing statuses: ['Coverage check', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']

@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 12, 2022
@dabacon dabacon added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 12, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 12, 2022
@CirqBot CirqBot merged commit 5bfffc3 into quantumlib:master Jul 12, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jul 12, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Adds missing json serialization for sweep objects.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Adds missing json serialization for sweep objects.
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