cirq-core 1.7.0.dev20250814193859__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.dev20250814193859"
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.dev20250814193859"
6
+ assert cirq.__version__ == "1.7.0.dev20250814213759"
@@ -147,7 +147,7 @@ def _parse_formula_using_token_map(
147
147
  def apply(op: str | _HangingNode) -> None:
148
148
  assert isinstance(op, _HangingNode)
149
149
  if len(vals) < 2:
150
- raise ValueError("Bad expression: operated on nothing.\ntext={text!r}")
150
+ raise ValueError(f"Bad expression: operated on nothing.\ntext={text!r}")
151
151
  b = vals.pop()
152
152
  a = vals.pop()
153
153
  # Note: vals seems to be _HangingToken
@@ -157,7 +157,7 @@ def _parse_formula_using_token_map(
157
157
  def close_paren() -> None:
158
158
  while True:
159
159
  if len(ops) == 0:
160
- raise ValueError("Bad expression: unmatched ')'.\ntext={text!r}")
160
+ raise ValueError(f"Bad expression: unmatched ')'.\ntext={text!r}")
161
161
  op = ops.pop()
162
162
  if op == "(":
163
163
  break
@@ -193,7 +193,7 @@ def _parse_formula_using_token_map(
193
193
  token_unary_action = token.unary_action
194
194
  ops.append(_HangingNode(func=lambda _, b: token_unary_action(b), weight=np.inf))
195
195
  elif token.binary_action is not None:
196
- raise ValueError("Bad expression: binary op in bad spot.\ntext={text!r}")
196
+ raise ValueError(f"Bad expression: binary op in bad spot.\ntext={text!r}")
197
197
 
198
198
  was_valid_end_token = False
199
199
  for token in tokens:
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
cirq/study/resolver.py CHANGED
@@ -202,7 +202,7 @@ class ParamResolver:
202
202
  if value in self._deep_eval_map:
203
203
  v = self._deep_eval_map[value]
204
204
  if v is _RECURSION_FLAG:
205
- raise RecursionError('Evaluation of {value} indirectly contains itself.')
205
+ raise RecursionError(f'Evaluation of {value} indirectly contains itself.')
206
206
  return v
207
207
 
208
208
  # There isn't a full evaluation for 'value' yet. Until it's ready,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.7.0.dev20250814193859
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=lH3ynM5h8YtlvT-pVsjCt45cDtUG0Ug0Bs4Edrp_z84,1206
8
- cirq/_version_test.py,sha256=eKzesangsb5Pl1i5dfdZI_zCr3kfFauud8aqspsmPmg,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
@@ -248,7 +248,7 @@ cirq/interop/quirk/cells/input_rotation_cells.py,sha256=TlxRbKQ6IPN8XgA7qocwufgn
248
248
  cirq/interop/quirk/cells/input_rotation_cells_test.py,sha256=uYIkzwQioX9GxrKrEGgMAVn_OFnmqcT4nWPoK3NGLOQ,6410
249
249
  cirq/interop/quirk/cells/measurement_cells.py,sha256=U3I8wEX5BVp8Rlg1MkQAwaRMJ6wl6KGC805RGMoSO8A,1526
250
250
  cirq/interop/quirk/cells/measurement_cells_test.py,sha256=DFc5Do4ePN5dGSzmbkXCpAwJ8UTth031uhq9QqpIEKw,1618
251
- cirq/interop/quirk/cells/parse.py,sha256=WKP0krx-7whsNrsbgVX9_97ZIi1zm2uYELQZ5KedI_o,11857
251
+ cirq/interop/quirk/cells/parse.py,sha256=THngP-aipoXuzd9lhEcTo_AhTCCDCybkaooDnwwYyaI,11860
252
252
  cirq/interop/quirk/cells/parse_test.py,sha256=w3Vp13EBAcMvpCgWK9fzYwfBpVF4ax6JAqASLmFrYWg,7625
253
253
  cirq/interop/quirk/cells/qubit_permutation_cells.py,sha256=2xBQt93gS0aam64ZU54Z8wnraIU5_G8auJLq5-7dBjU,3417
254
254
  cirq/interop/quirk/cells/qubit_permutation_cells_test.py,sha256=HEg156HfRnTSciiYEr_H3oIBtvF0GNafKwb2Gy53k5U,4552
@@ -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
@@ -977,7 +977,7 @@ cirq/sim/clifford/stabilizer_state_ch_form_test.py,sha256=UuvgpwexGB5LzMfaa3Gws2
977
977
  cirq/study/__init__.py,sha256=OyJhZjBiEkNbtSuSZaOwHGwwnOIGgnn-W8ec0xHhHBI,1647
978
978
  cirq/study/flatten_expressions.py,sha256=q9U-AukDri63yC4pF_dEKCX81RfquK4z31ktLkL0gz0,15528
979
979
  cirq/study/flatten_expressions_test.py,sha256=ONYcsFoL7Re7IsySwXgnnIlrWCuUu1ds2f90-2uNj1c,6202
980
- cirq/study/resolver.py,sha256=eJW9cIj4AncLCPOhv7X5MAAM1DnpcCybQPHzn6hYJL4,11746
980
+ cirq/study/resolver.py,sha256=TozodaKHKobwTKVR3g3DblzPljTrErAxVHryZVwpraQ,11747
981
981
  cirq/study/resolver_test.py,sha256=LY1h8RCPY4d_8O5hprRcIf3HFhzODQrMbUrmwmt1fbM,10727
982
982
  cirq/study/result.py,sha256=ci9Pg9IW4OMR4aZ4SaQ7TPVTgoSU-1WarjKEXBv2F2g,19214
983
983
  cirq/study/result_test.py,sha256=Safhg93E1x7NA--bxvkMwOnTPAlT0VkfF6hdsEKvhEM,15627
@@ -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.dev20250814193859.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
- cirq_core-1.7.0.dev20250814193859.dist-info/METADATA,sha256=9g5DeT0JzUyNT47vF-YQLQocySY2KBwGdRDp9nZFJ2c,4857
1239
- cirq_core-1.7.0.dev20250814193859.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
- cirq_core-1.7.0.dev20250814193859.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
- cirq_core-1.7.0.dev20250814193859.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,,