cirq-core 1.7.0.dev20250814212453__py3-none-any.whl → 1.7.0.dev20250814213759__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.dev20250814212453"
31
+ __version__ = "1.7.0.dev20250814213759"
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.dev20250814212453"
6
+ assert cirq.__version__ == "1.7.0.dev20250814213759"
cirq/ops/gateset.py CHANGED
@@ -416,13 +416,6 @@ class Gateset:
416
416
  g = item if isinstance(item, raw_types.Gate) else item.gate
417
417
  assert g is not None, f'`item`: {item} must be a gate or have a valid `item.gate`'
418
418
 
419
- if g in self._instance_gate_families:
420
- assert item in self._instance_gate_families[g], (
421
- f"{item} instance matches {self._instance_gate_families[g]} but "
422
- f"is not accepted by it."
423
- )
424
- return True
425
-
426
419
  for gate_mro_type in type(g).mro():
427
420
  if gate_mro_type in self._type_gate_families:
428
421
  assert item in self._type_gate_families[gate_mro_type], (
@@ -431,6 +424,13 @@ class Gateset:
431
424
  )
432
425
  return True
433
426
 
427
+ if g in self._instance_gate_families:
428
+ assert item in self._instance_gate_families[g], (
429
+ f"{item} instance matches {self._instance_gate_families[g]} but "
430
+ f"is not accepted by it."
431
+ )
432
+ return True
433
+
434
434
  return any(item in gate_family for gate_family in self._gates)
435
435
 
436
436
  def validate(self, circuit_or_optree: cirq.AbstractCircuit | op_tree.OP_TREE) -> bool:
cirq/ops/gateset_test.py CHANGED
@@ -452,3 +452,25 @@ def test_gateset_contains_op_with_no_gate():
452
452
  op = cirq.X(cirq.q(1)).with_classical_controls('a')
453
453
  assert op.gate is None
454
454
  assert op not in gf
455
+
456
+
457
+ def test_overlapping_gate_families() -> None:
458
+ """Tests if a gate belongs both to an instance and type family
459
+ but is rejected by the type family it can still be accepted."""
460
+
461
+ # The following gateset should accept ZPowGates only with the tag
462
+ # except it lets in cirq.Z with no tag
463
+ tag = "PhysicalZTag"
464
+ gf_accept = cirq.GateFamily(cirq.ZPowGate, tags_to_accept=[tag])
465
+ instance_accept = cirq.GateFamily(cirq.Z)
466
+ gs = cirq.Gateset(gf_accept, instance_accept)
467
+
468
+ instance_op = cirq.Z(q)
469
+ instance_op_with_tag = cirq.Z(q).with_tags(tag)
470
+ type_op_no_tag = cirq.ZPowGate(exponent=0.5)(q)
471
+ type_op_with_tag = cirq.ZPowGate(exponent=0.5)(q).with_tags(tag)
472
+
473
+ assert instance_op in gs
474
+ assert instance_op_with_tag in gs
475
+ assert type_op_no_tag not in gs
476
+ assert type_op_with_tag in gs
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.7.0.dev20250814212453
3
+ Version: 1.7.0.dev20250814213759
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=6NE9MDS8jk2oyHjhv4VmluiMpKucsbVAWW-2BL-Ivs4,1206
8
- cirq/_version_test.py,sha256=IC4CMDEju1ahbY-9oCKC1LGXybWoCr75zlLMb1ExDgo,155
7
+ cirq/_version.py,sha256=5OMdETPu_ahLYEAGWuvz6FQvPo90WuREbv97yjHbWdE,1206
8
+ cirq/_version_test.py,sha256=sIhxk3eJjUQHh23JJW-O4IsJAoBpH15T1Od1lktTCvo,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,8 +317,8 @@ 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=MF8JIYEM6bQu6ft9Eb19hSOillzu8MmaIoXSlmwbm5U,13447
319
319
  cirq/ops/gate_operation_test.py,sha256=4QwWxCjGXNM__6QGw1kYSbBMh_4783jBZVBJD1ERGPk,18020
320
- cirq/ops/gateset.py,sha256=9HFW5Sg_jPpao8SEd7XgLdc_6xgUwZfvb6f7pfVPIF8,21492
321
- cirq/ops/gateset_test.py,sha256=_dpKTEwXuOY-jpev9rBPEcMy4KZ7zd6GmJ5JkvZAeog,16580
320
+ cirq/ops/gateset.py,sha256=ya5OUsgd1j703Kk3hq6f-LzT1ZjBo_tl-FV0hvvlaAA,21492
321
+ cirq/ops/gateset_test.py,sha256=JGQtCOkhAC11vhlZRpwJowNfU6v-hlIt9qdRRJgvfQY,17407
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
324
324
  cirq/ops/greedy_qubit_manager.py,sha256=UTd9cTRbl4GQmf6ai6zqVBn5TR3-Vg84jJu4AN-0cxc,4050
@@ -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.dev20250814212453.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
- cirq_core-1.7.0.dev20250814212453.dist-info/METADATA,sha256=0Lfc8GRv4lEgrRYGxcVWD24NKefC3_5p6U3m4aD_wEU,4857
1239
- cirq_core-1.7.0.dev20250814212453.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
- cirq_core-1.7.0.dev20250814212453.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
- cirq_core-1.7.0.dev20250814212453.dist-info/RECORD,,
1237
+ cirq_core-1.7.0.dev20250814213759.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
+ cirq_core-1.7.0.dev20250814213759.dist-info/METADATA,sha256=6JiKvsC8phpIxxPfGPw7KLuGaCYI4Uv3OziCnTt0w6w,4857
1239
+ cirq_core-1.7.0.dev20250814213759.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
+ cirq_core-1.7.0.dev20250814213759.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
+ cirq_core-1.7.0.dev20250814213759.dist-info/RECORD,,