Skip to content

Commit ebd2d6d

Browse files
Remove Result deprecations (#5627)
1 parent aa89bf9 commit ebd2d6d

File tree

2 files changed

+1
-47
lines changed

2 files changed

+1
-47
lines changed

cirq-core/cirq/study/result.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import pandas as pd
3636

3737
from cirq import value, ops
38-
from cirq._compat import deprecated, proper_repr, _warn_or_error
38+
from cirq._compat import proper_repr
3939
from cirq.study import resolver
4040

4141
if TYPE_CHECKING:
@@ -85,15 +85,6 @@ def _key_to_str(key: TMeasurementKey) -> str:
8585
class Result(abc.ABC):
8686
"""The results of multiple executions of a circuit with fixed parameters."""
8787

88-
def __new__(cls, *args, **kwargs):
89-
if cls is Result:
90-
_warn_or_error(
91-
"Result constructor is deprecated and will be removed in cirq v0.15. "
92-
"Use the ResultDict constructor instead, or another concrete subclass."
93-
)
94-
return ResultDict(*args, **kwargs)
95-
return super().__new__(cls)
96-
9788
@property
9889
@abc.abstractmethod
9990
def params(self) -> 'cirq.ParamResolver':
@@ -153,29 +144,6 @@ def dataframe_from_measurements(measurements: Mapping[str, np.ndarray]) -> pd.Da
153144
dtype = object if any(bs.shape[1] > 63 for _, bs in measurements.items()) else np.int64
154145
return pd.DataFrame(converted_dict, dtype=dtype)
155146

156-
@staticmethod
157-
@deprecated(
158-
deadline="v0.15",
159-
fix="The static method from_single_parameter_set is deprecated. "
160-
"Use the ResultDict constructor instead.",
161-
)
162-
def from_single_parameter_set(
163-
*, # Forces keyword args.
164-
params: resolver.ParamResolver,
165-
measurements: Mapping[str, np.ndarray],
166-
) -> 'cirq.Result':
167-
"""Packages runs of a single parameterized circuit into a Result.
168-
169-
Args:
170-
params: A ParamResolver of settings used for this result.
171-
measurements: A dictionary from measurement gate key to measurement
172-
results. The value for each key is a 2-D array of booleans,
173-
with the first index running over the repetitions, and the
174-
second index running over the qubits for the corresponding
175-
measurements.
176-
"""
177-
return ResultDict(params=params, measurements=measurements)
178-
179147
@property
180148
def repetitions(self) -> int:
181149
if not self.records:

cirq-core/cirq/study/result_test.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ def test_repr():
6666
cirq.testing.assert_equivalent_repr(v)
6767

6868

69-
def test_result_constructor_deprecation():
70-
with cirq.testing.assert_deprecated("Use the ResultDict constructor", deadline="v0.15"):
71-
result = cirq.Result(params=cirq.ParamResolver({}), measurements={})
72-
assert result.repetitions == 0
73-
74-
75-
def test_from_single_parameter_set_deprecation():
76-
with cirq.testing.assert_deprecated("Use the ResultDict constructor", deadline="v0.15"):
77-
result = cirq.Result.from_single_parameter_set(
78-
params=cirq.ParamResolver({}), measurements={}
79-
)
80-
assert result.repetitions == 0
81-
82-
8369
def test_construct_from_measurements():
8470
r = cirq.ResultDict(
8571
params=None,

0 commit comments

Comments
 (0)