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

Use frozensets for key protocols #5560

Merged
merged 8 commits into from
Jun 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mypy
  • Loading branch information
daxfohl committed Jun 24, 2022
commit 51f82ed01eb138f3e41e7a8415e827e58ee97919
8 changes: 5 additions & 3 deletions cirq-core/cirq/circuits/circuit_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,14 @@ def _measurement_key_objs(self) -> FrozenSet['cirq.MeasurementKey']:
if circuit_keys and self.use_repetition_ids:
self._ensure_deterministic_loop_count()
if self.repetition_ids is not None:
circuit_keys = {
circuit_keys = frozenset(
key.with_key_path_prefix(repetition_id)
for repetition_id in self.repetition_ids
for key in circuit_keys
}
circuit_keys = {key.with_key_path_prefix(*self.parent_path) for key in circuit_keys}
)
circuit_keys = frozenset(
key.with_key_path_prefix(*self.parent_path) for key in circuit_keys
)
return frozenset(
protocols.with_measurement_key_mapping(key, dict(self.measurement_key_map))
for key in circuit_keys
Expand Down