cirq-core 1.5.0.dev20250114165131__py3-none-any.whl → 1.5.0.dev20250114204444__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, 10, 0): # pragma: no cover
28
28
  'of cirq (e.g. "python -m pip install cirq==1.1.*")'
29
29
  )
30
30
 
31
- __version__ = "1.5.0.dev20250114165131"
31
+ __version__ = "1.5.0.dev20250114204444"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq.__version__ == "1.5.0.dev20250114165131"
6
+ assert cirq.__version__ == "1.5.0.dev20250114204444"
cirq/ops/raw_types.py CHANGED
@@ -554,6 +554,9 @@ class Operation(metaclass=abc.ABCMeta):
554
554
  resulting operation to be eventually serialized into JSON, you should
555
555
  also restrict the operation to be JSON serializable.
556
556
 
557
+ Please note that tags should be instantiated if classes are
558
+ used. Raw types are not allowed.
559
+
557
560
  Args:
558
561
  *new_tags: The tags to wrap this operation in.
559
562
  """
@@ -779,7 +782,8 @@ class TaggedOperation(Operation):
779
782
  Tags added can be of any type, but they should be Hashable in order
780
783
  to allow equality checking. If you wish to serialize operations into
781
784
  JSON, you should restrict yourself to only use objects that have a JSON
782
- serialization.
785
+ serialization. Tags cannot be raw types and should be instantiated
786
+ if classes are used.
783
787
 
784
788
  See `Operation.with_tags()` for more information on intended usage.
785
789
  """
@@ -787,6 +791,8 @@ class TaggedOperation(Operation):
787
791
  def __init__(self, sub_operation: 'cirq.Operation', *tags: Hashable):
788
792
  self._sub_operation = sub_operation
789
793
  self._tags = tuple(tags)
794
+ if any(isinstance(tag, type) for tag in tags):
795
+ raise ValueError('Tags cannot be types. Did you forget to instantiate the tag type?')
790
796
 
791
797
  @property
792
798
  def sub_operation(self) -> 'cirq.Operation':
@@ -836,6 +842,9 @@ class TaggedOperation(Operation):
836
842
  Overloads Operation.with_tags to create a new TaggedOperation
837
843
  that has the tags of this operation combined with the new_tags
838
844
  specified as the parameter.
845
+
846
+ Please note that tags should be instantiated if classes are
847
+ used. Raw types are not allowed.
839
848
  """
840
849
  if not new_tags:
841
850
  return self
@@ -458,6 +458,12 @@ def test_tagged_operation():
458
458
  assert op.with_qubits(q2).qubits == (q2,)
459
459
  assert not cirq.is_measurement(op)
460
460
 
461
+ # Tags can't be types
462
+ # This is to prevent typos of cirq.X(q1).with_tags(TagType)
463
+ # when you meant cirq.X(q1).with_tags(TagType())
464
+ with pytest.raises(ValueError, match="cannot be types"):
465
+ _ = cirq.X(q1).with_tags(cirq.Circuit)
466
+
461
467
 
462
468
  def test_with_tags_returns_same_instance_if_possible():
463
469
  untagged = cirq.X(cirq.GridQubit(1, 1))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250114165131
3
+ Version: 1.5.0.dev20250114204444
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=Qq3ZcfgD-Nb81cEppQdJqhAyrVqXKtfXZYGXT0p-Wh0,34718
4
4
  cirq/_doc.py,sha256=yDyWUD_2JDS0gShfGRb-rdqRt9-WeL7DhkqX7np0Nko,2879
5
5
  cirq/_import.py,sha256=p9gMHJscbtDDkfHOaulvd3Aer0pwUF5AXpL89XR8dNw,8402
6
6
  cirq/_import_test.py,sha256=6K_v0riZJXOXUphHNkGA8MY-JcmGlezFaGmvrNhm3OQ,1015
7
- cirq/_version.py,sha256=3BQvzGI0nXwC9qKrINfc9bpe-M81dx3jzdW5d4kyiMc,1206
8
- cirq/_version_test.py,sha256=RmLMvMIdPh6f_oA9wFujQAMV2OXMD9dTfJtR9jpdeQs,147
7
+ cirq/_version.py,sha256=c4nkkbW6iF2zH082S42WDmBUrrjt-SCjNfI_sjCOU1Y,1206
8
+ cirq/_version_test.py,sha256=qZ32OVC1Ov2-zdDM7BpudsG4VnSpB57X1h6XXilW6gM,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=cpbvJMNIh0U-l1mEVb-TqhJUEXfm2vpuR3v432ORSmg,13702
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -359,8 +359,8 @@ cirq/ops/qubit_order_or_list.py,sha256=WVnhQcOYCgAhiB4t47Kji-pN1tnvs--X5deCQwwGV
359
359
  cirq/ops/qubit_order_test.py,sha256=B9xMIxlaI7YjRUNA6AkHJuUCFejGYw-lT7ZaSl31yTU,4238
360
360
  cirq/ops/random_gate_channel.py,sha256=gKDqZa6AwdCIuuh2UOvO5oxCdGRDOInA7fI3ZLQ-LTY,5121
361
361
  cirq/ops/random_gate_channel_test.py,sha256=U3EAaAlCZkgFIYxqwcSkPsaVGrKA2PSeG_DK2ou--AE,8606
362
- cirq/ops/raw_types.py,sha256=4RoBhgadVHSsPaq5aaDzgBT--uKo_Pmvd-8yLyF9VHY,41246
363
- cirq/ops/raw_types_test.py,sha256=bZUOQSfPDZgH6Z98PKX0oBP2iWXwSh3b9dty1dFcFfM,33620
362
+ cirq/ops/raw_types.py,sha256=pPbdomUXHrS8e_eb4sZTVoOrOcbI_yW4ekn97Eowr6U,41700
363
+ cirq/ops/raw_types_test.py,sha256=AtcaAgu50IK_bsMXo4MkM_fjWQj9EQrkn9ved0_cJoo,33872
364
364
  cirq/ops/state_preparation_channel.py,sha256=PjVtoLbjBAy_XqnFAY40Am-NifeuCFVVLW6RJxph5sQ,4778
365
365
  cirq/ops/state_preparation_channel_test.py,sha256=yKUvLw_ft6cvIgRJcFQ779wZS-V6V-pzQq-rZRWdCmU,5922
366
366
  cirq/ops/swap_gates.py,sha256=cp-lKHBIXbFa2PmJnJQ8jD5W-vTWnpOZ5GdqM-5Gy8Q,11608
@@ -1203,8 +1203,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1203
1203
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1204
1204
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1205
1205
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1206
- cirq_core-1.5.0.dev20250114165131.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1207
- cirq_core-1.5.0.dev20250114165131.dist-info/METADATA,sha256=BlSaMnWnshgLocHZ5sqfkpxmCDAqUb5xQLPHcGxMDlw,2105
1208
- cirq_core-1.5.0.dev20250114165131.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1209
- cirq_core-1.5.0.dev20250114165131.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1210
- cirq_core-1.5.0.dev20250114165131.dist-info/RECORD,,
1206
+ cirq_core-1.5.0.dev20250114204444.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1207
+ cirq_core-1.5.0.dev20250114204444.dist-info/METADATA,sha256=zbqE5r_PLiAkjTP4NYkyNvx3Y49Zn4kFR_g5rxc496Q,2105
1208
+ cirq_core-1.5.0.dev20250114204444.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1209
+ cirq_core-1.5.0.dev20250114204444.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1210
+ cirq_core-1.5.0.dev20250114204444.dist-info/RECORD,,