cirq-core 1.7.0.dev20250823004629__py3-none-any.whl → 1.7.0.dev20250824200454__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cirq-core might be problematic. Click here for more details.

cirq/_version.py CHANGED
@@ -28,4 +28,4 @@ if sys.version_info < (3, 11, 0): # pragma: no cover
28
28
  'of Cirq (e.g. "python -m pip install cirq==1.5.0")'
29
29
  )
30
30
 
31
- __version__ = "1.7.0.dev20250823004629"
31
+ __version__ = "1.7.0.dev20250824200454"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version() -> None:
6
- assert cirq.__version__ == "1.7.0.dev20250823004629"
6
+ assert cirq.__version__ == "1.7.0.dev20250824200454"
cirq/ops/gateset.py CHANGED
@@ -139,6 +139,8 @@ class GateFamily:
139
139
  self._gate = gate
140
140
  self._tags_to_accept = frozenset(tags_to_accept)
141
141
  self._tags_to_ignore = frozenset(tags_to_ignore)
142
+ self._should_check_tags = self._tags_to_accept or self._tags_to_ignore
143
+ self._is_instance_gate_family = isinstance(self._gate, raw_types.Gate)
142
144
  self._name = name if name else self._default_name()
143
145
  self._description = description if description else self._default_description()
144
146
  self._ignore_global_phase = ignore_global_phase
@@ -205,26 +207,30 @@ class GateFamily:
205
207
  Args:
206
208
  gate: `cirq.Gate` instance which should be checked for containment.
207
209
  """
208
- if isinstance(self.gate, raw_types.Gate):
210
+ if self._is_instance_gate_family:
209
211
  return (
210
212
  protocols.equal_up_to_global_phase(gate, self.gate)
211
213
  if self._ignore_global_phase
212
214
  else gate == self._gate
213
215
  )
214
- return isinstance(gate, self.gate)
216
+ return isinstance(gate, self.gate) # type: ignore
215
217
 
216
218
  def __contains__(self, item: raw_types.Gate | raw_types.Operation) -> bool:
217
- if self._tags_to_accept and (
218
- not isinstance(item, raw_types.Operation) or self._tags_to_accept.isdisjoint(item.tags)
219
- ):
220
- return False
221
- if isinstance(item, raw_types.Operation) and not self._tags_to_ignore.isdisjoint(item.tags):
222
- return False
219
+ if self._should_check_tags:
220
+ if self._tags_to_accept and (
221
+ not isinstance(item, raw_types.Operation)
222
+ or self._tags_to_accept.isdisjoint(item.tags)
223
+ ):
224
+ return False
225
+ if isinstance(item, raw_types.Operation) and not self._tags_to_ignore.isdisjoint(
226
+ item.tags
227
+ ):
228
+ return False
223
229
 
224
230
  if isinstance(item, raw_types.Operation):
225
- if item.gate is None:
231
+ if (gate := item.gate) is None:
226
232
  return False
227
- item = item.gate
233
+ return self._predicate(gate)
228
234
  return self._predicate(item)
229
235
 
230
236
  def __str__(self) -> str:
cirq/study/sweeps.py CHANGED
@@ -33,11 +33,13 @@ ProductOrZipSweepLike = dict['cirq.TParamKey', Union['cirq.TParamVal', Sequence[
33
33
 
34
34
 
35
35
  def _check_duplicate_keys(sweeps):
36
- keys = set()
37
- for sweep in sweeps:
38
- if any(key in keys for key in sweep.keys):
39
- raise ValueError('duplicate keys')
40
- keys.update(sweep.keys)
36
+ keys = set(itertools.chain.from_iterable(sweep.keys for sweep in sweeps))
37
+ key_count = sum(len(sweep.keys) for sweep in sweeps)
38
+ # If the total length of the sweep keys
39
+ # is not the same as the size of the set,
40
+ # then there is a duplicate key.
41
+ if key_count != len(keys):
42
+ raise ValueError('duplicate keys')
41
43
 
42
44
 
43
45
  class Sweep(metaclass=abc.ABCMeta):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.7.0.dev20250823004629
3
+ Version: 1.7.0.dev20250824200454
4
4
  Summary: A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
5
5
  Home-page: http://github.com/quantumlib/cirq
6
6
  Author: The Cirq Developers
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=emXpdD5ZvwLRlFAoQB8YatmZyU3b4e9jg6FppMTUhkU,33900
4
4
  cirq/_doc.py,sha256=BrnoABo1hk5RgB3Cgww4zLHUfiyFny0F1V-tOMCbdaU,2909
5
5
  cirq/_import.py,sha256=ixBu4EyGl46Ram2cP3p5eZVEFDW5L2DS-VyTjz4N9iw,8429
6
6
  cirq/_import_test.py,sha256=oF4izzOVZLc7NZ0aZHFcGv-r01eiFFt_JORx_x7_D4s,1089
7
- cirq/_version.py,sha256=mlqQnozxF84L_vV-4pL7Uwp3yGe-DnwWLvgfcGJrEeY,1206
8
- cirq/_version_test.py,sha256=GiEYOqyGP0sunHxh4gGS4jr2xvdlJF2lYF_OmUANgOY,155
7
+ cirq/_version.py,sha256=bHMW6O934V4_oHnqf9qAPMjgAiM-Uuvt_oIxTGv0TzY,1206
8
+ cirq/_version_test.py,sha256=K2E-4x0afwrLJNyD4mdh-YByGwtPRkI8xBoHUnSm8s8,155
9
9
  cirq/conftest.py,sha256=wSDKNdIQRDfLnXvOCWD3erheOw8JHRhdfQ53EyTUIXg,1239
10
10
  cirq/json_resolver_cache.py,sha256=A5DIgFAY1hUNt9vai_C3-gGBv24116CJMzQxMcXOax4,13726
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -317,7 +317,7 @@ cirq/ops/gate_features.py,sha256=OfjsIGftnGpNUDAYwSP4obG0FsMrHYfp49ZOjbvbmNE,108
317
317
  cirq/ops/gate_features_test.py,sha256=JYPunTBr48CQoIOB1wk2QEdPwtnmE-FxUoF6a4ZeRB8,2407
318
318
  cirq/ops/gate_operation.py,sha256=ODltw3E7o5ffL2EOTLGj4MUzenBjq6rs_kUVQj4iP0M,13332
319
319
  cirq/ops/gate_operation_test.py,sha256=4QwWxCjGXNM__6QGw1kYSbBMh_4783jBZVBJD1ERGPk,18020
320
- cirq/ops/gateset.py,sha256=Ww5MwvIkV7Qr_uBFGowmyhvyCh4N5JjDevr4ucwZybg,21492
320
+ cirq/ops/gateset.py,sha256=h_lCF6-SeUOprqulklRwBZg77kr_zNG_gvNuvPQc0pg,21786
321
321
  cirq/ops/gateset_test.py,sha256=oeJ0zLgknWxgW39_bc_8Ii_5_g5VNxiJWicZkkS-TaE,17651
322
322
  cirq/ops/global_phase_op.py,sha256=GcERs4X5h5_at6tvJc8-AcM0cVsLCRPlpPkAWMINm54,5711
323
323
  cirq/ops/global_phase_op_test.py,sha256=9BBnPZLLmBzHsMoRPMFTAShx87TJnhTLvvgLpHJF4wc,10721
@@ -983,7 +983,7 @@ cirq/study/result.py,sha256=ci9Pg9IW4OMR4aZ4SaQ7TPVTgoSU-1WarjKEXBv2F2g,19214
983
983
  cirq/study/result_test.py,sha256=Safhg93E1x7NA--bxvkMwOnTPAlT0VkfF6hdsEKvhEM,15627
984
984
  cirq/study/sweepable.py,sha256=UlpkVE9oLOgdpz0WHpQMq1ZRVbsM3r_CGM6okYr165I,4308
985
985
  cirq/study/sweepable_test.py,sha256=gMKkCoy8JxaCDeMTiDLdmcbBrioWs-teYOnqrri_2rI,5539
986
- cirq/study/sweeps.py,sha256=VhGc1Q4qJHF9QQlCpGh-X5rF3tKp0esUvWCy1y22S9M,21403
986
+ cirq/study/sweeps.py,sha256=vGNedvDb_qypXtmz-fdtFO2aePMlvLhLj_rHzE4as2k,21567
987
987
  cirq/study/sweeps_test.py,sha256=fiOKKnDyD-Ju7xeQM7A9pKkfR58VHXKdc0qw9d0MwRA,17231
988
988
  cirq/testing/__init__.py,sha256=QNkOC_QdYkiNrIxYuNjPsB_iWmTW8zUrUwOSiz_8LPg,6171
989
989
  cirq/testing/circuit_compare.py,sha256=vWgMVa-TVwTRUMyEvNV6Ah3CMRlZYVo1xn41MsCTHzo,18766
@@ -1234,8 +1234,8 @@ cirq/work/sampler.py,sha256=rxbMWvrhu3gfNSBjZKozw28lLKVvBAS_1EGyPdYe8Xg,19041
1234
1234
  cirq/work/sampler_test.py,sha256=SsMrRvLDYELyOAWLKISjkdEfrBwLYWRsT6D8WrsLM3Q,13533
1235
1235
  cirq/work/zeros_sampler.py,sha256=Fs2JWwq0n9zv7_G5Rm-9vPeHUag7uctcMOHg0JTkZpc,2371
1236
1236
  cirq/work/zeros_sampler_test.py,sha256=lQLgQDGBLtfImryys2HzQ2jOSGxHgc7-koVBUhv8qYk,3345
1237
- cirq_core-1.7.0.dev20250823004629.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
- cirq_core-1.7.0.dev20250823004629.dist-info/METADATA,sha256=2AQrdw5Qf7cBM535n9aYRXp9B0VfZZpjR0s4PBHrz-Y,4819
1239
- cirq_core-1.7.0.dev20250823004629.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
- cirq_core-1.7.0.dev20250823004629.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
- cirq_core-1.7.0.dev20250823004629.dist-info/RECORD,,
1237
+ cirq_core-1.7.0.dev20250824200454.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
+ cirq_core-1.7.0.dev20250824200454.dist-info/METADATA,sha256=jdcllNVcO0GMJmNM9l9lBQrjyLpMdb2LaCTMxplz2lU,4819
1239
+ cirq_core-1.7.0.dev20250824200454.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
+ cirq_core-1.7.0.dev20250824200454.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
+ cirq_core-1.7.0.dev20250824200454.dist-info/RECORD,,