cirq-core 1.5.0.dev20250107215806__py3-none-any.whl → 1.5.0.dev20250108145717__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.dev20250107215806"
31
+ __version__ = "1.5.0.dev20250108145717"
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.dev20250107215806"
6
+ assert cirq.__version__ == "1.5.0.dev20250108145717"
cirq/ops/identity.py CHANGED
@@ -135,6 +135,8 @@ class IdentityGate(raw_types.Gate):
135
135
  _rmul_with_qubits = _mul_with_qubits
136
136
 
137
137
  def _circuit_diagram_info_(self, args) -> Tuple[str, ...]:
138
+ if self.num_qubits() <= 0:
139
+ return NotImplemented
138
140
  return ('I',) * self.num_qubits()
139
141
 
140
142
  def _qasm_(self, args: 'cirq.QasmArgs', qubits: Tuple['cirq.Qid', ...]) -> Optional[str]:
cirq/ops/identity_test.py CHANGED
@@ -214,3 +214,21 @@ def test_identity_commutes():
214
214
  assert cirq.commutes(cirq.I, cirq.X)
215
215
  with pytest.raises(TypeError):
216
216
  cirq.commutes(cirq.I, "Gate")
217
+
218
+
219
+ def test_identity_diagram():
220
+ cirq.testing.assert_has_diagram(
221
+ cirq.Circuit(cirq.IdentityGate(3).on_each(cirq.LineQubit.range(3))),
222
+ """
223
+ 0: ───I───
224
+
225
+ 1: ───I───
226
+
227
+ 2: ───I───
228
+ """,
229
+ )
230
+ cirq.testing.assert_has_diagram(
231
+ cirq.Circuit(cirq.IdentityGate(0)()),
232
+ """
233
+ I(0)""",
234
+ )
@@ -342,7 +342,7 @@ def _op_info_with_fallback(
342
342
  rows: List[LabelEntity] = list(op.qubits)
343
343
  if args.label_map is not None:
344
344
  rows += protocols.measurement_keys_touched(op) & args.label_map.keys()
345
- if info is not None:
345
+ if info is not None and info.wire_symbols:
346
346
  if max(1, len(rows)) != len(info.wire_symbols):
347
347
  raise ValueError(f'Wanted diagram info from {op!r} for {rows!r}) but got {info!r}')
348
348
  return info
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250107215806
3
+ Version: 1.5.0.dev20250108145717
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=CAtr1Cx78Iy565nVQWtm92OusQzhb7-jk_W2uwOnaYs,1206
8
- cirq/_version_test.py,sha256=e18NtfUe3JrzzaNo7vFCnWEbqLxngqyj48pupAlRq1s,147
7
+ cirq/_version.py,sha256=mrNZoT__zOoO0SXNtxmaSeEDXqN2HC3dz_uS5PXC2Tk,1206
8
+ cirq/_version_test.py,sha256=uumqbiuCIdPtZXdGe8RKQj8G7FdH7ub-AqKj2vq-TXo,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=03MVo6Y-UYrzt9CKHmwpiBLN2ixL6uSU-OWnKZXfG7k,13302
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -304,8 +304,8 @@ cirq/ops/global_phase_op.py,sha256=4qYUov6BnBql2_yqUHI9DE60fLiLmCsKI9ZkfMLRRyo,4
304
304
  cirq/ops/global_phase_op_test.py,sha256=FjtUsohIYabTtiGytvPQw9Rzkqd6dlT7qrj4oltDbTI,9814
305
305
  cirq/ops/greedy_qubit_manager.py,sha256=O9qY8GB1KGxm3B7JEjq50sGVD51bNwTSupJpi3WUeAc,4039
306
306
  cirq/ops/greedy_qubit_manager_test.py,sha256=iVZDKes-r08raTiJHpYNmP-Dp89ok3hIU-QboL2BHdw,3300
307
- cirq/ops/identity.py,sha256=Lag4bK_QfDebiJD2xN5yM46IXn9KsoF3Afzs8c4eluw,5818
308
- cirq/ops/identity_test.py,sha256=-z5TjxNaD3_z73nGdR3RbHt6ytaYOAyYggCzwZtlQDw,7568
307
+ cirq/ops/identity.py,sha256=FtsDwxqmnHenOD0H1H5p6TGgDQ76LZfk3Z_2vpijNDY,5887
308
+ cirq/ops/identity_test.py,sha256=OIrm8v4wBVq8bbAGZ-f5TERt8Hl6aD1bL8iHCOEhzNo,7939
309
309
  cirq/ops/kraus_channel.py,sha256=tCPAEzr_GAL5vTwI43rBoiOnT04l-ebZanuuEuYWDo8,5085
310
310
  cirq/ops/kraus_channel_test.py,sha256=qH2Y9cngXzKCabd-Mq5xBYcM_wyL8c6KkrXw8kZr7Dc,4726
311
311
  cirq/ops/linear_combinations.py,sha256=WqQ2STxGpgO6KUj4yc6LfSI9OWCdzlmWMt6BkTkf2wA,39694
@@ -386,7 +386,7 @@ cirq/protocols/apply_unitary_protocol.py,sha256=giJwec5XCEt5s0_uyNEuhGBlcDeJymPv
386
386
  cirq/protocols/apply_unitary_protocol_test.py,sha256=ajjHvcBBv5n8Qh_hMPZkdsOvy1xJ774q4kuC25DJnKM,26136
387
387
  cirq/protocols/approximate_equality_protocol.py,sha256=P5mWl9BWGpobw3K7iAoupFPSqO9V2yG82rfQHWTClmM,6313
388
388
  cirq/protocols/approximate_equality_protocol_test.py,sha256=BYGw5iNU3lsdH5BUDPnqd9xfvfIo9-j5j0og_yXCQyY,9174
389
- cirq/protocols/circuit_diagram_info_protocol.py,sha256=14hKWu2oMh65UQehXyLLBDh88ZMSijdqFUVjbhqLzDE,15989
389
+ cirq/protocols/circuit_diagram_info_protocol.py,sha256=R8LiAgmCZjuFT7_8ZGQ6Mvl2H0rOGRkB5DaSgM6N3hA,16011
390
390
  cirq/protocols/circuit_diagram_info_protocol_test.py,sha256=dSvjaGEbMGuSrs4kpFen5Z-_dC1JzPvl27Dg47di4A0,10415
391
391
  cirq/protocols/commutes_protocol.py,sha256=qdJT8x7CtTILbt5zjmftKtHGRgSKHYwYzGC2WUy08Js,7454
392
392
  cirq/protocols/commutes_protocol_test.py,sha256=h0Lky4jrs7Hxrh4MeHxmxNciuofKGGZ2eC-ceWP8wKU,5849
@@ -1189,8 +1189,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1189
1189
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1190
1190
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1191
1191
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1192
- cirq_core-1.5.0.dev20250107215806.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
- cirq_core-1.5.0.dev20250107215806.dist-info/METADATA,sha256=OXQ35IIeVp3zgqbtpPux5UZodNGwAnUC_Z8y90bJ3J0,1992
1194
- cirq_core-1.5.0.dev20250107215806.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
- cirq_core-1.5.0.dev20250107215806.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
- cirq_core-1.5.0.dev20250107215806.dist-info/RECORD,,
1192
+ cirq_core-1.5.0.dev20250108145717.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
+ cirq_core-1.5.0.dev20250108145717.dist-info/METADATA,sha256=E6aNfMcs-MODEH0cMTp0NvaUteW2iixdd8yJFQFFBp4,1992
1194
+ cirq_core-1.5.0.dev20250108145717.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
+ cirq_core-1.5.0.dev20250108145717.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
+ cirq_core-1.5.0.dev20250108145717.dist-info/RECORD,,