cirq-core 1.5.0.dev20240927183547__py3-none-any.whl → 1.5.0.dev20241003235812__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.dev20240927183547"
31
+ __version__ = "1.5.0.dev20241003235812"
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.dev20240927183547"
6
+ assert cirq.__version__ == "1.5.0.dev20241003235812"
cirq/testing/__init__.py CHANGED
@@ -115,7 +115,8 @@ from cirq.testing.op_tree import assert_equivalent_op_tree as assert_equivalent_
115
115
 
116
116
  from cirq.testing.order_tester import OrderTester as OrderTester
117
117
 
118
- from cirq.testing.pytest_randomly_utils import (
118
+ from cirq.testing.pytest_utils import (
119
+ retry_once_after_timeout as retry_once_after_timeout,
119
120
  retry_once_with_later_random_values as retry_once_with_later_random_values,
120
121
  )
121
122
 
@@ -19,6 +19,25 @@ import warnings
19
19
  from typing import Any, Callable
20
20
 
21
21
 
22
+ def retry_once_after_timeout(testfunc: Callable) -> Callable:
23
+ """Marks a test function for one retry if it fails with TimeoutError.
24
+
25
+ This decorator is intended for test functions which occasionally fail
26
+ with TimeoutError.
27
+ """
28
+
29
+ @functools.wraps(testfunc)
30
+ def wrapped_func(*args, **kwargs) -> Any:
31
+ try:
32
+ return testfunc(*args, **kwargs)
33
+ except TimeoutError:
34
+ pass
35
+ warnings.warn("Retrying in case we have a transitive TimeoutError")
36
+ return testfunc(*args, **kwargs)
37
+
38
+ return wrapped_func
39
+
40
+
22
41
  def retry_once_with_later_random_values(testfunc: Callable) -> Callable:
23
42
  """Marks a test function for one retry with later random values.
24
43
 
@@ -19,6 +19,14 @@ import pytest
19
19
  import cirq
20
20
 
21
21
 
22
+ def test_retry_once_after_timeout():
23
+ testfunc = Mock(side_effect=[TimeoutError("first call fails"), None])
24
+ decoratedfunc = cirq.testing.retry_once_after_timeout(testfunc)
25
+ with pytest.warns(UserWarning, match="Retrying.*transitive TimeoutError"):
26
+ decoratedfunc()
27
+ assert testfunc.call_count == 2
28
+
29
+
22
30
  def test_retry_once_with_later_random_values():
23
31
  testfunc = Mock(side_effect=[AssertionError("first call fails"), None])
24
32
  decoratedfunc = cirq.testing.retry_once_with_later_random_values(testfunc)
cirq/vis/heatmap.py CHANGED
@@ -28,7 +28,6 @@ from typing import (
28
28
  SupportsFloat,
29
29
  Tuple,
30
30
  Union,
31
- TYPE_CHECKING,
32
31
  )
33
32
 
34
33
  import matplotlib as mpl
@@ -40,8 +39,6 @@ from mpl_toolkits import axes_grid1
40
39
  from cirq.devices import grid_qubit
41
40
  from cirq.vis import vis_utils
42
41
 
43
- if TYPE_CHECKING:
44
- from numpy.typing import ArrayLike
45
42
 
46
43
  QubitTuple = Tuple[grid_qubit.GridQubit, ...]
47
44
 
@@ -240,8 +237,8 @@ class Heatmap:
240
237
  ax: plt.Axes,
241
238
  ) -> None:
242
239
  """Writes annotations to the center of cells. Internal."""
243
- facecolor: ArrayLike
244
- for (center, annotation), facecolor in zip(centers_and_annot, collection.get_facecolor()):
240
+ face_colors = cast(np.ndarray, collection.get_facecolor())
241
+ for (center, annotation), facecolor in zip(centers_and_annot, face_colors):
245
242
  # Calculate the center of the cell, assuming that it is a square
246
243
  # centered at (x=col, y=row).
247
244
  if not annotation:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20240927183547
3
+ Version: 1.5.0.dev20241003235812
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=IwVVrolTqClQXzRbHNAfsYb3HfkbtIoGDeTpV4K7g0w,1206
8
- cirq/_version_test.py,sha256=vKs3ZZdiZYacxHaeYAo0kzT_1mxIOIXb__WyrpCCf_I,147
7
+ cirq/_version.py,sha256=LZS2i3xfrQwVVKv_iIEocJC3o8_wAn7XaYWbPrkDK_8,1206
8
+ cirq/_version_test.py,sha256=u7jU10eda4nn6z_pURehchtt1uLEkbsXd8zEMSg810M,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=ytePZtNZgKjOF2NiVpUTuotB-JKZmQNOFIFdvXqsxHw,13271
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -943,7 +943,7 @@ cirq/study/sweepable.py,sha256=hHBXn5MQZJawiiIXWZdn_qygbPeIFtt300wIqVHiYl8,4356
943
943
  cirq/study/sweepable_test.py,sha256=ENv03_GJmbUc_ukJoqfgG-H5C_yyx1jCcvxohSMyQVU,5502
944
944
  cirq/study/sweeps.py,sha256=zKz8hmLnpukNzUp7YjsrD8wEGxf2peX19522kUKUfWI,19850
945
945
  cirq/study/sweeps_test.py,sha256=YdXHzZO10OHoPTU2ifmsfH7KByIJeeANy91AHqX8nwg,12135
946
- cirq/testing/__init__.py,sha256=Z7hIcykeKXp9RmvfW_EnpAGLE_ZEJ1n9wpJGUURnKWA,6168
946
+ cirq/testing/__init__.py,sha256=m_HUdHcJ3HcKpGQBKCwZ6E6QSkKpIN-dUGr4e75o4tY,6217
947
947
  cirq/testing/circuit_compare.py,sha256=nBQES45wLVThOqC3WrPrYKLQP7HQ2pH5DjlJ5bHkrtU,19176
948
948
  cirq/testing/circuit_compare_test.py,sha256=AduZCzwBNFCYrjEpyS1DvIR6jU8GaFqQBBgPXyIALoU,19743
949
949
  cirq/testing/consistent_act_on.py,sha256=ofYxdotw7fDfEVaAoM3NJEG2-hTHmi5FlLZkLYfVBWE,7733
@@ -991,8 +991,8 @@ cirq/testing/op_tree.py,sha256=fb3bOoTihGWp_NvPHekI7s9YZIaBoiufDVhh4ARCfhQ,954
991
991
  cirq/testing/op_tree_test.py,sha256=MwDpi5Lw1e3Y_-9Psx9MPvbbW2x4JlOpp7hl8mBvOQA,1073
992
992
  cirq/testing/order_tester.py,sha256=0_tfixWyX_HrjTXpNrVFZT9bA6J585Ad8tjS-DsX8yU,6690
993
993
  cirq/testing/order_tester_test.py,sha256=2mifnUW_BT17jwWZjmM9p7EoJjq0Ouz54o3G8BqvDqw,5111
994
- cirq/testing/pytest_randomly_utils.py,sha256=9zF-7EdoBoNO8bl5DRzvmttXSPZMsuoQ9ktEqv8sCZw,1352
995
- cirq/testing/pytest_randomly_utils_test.py,sha256=gUz2C-azAtgDilAnWXLsOq5NzSJqLg7ykX8-86fLzoc,994
994
+ cirq/testing/pytest_utils.py,sha256=I3R5oGjZpoc2eWzEVU940hnDLwlDlD5cSa9-B4le-1I,1920
995
+ cirq/testing/pytest_utils_test.py,sha256=LbgQP5UrMapU8iB53DzBdtg69lGKnfCIjGM-yJzEp54,1314
996
996
  cirq/testing/random_circuit.py,sha256=oMoz0_VWWVmUGmJ9mu1R7NByNKtSadxdLjFyDEE1qT0,5900
997
997
  cirq/testing/random_circuit_test.py,sha256=x0ovYOIc3-QNKFjCc87LbLkWNwFZKx6T97ZCN3QGRsI,7026
998
998
  cirq/testing/repr_pretty_tester.py,sha256=dtk713qmE87Biaez3c8R83Wb7tlb4xWFfzt44iKkbto,2899
@@ -1157,7 +1157,7 @@ cirq/value/value_equality_attr_test.py,sha256=k_nl5hWxo4yMO6WNu0wU68wyeb-RN9Ua_I
1157
1157
  cirq/vis/__init__.py,sha256=YzNrNjIyUiTxKHGzYw92qzOYzx8aXkm2y_1hkfVohtU,1171
1158
1158
  cirq/vis/density_matrix.py,sha256=kMAPcRh6f0ghZKSe86nB_2iFngrDsw0pNael1EZ5BEw,4819
1159
1159
  cirq/vis/density_matrix_test.py,sha256=Xg41NQZBfoyrkaX3n9pW4q1LIxWpOW3Cr_I_Wx51GlQ,6965
1160
- cirq/vis/heatmap.py,sha256=lyx1CfPAM8NSv5LcpQM05TFS20QDuzadsffC923_Hls,17821
1160
+ cirq/vis/heatmap.py,sha256=bJFROjpY0XklepoG1n-aNcmJlhULoKdPP3rUUuRQqCA,17768
1161
1161
  cirq/vis/heatmap_test.py,sha256=5kWIxJZZbZcc93XZrZ18lF2gRUleR1iqYbWfHs4cvu4,20531
1162
1162
  cirq/vis/histogram.py,sha256=gQUrcebsk5wgPT38pWFW55jG9zaKhxp8zLRGmmVDk8s,5107
1163
1163
  cirq/vis/histogram_test.py,sha256=Qlw0e3amw_MFga-hNweiLzRCH174W9bB2qkmX_RiS-U,1904
@@ -1184,8 +1184,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
1184
1184
  cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
1185
1185
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1186
1186
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1187
- cirq_core-1.5.0.dev20240927183547.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1188
- cirq_core-1.5.0.dev20240927183547.dist-info/METADATA,sha256=VJRAMwNkkc9jAPv1a4keLpTx9jAr9w5JZV4oQ8IrsvA,1992
1189
- cirq_core-1.5.0.dev20240927183547.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1190
- cirq_core-1.5.0.dev20240927183547.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1191
- cirq_core-1.5.0.dev20240927183547.dist-info/RECORD,,
1187
+ cirq_core-1.5.0.dev20241003235812.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1188
+ cirq_core-1.5.0.dev20241003235812.dist-info/METADATA,sha256=uXRFflU62ZIPuODiuYPNT0uEhVL4sZdz1uwiftYWejg,1992
1189
+ cirq_core-1.5.0.dev20241003235812.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1190
+ cirq_core-1.5.0.dev20241003235812.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1191
+ cirq_core-1.5.0.dev20241003235812.dist-info/RECORD,,