cirq-core 1.4.0.dev20240110191916__py3-none-any.whl → 1.4.0.dev20240113000130__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/_compat.py CHANGED
@@ -61,12 +61,6 @@ def with_debug(value: bool) -> Iterator[None]:
61
61
  __cirq_debug__.reset(token)
62
62
 
63
63
 
64
- try:
65
- from functools import cached_property # pylint: disable=unused-import
66
- except ImportError:
67
- from backports.cached_property import cached_property # type: ignore[no-redef]
68
-
69
-
70
64
  # Sentinel used by wrapped_no_args below when method has not yet been cached.
71
65
  _NOT_FOUND = object()
72
66
 
cirq/_compat_test.py CHANGED
@@ -38,7 +38,6 @@ import cirq.testing
38
38
  from cirq._compat import (
39
39
  block_overlapping_deprecation,
40
40
  cached_method,
41
- cached_property,
42
41
  proper_repr,
43
42
  dataclass_repr,
44
43
  deprecated,
@@ -1011,23 +1010,6 @@ def test_block_overlapping_deprecation():
1011
1010
  f(5)
1012
1011
 
1013
1012
 
1014
- def test_cached_property():
1015
- class Foo:
1016
- def __init__(self):
1017
- self.bar_calls = 0
1018
-
1019
- @cached_property
1020
- def bar(self):
1021
- self.bar_calls += 1
1022
- return []
1023
-
1024
- foo = Foo()
1025
- bar = foo.bar
1026
- bar2 = foo.bar
1027
- assert bar2 is bar
1028
- assert foo.bar_calls == 1
1029
-
1030
-
1031
1013
  class Bar:
1032
1014
  def __init__(self) -> None:
1033
1015
  self.foo_calls: Dict[int, int] = collections.Counter()
cirq/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev20240110191916"
1
+ __version__ = "1.4.0.dev20240113000130"
@@ -19,6 +19,7 @@ applied as part of a larger circuit, a CircuitOperation will execute all
19
19
  component operations in order, including any nested CircuitOperations.
20
20
  """
21
21
  import math
22
+ from functools import cached_property
22
23
  from typing import (
23
24
  Callable,
24
25
  cast,
@@ -38,7 +39,7 @@ import numpy as np
38
39
  import sympy
39
40
 
40
41
  from cirq import circuits, ops, protocols, value, study
41
- from cirq._compat import cached_property, proper_repr
42
+ from cirq._compat import proper_repr
42
43
 
43
44
  if TYPE_CHECKING:
44
45
  import cirq
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  """An immutable version of the Circuit data structure."""
15
+ from functools import cached_property
15
16
  from typing import (
16
17
  AbstractSet,
17
18
  FrozenSet,
@@ -90,7 +91,7 @@ class FrozenCircuit(AbstractCircuit, protocols.SerializableByKey):
90
91
  """Returns a tuple of the Circuit's tags."""
91
92
  return self._tags
92
93
 
93
- @_compat.cached_property
94
+ @cached_property
94
95
  def untagged(self) -> 'cirq.FrozenCircuit':
95
96
  """Returns the underlying FrozenCircuit without any tags."""
96
97
  return self._from_moments(self._moments) if self.tags else self
@@ -148,7 +149,7 @@ class FrozenCircuit(AbstractCircuit, protocols.SerializableByKey):
148
149
  def all_qubits(self) -> FrozenSet['cirq.Qid']:
149
150
  return super().all_qubits()
150
151
 
151
- @_compat.cached_property
152
+ @cached_property
152
153
  def _all_operations(self) -> Tuple['cirq.Operation', ...]:
153
154
  return tuple(super().all_operations())
154
155
 
@@ -17,9 +17,10 @@
17
17
 
18
18
  import abc
19
19
  from dataclasses import dataclass, field
20
+ from functools import cached_property
20
21
  from typing import Dict, TYPE_CHECKING, List, Set, Type
21
22
 
22
- from cirq import _compat, ops, devices
23
+ from cirq import ops, devices
23
24
  from cirq.devices import noise_utils
24
25
 
25
26
  if TYPE_CHECKING:
@@ -131,7 +132,7 @@ class SuperconductingQubitsNoiseProperties(devices.NoiseProperties, abc.ABC):
131
132
  p_error -= noise_utils.decoherence_pauli_error(self.t1_ns[q], self.tphi_ns[q], time_ns)
132
133
  return p_error
133
134
 
134
- @_compat.cached_property
135
+ @cached_property
135
136
  def _depolarizing_error(self) -> Dict[noise_utils.OpIdentifier, float]:
136
137
  """Returns the portion of Pauli error from depolarization."""
137
138
  depol_errors = {}
cirq/ops/clifford_gate.py CHANGED
@@ -20,7 +20,7 @@ import numpy as np
20
20
 
21
21
  from cirq import protocols, value, linalg, qis
22
22
  from cirq._import import LazyLoader
23
- from cirq._compat import cached_property, cached_method
23
+ from cirq._compat import cached_method
24
24
  from cirq.ops import common_gates, named_qubit, raw_types, pauli_gates, phased_x_z_gate
25
25
  from cirq.ops.pauli_gates import Pauli
26
26
  from cirq.type_workarounds import NotImplementedType
@@ -693,7 +693,7 @@ class SingleQubitCliffordGate(CliffordGate):
693
693
  """
694
694
  return self._to_phased_xz_gate
695
695
 
696
- @cached_property
696
+ @functools.cached_property
697
697
  def _to_phased_xz_gate(self) -> phased_x_z_gate.PhasedXZGate:
698
698
  x_to_flip, z_to_flip = self.clifford_tableau.rs
699
699
  flip_index = int(z_to_flip) * 2 + x_to_flip
@@ -792,7 +792,7 @@ class SingleQubitCliffordGate(CliffordGate):
792
792
  def _unitary_(self) -> np.ndarray:
793
793
  return self._unitary
794
794
 
795
- @cached_property
795
+ @functools.cached_property
796
796
  def _unitary(self) -> np.ndarray:
797
797
  mat = np.eye(2)
798
798
  qubit = named_qubit.NamedQubit('arbitrary')
@@ -810,7 +810,7 @@ class SingleQubitCliffordGate(CliffordGate):
810
810
  """
811
811
  return self._decompose_gate
812
812
 
813
- @cached_property
813
+ @functools.cached_property
814
814
  def _decompose_gate(self) -> Sequence['cirq.Gate']:
815
815
  if self == SingleQubitCliffordGate.H:
816
816
  return [common_gates.H]
@@ -829,7 +829,7 @@ class SingleQubitCliffordGate(CliffordGate):
829
829
  """
830
830
  return self._decompose_rotation
831
831
 
832
- @cached_property
832
+ @functools.cached_property
833
833
  def _decompose_rotation(self) -> Sequence[Tuple[Pauli, int]]:
834
834
  x_rot = self.pauli_tuple(pauli_gates.X)
835
835
  y_rot = self.pauli_tuple(pauli_gates.Y)
@@ -926,7 +926,7 @@ class SingleQubitCliffordGate(CliffordGate):
926
926
  def _value_equality_values_(self):
927
927
  return self._value_equality_values
928
928
 
929
- @cached_property
929
+ @functools.cached_property
930
930
  def _value_equality_values(self):
931
931
  return self._clifford_tableau.matrix().tobytes() + self._clifford_tableau.rs.tobytes()
932
932
 
@@ -12,10 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import abc
15
+ from functools import cached_property
15
16
  from typing import Collection, Tuple, TYPE_CHECKING, Any, Dict, Iterator, Optional, Sequence, Union
16
17
  import itertools
17
18
 
18
- from cirq import protocols, value, _compat
19
+ from cirq import protocols, value
19
20
 
20
21
  if TYPE_CHECKING:
21
22
  import cirq
@@ -144,7 +145,7 @@ class ProductOfSums(AbstractControlValues):
144
145
  (cv,) if isinstance(cv, int) else tuple(sorted(set(cv))) for cv in data
145
146
  )
146
147
 
147
- @_compat.cached_property
148
+ @cached_property
148
149
  def is_trivial(self) -> bool:
149
150
  return self._qubit_sums == ((1,),) * self._num_qubits_()
150
151
 
@@ -252,7 +253,7 @@ class SumOfProducts(AbstractControlValues):
252
253
  if not all(len(p) == num_qubits for p in self._conjunctions):
253
254
  raise ValueError(f'Each term of {self._conjunctions} should be of length {num_qubits}.')
254
255
 
255
- @_compat.cached_property
256
+ @cached_property
256
257
  def is_trivial(self) -> bool:
257
258
  return self._conjunctions == ((1,) * self._num_qubits_(),)
258
259
 
@@ -14,6 +14,7 @@
14
14
  """Abstract classes for simulations which keep track of state vector."""
15
15
 
16
16
  import abc
17
+ from functools import cached_property
17
18
  from typing import Any, Dict, Iterator, Sequence, Type, TYPE_CHECKING, Generic, TypeVar
18
19
 
19
20
  import numpy as np
@@ -121,7 +122,7 @@ class StateVectorTrialResult(
121
122
  qubit_map=final_simulator_state.qubit_map,
122
123
  )
123
124
 
124
- @_compat.cached_property
125
+ @cached_property
125
126
  def final_state_vector(self) -> np.ndarray:
126
127
  return self._get_merged_sim_state().target_tensor.reshape(-1)
127
128
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.4.0.dev20240110191916
3
+ Version: 1.4.0.dev20240113000130
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
@@ -1,10 +1,10 @@
1
1
  cirq/__init__.py,sha256=GlOnPWDvat-Y203LsbXhkC0UnGm9HHiNx2ywz7Bkc3o,15708
2
- cirq/_compat.py,sha256=wXi3WIiKjfJp5mCB2Kha3LyfJzxCetEPXq5-wg_faq0,29536
3
- cirq/_compat_test.py,sha256=iQJYqIP1uyRe8mNUwi2VKccyUaJDFYH7b3Fg6cqQLQw,35053
2
+ cirq/_compat.py,sha256=ogNbww9v943-ZNZcOx-ad8kGO8-jLBuS8865gQ3QA-c,29350
3
+ 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=RbCi5ge3fWberaM1r8h6RZ8f8gGe4_jNtnAezkeLYgM,40
7
+ cirq/_version.py,sha256=vXsAbVtYnvyZcJHjTtLMCtYPagQpLir8g5ukcjQzCyI,40
8
8
  cirq/_version_test.py,sha256=yYS6xm5-nuBRQJa9R3n41WdvFtVyY7Lb5Q8bea3VgBI,133
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=S0HaPOCUIck-vNSQlS6KxnQtle6w-2dGuSxkUbJQY9Y,13168
@@ -18,10 +18,10 @@ cirq/circuits/_box_drawing_character_data_test.py,sha256=XO94z0piwZRHaNZHTf-5tKH
18
18
  cirq/circuits/_bucket_priority_queue.py,sha256=hxFuii2fKD8G6EKT_aVLEsA7FmSfqFXPwIbA0KsoSC4,6745
19
19
  cirq/circuits/_bucket_priority_queue_test.py,sha256=t6u_hG7K2e2WKWrgCsKxNRtp4ghKwiCrp0_WSY0W25k,5288
20
20
  cirq/circuits/circuit.py,sha256=KP6tYjQ4pb1kz_jW3cfCgtnVvN_MRl0jHeNsOq0CA70,114383
21
- cirq/circuits/circuit_operation.py,sha256=qdJshRvGRFKwin7Ec_RndIb2Fm3sh7-N9SarEZo6AXM,34354
21
+ cirq/circuits/circuit_operation.py,sha256=D4u8jDD4fGOca1xnZPN1obuKTIouXENUfnxOF2JrwgU,34375
22
22
  cirq/circuits/circuit_operation_test.py,sha256=_0iQJ3h_dnQcQmbGRZbc-NqdglJTXantbj72ggqLKNE,44724
23
23
  cirq/circuits/circuit_test.py,sha256=EYIApq2DpZe7HckvySR3JlJdUIfJTSbKHm0lgENP2HA,160111
24
- cirq/circuits/frozen_circuit.py,sha256=GnFZ6kT1hFpxK6sOzqy1hq2SnKbG7OSu0q3bfGwi7b8,9240
24
+ cirq/circuits/frozen_circuit.py,sha256=_0SkmIiQ4UjIug-k_iO00ulDFoFnxmAHvXX2I2HHN8k,9262
25
25
  cirq/circuits/frozen_circuit_test.py,sha256=rHyii8hLhOQ6jdA8dC1OcYPGnyeBC4uY5Q53XspkkCk,4133
26
26
  cirq/circuits/insert_strategy.py,sha256=L0OLXuo24TtBfdJGOAG2PsVDMrbvQl4iN5lUk6IPuyo,2851
27
27
  cirq/circuits/insert_strategy_test.py,sha256=dgz13_ssa_GWqzzx5W4G4sJJw4SUHC3-g3K0_Z4TRiA,686
@@ -169,7 +169,7 @@ cirq/devices/noise_properties.py,sha256=DyaaNl2VlDFX38x4J7Zu5EMJBIj8bCDUYwSjbkBf
169
169
  cirq/devices/noise_properties_test.py,sha256=JTJW8_-rI4awd9jTbCgI5l8MpeDsNlXnO53s8QgJw2A,2341
170
170
  cirq/devices/noise_utils.py,sha256=q7LR7mT__oHYoCmmPln1PnsVa94p0i9ONjqKlcka5_o,6722
171
171
  cirq/devices/noise_utils_test.py,sha256=ha_P9Z_eycH97QIQ27WmwnvGM1CBUVoaJO8oy-VnIWI,4841
172
- cirq/devices/superconducting_qubits_noise_properties.py,sha256=Fg4S23uBPIBZWKdDyJ7AAZ_ajT1Vd6n1WxJ-k-0VUlM,8125
172
+ cirq/devices/superconducting_qubits_noise_properties.py,sha256=1SMeHgfydqYL5iwD9s38yJnOtfXWdJLw069B2DDSn9s,8146
173
173
  cirq/devices/superconducting_qubits_noise_properties_test.py,sha256=u9B1_4uwRdNzeyW9f-CSbYfsNpxiJ0RtmttvaaNzXkk,12207
174
174
  cirq/devices/thermal_noise_model.py,sha256=qdWrN7Kqw5dq1rwVUBLY1DDw1nCPADSaxoLtGHC-zW4,11608
175
175
  cirq/devices/thermal_noise_model_test.py,sha256=ox9b0BoHH6d73CjWWI1fIAGd_o3r-4qy8v2ggUwc-pw,12246
@@ -267,7 +267,7 @@ cirq/ops/boolean_hamiltonian.py,sha256=hjmzBvWiZnb18JfdhId-dVxt2VmbyAbqMSFAPWV7s
267
267
  cirq/ops/boolean_hamiltonian_test.py,sha256=1ey5yfYZPKZDsfM3jpCPAOpbPs_y8i4K_WvDK2d5_4Y,8518
268
268
  cirq/ops/classically_controlled_operation.py,sha256=bMqKutwzqbvN2r7mOVOI12HTPDGSJLkhQQgfAcTtbDU,9166
269
269
  cirq/ops/classically_controlled_operation_test.py,sha256=MNU0Adff4kTosqsrQ3PUT3ARcZee_PkchT6u0xDl8Qg,48039
270
- cirq/ops/clifford_gate.py,sha256=U8kEB7hBUVDUBcKNe-wJMRe45dSiMdiz3NFytzDD_-Y,39202
270
+ cirq/ops/clifford_gate.py,sha256=xTAGYR24u__ctlY2fNsWYTQcJof4euRYMGN8cdERV2E,39235
271
271
  cirq/ops/clifford_gate_test.py,sha256=NF_if1X8LCMA9hy0vBO7lxvVPdumlvMMnI2XRQ-RLpk,37472
272
272
  cirq/ops/common_channels.py,sha256=mVGEta2wnaWOhRCXQO6gUj9Zll3rtXqpY-PRYcJ8m1U,38282
273
273
  cirq/ops/common_channels_test.py,sha256=EL_PxbqD3KPC8ioihiukhmW8bUdclqqigKoFyUQpmIM,29690
@@ -275,7 +275,7 @@ cirq/ops/common_gate_families.py,sha256=e5M8wlDYtdrpWBrhdns6iizIvSqzfxDyIsBdxt8h
275
275
  cirq/ops/common_gate_families_test.py,sha256=Oo3C7BPO3gt3ePuqwsI_lx_lY38et8Ps4AuVydX2Aww,5275
276
276
  cirq/ops/common_gates.py,sha256=YMcadPVRhrvkwYwm6-_TNYM9sz9TY7KSi0g7FvBTeCk,58075
277
277
  cirq/ops/common_gates_test.py,sha256=_5Kifb5k091qyzEVpryyFJV1e6pJ_fjDCag1PmPAQ2g,46227
278
- cirq/ops/control_values.py,sha256=O_ssaNxd50b4cS0hVhnRY0aEMr8J86TIh6iPohPKf_g,13397
278
+ cirq/ops/control_values.py,sha256=nNDN6pgz_aWkUfrpOZ9zHHD42AGFaplWhVQj9rmJwbQ,13410
279
279
  cirq/ops/control_values_test.py,sha256=iDtdQjL39u80MaR16XLp00LRZqWgJqC54cIeADWf0IY,12906
280
280
  cirq/ops/controlled_gate.py,sha256=uVTZk6pA1ZpEwbVggLeXyAFq18_QJ38hWYhk9GbvQnc,14253
281
281
  cirq/ops/controlled_gate_test.py,sha256=5sUUV0xng-GpQOTSiyQqB_LBaTeXXqHehqQuvvw7Cf4,23113
@@ -903,7 +903,7 @@ cirq/sim/sparse_simulator_test.py,sha256=3EAeCHUQeKllAAtdw14X592zBsGQY_vwfIYK-gE
903
903
  cirq/sim/state_vector.py,sha256=N6N9EELlW66UaLTBaq62ms0XkfIK7CzN9SBM7t52dXo,13428
904
904
  cirq/sim/state_vector_simulation_state.py,sha256=Ks3nGbIf6rq1Ap7Y5gZkcAJhu_Zr2-KWJhsE_wjwu8k,17624
905
905
  cirq/sim/state_vector_simulation_state_test.py,sha256=UtGMIurlV6N74nX7qoVnGoRhwF35-ghDEIP7Mj5AXmI,9841
906
- cirq/sim/state_vector_simulator.py,sha256=L2S0xyUGqRcVgYdzYef0gVREVZVIDcCXPclVbIJEpPE,7529
906
+ cirq/sim/state_vector_simulator.py,sha256=Q-wCmJdLIoJAssTvrZmGCpnooFHjZNXr_yeyy5R0NFs,7559
907
907
  cirq/sim/state_vector_simulator_test.py,sha256=wJq1OZRzKokeM9cJyaJXi6wHH2qi97h0HmJlYOEBDzU,7864
908
908
  cirq/sim/state_vector_test.py,sha256=OjhAL2tWqJWstHV8RvJYQVqg95zm0PcS9nQKrLOhMmQ,16934
909
909
  cirq/sim/clifford/__init__.py,sha256=lD7l6JuE5n0xwvOYNYH-giCH3qAEVH1SUwDrZM1jKKY,636
@@ -1148,8 +1148,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
1148
1148
  cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
1149
1149
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1150
1150
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1151
- cirq_core-1.4.0.dev20240110191916.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1152
- cirq_core-1.4.0.dev20240110191916.dist-info/METADATA,sha256=9hQABd9ZUma5pkIP9FJxmxoNDfzlKEdsN0bzHvzsCe8,2075
1153
- cirq_core-1.4.0.dev20240110191916.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
1154
- cirq_core-1.4.0.dev20240110191916.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1155
- cirq_core-1.4.0.dev20240110191916.dist-info/RECORD,,
1151
+ cirq_core-1.4.0.dev20240113000130.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1152
+ cirq_core-1.4.0.dev20240113000130.dist-info/METADATA,sha256=e-d-wRg7tZgPDVECmkSN2V3BT5GR7eFqmmXvxe1pYt4,2075
1153
+ cirq_core-1.4.0.dev20240113000130.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
1154
+ cirq_core-1.4.0.dev20240113000130.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1155
+ cirq_core-1.4.0.dev20240113000130.dist-info/RECORD,,