cirq-core 1.6.0.dev20250613142538__py3-none-any.whl → 1.6.0.dev20250614001105__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/__init__.py +8 -17
- cirq/_compat_test.py +2 -6
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/circuits/circuit_operation_test.py +1 -1
- cirq/circuits/moment.py +0 -1
- cirq/contrib/acquaintance/bipartite_test.py +1 -1
- cirq/contrib/acquaintance/executor_test.py +1 -1
- cirq/contrib/acquaintance/shift.py +1 -1
- cirq/contrib/graph_device/graph_device.py +2 -2
- cirq/contrib/paulistring/clifford_target_gateset.py +1 -1
- cirq/contrib/qcircuit/qcircuit_test.py +2 -2
- cirq/contrib/routing/swap_network_test.py +1 -1
- cirq/experiments/__init__.py +1 -2
- cirq/interop/quirk/url_to_circuit_test.py +1 -1
- cirq/json_resolver_cache.py +1 -3
- cirq/linalg/__init__.py +4 -6
- cirq/ops/classically_controlled_operation_test.py +4 -12
- cirq/ops/clifford_gate_test.py +0 -1
- cirq/ops/fsim_gate_test.py +1 -3
- cirq/ops/pauli_gates_test.py +0 -2
- cirq/ops/pauli_string_test.py +1 -5
- cirq/ops/raw_types_test.py +2 -5
- cirq/ops/state_preparation_channel_test.py +1 -2
- cirq/protocols/__init__.py +0 -3
- cirq/protocols/measurement_key_protocol_test.py +0 -1
- cirq/protocols/pow_protocol.py +2 -4
- cirq/qis/clifford_tableau_test.py +0 -2
- cirq/testing/__init__.py +7 -11
- cirq/testing/circuit_compare.py +0 -12
- cirq/testing/consistent_act_on.py +0 -2
- cirq/testing/consistent_decomposition.py +0 -2
- cirq/testing/consistent_protocols.py +1 -7
- cirq/testing/consistent_specified_has_unitary.py +0 -2
- cirq/testing/equivalent_repr_eval.py +1 -1
- cirq/testing/lin_alg_utils.py +0 -2
- cirq/transformers/__init__.py +3 -4
- cirq/transformers/analytical_decompositions/__init__.py +3 -6
- cirq/transformers/dynamical_decoupling_test.py +2 -4
- cirq/transformers/merge_k_qubit_gates_test.py +4 -3
- cirq/transformers/optimize_for_target_gateset_test.py +2 -3
- cirq/transformers/transformer_primitives_test.py +5 -14
- cirq/value/linear_dict_test.py +5 -7
- cirq/value/measurement_key_test.py +0 -1
- cirq/value/timestamp_test.py +2 -3
- cirq/value/value_equality_attr.py +1 -1
- {cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/RECORD +51 -51
- {cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/top_level.txt +0 -0
cirq/testing/circuit_compare.py
CHANGED
|
@@ -117,9 +117,7 @@ def assert_circuits_with_terminal_measurements_are_equivalent(
|
|
|
117
117
|
reference: A circuit with the correct function.
|
|
118
118
|
atol: Absolute error tolerance.
|
|
119
119
|
"""
|
|
120
|
-
# pylint: disable=unused-variable
|
|
121
120
|
__tracebackhide__ = True
|
|
122
|
-
# pylint: enable=unused-variable
|
|
123
121
|
|
|
124
122
|
measured_qubits_actual = {
|
|
125
123
|
qubit
|
|
@@ -267,9 +265,7 @@ def assert_has_diagram(
|
|
|
267
265
|
beginning and whitespace at the end are ignored.
|
|
268
266
|
**kwargs: Keyword arguments to be passed to actual.to_text_diagram().
|
|
269
267
|
"""
|
|
270
|
-
# pylint: disable=unused-variable
|
|
271
268
|
__tracebackhide__ = True
|
|
272
|
-
# pylint: enable=unused-variable
|
|
273
269
|
actual_diagram = actual.to_text_diagram(**kwargs).lstrip("\n").rstrip()
|
|
274
270
|
desired_diagram = desired.lstrip("\n").rstrip()
|
|
275
271
|
|
|
@@ -297,9 +293,7 @@ def assert_has_consistent_apply_unitary(val: Any, *, atol: float = 1e-8) -> None
|
|
|
297
293
|
val: The value under test. Should have a `__pow__` method.
|
|
298
294
|
atol: Absolute error tolerance.
|
|
299
295
|
"""
|
|
300
|
-
# pylint: disable=unused-variable
|
|
301
296
|
__tracebackhide__ = True
|
|
302
|
-
# pylint: enable=unused-variable
|
|
303
297
|
|
|
304
298
|
_assert_apply_unitary_works_when_axes_transposed(val, atol=atol)
|
|
305
299
|
|
|
@@ -341,9 +335,7 @@ def assert_has_consistent_apply_channel(val: Any, *, atol: float = 1e-8) -> None
|
|
|
341
335
|
val: The value under test. Should have a `__pow__` method.
|
|
342
336
|
atol: Absolute error tolerance.
|
|
343
337
|
"""
|
|
344
|
-
# pylint: disable=unused-variable
|
|
345
338
|
__tracebackhide__ = True
|
|
346
|
-
# pylint: enable=unused-variable
|
|
347
339
|
|
|
348
340
|
kraus = protocols.kraus(val, default=None)
|
|
349
341
|
expected = qis.kraus_to_superoperator(kraus) if kraus is not None else None
|
|
@@ -463,9 +455,7 @@ def assert_has_consistent_apply_unitary_for_various_exponents(
|
|
|
463
455
|
the value's `__pow__` returns `NotImplemented` for any of these,
|
|
464
456
|
they are skipped.
|
|
465
457
|
"""
|
|
466
|
-
# pylint: disable=unused-variable
|
|
467
458
|
__tracebackhide__ = True
|
|
468
|
-
# pylint: enable=unused-variable
|
|
469
459
|
|
|
470
460
|
for exponent in exponents:
|
|
471
461
|
gate = protocols.pow(val, exponent, default=None)
|
|
@@ -485,9 +475,7 @@ def assert_has_consistent_qid_shape(val: Any) -> None:
|
|
|
485
475
|
val: The value under test. Should have `_qid_shape_` and/or
|
|
486
476
|
`num_qubits_` methods. Can optionally have a `qubits` property.
|
|
487
477
|
"""
|
|
488
|
-
# pylint: disable=unused-variable
|
|
489
478
|
__tracebackhide__ = True
|
|
490
|
-
# pylint: enable=unused-variable
|
|
491
479
|
default = (-1,)
|
|
492
480
|
qid_shape = protocols.qid_shape(val, default)
|
|
493
481
|
num_qubits = protocols.num_qubits(val, default)
|
|
@@ -85,9 +85,7 @@ def assert_all_implemented_act_on_effects_match_unitary(
|
|
|
85
85
|
val and StabilizerChFormSimulationState inputs.
|
|
86
86
|
"""
|
|
87
87
|
|
|
88
|
-
# pylint: disable=unused-variable
|
|
89
88
|
__tracebackhide__ = True
|
|
90
|
-
# pylint: enable=unused-variable
|
|
91
89
|
|
|
92
90
|
num_qubits_val = protocols.num_qubits(val)
|
|
93
91
|
|
|
@@ -24,9 +24,7 @@ from cirq.testing import lin_alg_utils
|
|
|
24
24
|
|
|
25
25
|
def assert_decompose_is_consistent_with_unitary(val: Any, ignoring_global_phase: bool = False):
|
|
26
26
|
"""Uses `val._unitary_` to check `val._phase_by_`'s behavior."""
|
|
27
|
-
# pylint: disable=unused-variable
|
|
28
27
|
__tracebackhide__ = True
|
|
29
|
-
# pylint: enable=unused-variable
|
|
30
28
|
|
|
31
29
|
expected = protocols.unitary(val, None)
|
|
32
30
|
if expected is None:
|
|
@@ -96,9 +96,7 @@ def assert_eigengate_implements_consistent_protocols(
|
|
|
96
96
|
) -> None:
|
|
97
97
|
"""Checks that an EigenGate subclass is internally consistent and has a
|
|
98
98
|
good __repr__."""
|
|
99
|
-
# pylint: disable=unused-variable
|
|
100
99
|
__tracebackhide__ = True
|
|
101
|
-
# pylint: enable=unused-variable
|
|
102
100
|
|
|
103
101
|
for exponent in exponents:
|
|
104
102
|
for shift in global_shifts:
|
|
@@ -113,9 +111,7 @@ def assert_eigengate_implements_consistent_protocols(
|
|
|
113
111
|
|
|
114
112
|
|
|
115
113
|
def assert_eigen_shifts_is_consistent_with_eigen_components(val: ops.EigenGate) -> None:
|
|
116
|
-
# pylint: disable=unused-variable
|
|
117
114
|
__tracebackhide__ = True
|
|
118
|
-
# pylint: enable=unused-variable
|
|
119
115
|
if not protocols.is_parameterized(val):
|
|
120
116
|
assert val._eigen_shifts() == [
|
|
121
117
|
e[0] for e in val._eigen_components()
|
|
@@ -123,9 +119,7 @@ def assert_eigen_shifts_is_consistent_with_eigen_components(val: ops.EigenGate)
|
|
|
123
119
|
|
|
124
120
|
|
|
125
121
|
def assert_has_consistent_trace_distance_bound(val: Any) -> None:
|
|
126
|
-
# pylint: disable=unused-variable
|
|
127
122
|
__tracebackhide__ = True
|
|
128
|
-
# pylint: enable=unused-variable
|
|
129
123
|
u = protocols.unitary(val, default=None)
|
|
130
124
|
val_from_trace = protocols.trace_distance_bound(val)
|
|
131
125
|
assert 0.0 <= val_from_trace <= 1.0
|
|
@@ -149,7 +143,7 @@ def _assert_meets_standards_helper(
|
|
|
149
143
|
local_vals: dict[str, Any] | None,
|
|
150
144
|
ignore_decompose_to_default_gateset: bool,
|
|
151
145
|
) -> None:
|
|
152
|
-
__tracebackhide__ = True
|
|
146
|
+
__tracebackhide__ = True
|
|
153
147
|
|
|
154
148
|
assert_consistent_resolve_parameters(val)
|
|
155
149
|
assert_specifies_has_unitary_if_unitary(val)
|
|
@@ -22,9 +22,7 @@ from cirq import protocols
|
|
|
22
22
|
def assert_specifies_has_unitary_if_unitary(val: Any) -> None:
|
|
23
23
|
"""Checks that unitary values can be cheaply identifies as unitary."""
|
|
24
24
|
|
|
25
|
-
# pylint: disable=unused-variable
|
|
26
25
|
__tracebackhide__ = True
|
|
27
|
-
# pylint: enable=unused-variable
|
|
28
26
|
|
|
29
27
|
assert not protocols.has_unitary(val) or hasattr(val, '_has_unitary_'), (
|
|
30
28
|
"Value is unitary but doesn't specify a _has_unitary_ method that "
|
|
@@ -41,7 +41,7 @@ def assert_equivalent_repr(
|
|
|
41
41
|
Raises:
|
|
42
42
|
AssertionError: If the assertion fails, or eval(repr(value)) raises an error.
|
|
43
43
|
"""
|
|
44
|
-
__tracebackhide__ = True
|
|
44
|
+
__tracebackhide__ = True
|
|
45
45
|
|
|
46
46
|
global_vals = global_vals or {}
|
|
47
47
|
local_vals = local_vals or {}
|
cirq/testing/lin_alg_utils.py
CHANGED
|
@@ -186,9 +186,7 @@ def assert_allclose_up_to_global_phase(
|
|
|
186
186
|
Raises:
|
|
187
187
|
AssertionError: The matrices aren't nearly equal up to global phase.
|
|
188
188
|
"""
|
|
189
|
-
# pylint: disable=unused-variable
|
|
190
189
|
__tracebackhide__ = True
|
|
191
|
-
# pylint: enable=unused-variable
|
|
192
190
|
|
|
193
191
|
actual, desired = linalg.match_global_phase(actual, desired)
|
|
194
192
|
np.testing.assert_allclose(
|
cirq/transformers/__init__.py
CHANGED
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"""Classes and methods for transforming circuits."""
|
|
16
16
|
|
|
17
17
|
from cirq.transformers.analytical_decompositions import (
|
|
18
|
-
#
|
|
19
|
-
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition,
|
|
18
|
+
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition, # noqa: E501
|
|
20
19
|
decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim,
|
|
21
20
|
decompose_clifford_tableau_to_operations as decompose_clifford_tableau_to_operations,
|
|
22
21
|
decompose_multi_controlled_x as decompose_multi_controlled_x,
|
|
23
22
|
decompose_multi_controlled_rotation as decompose_multi_controlled_rotation,
|
|
24
|
-
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates,
|
|
23
|
+
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates, # noqa: E501
|
|
25
24
|
is_negligible_turn as is_negligible_turn,
|
|
26
25
|
parameterized_2q_op_to_sqrt_iswap_operations as parameterized_2q_op_to_sqrt_iswap_operations,
|
|
27
26
|
prepare_two_qubit_state_using_cz as prepare_two_qubit_state_using_cz,
|
|
@@ -36,7 +35,7 @@ from cirq.transformers.analytical_decompositions import (
|
|
|
36
35
|
three_qubit_matrix_to_operations as three_qubit_matrix_to_operations,
|
|
37
36
|
two_qubit_matrix_to_cz_isometry as two_qubit_matrix_to_cz_isometry,
|
|
38
37
|
two_qubit_matrix_to_cz_operations as two_qubit_matrix_to_cz_operations,
|
|
39
|
-
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations,
|
|
38
|
+
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations, # noqa: E501
|
|
40
39
|
two_qubit_matrix_to_ion_operations as two_qubit_matrix_to_ion_operations,
|
|
41
40
|
two_qubit_matrix_to_sqrt_iswap_operations as two_qubit_matrix_to_sqrt_iswap_operations,
|
|
42
41
|
unitary_to_pauli_string as unitary_to_pauli_string,
|
|
@@ -24,8 +24,7 @@ from cirq.transformers.analytical_decompositions.controlled_gate_decomposition i
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
from cirq.transformers.analytical_decompositions.cphase_to_fsim import (
|
|
27
|
-
#
|
|
28
|
-
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition,
|
|
27
|
+
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition, # noqa: E501
|
|
29
28
|
decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim,
|
|
30
29
|
)
|
|
31
30
|
|
|
@@ -47,14 +46,12 @@ from cirq.transformers.analytical_decompositions.three_qubit_decomposition impor
|
|
|
47
46
|
)
|
|
48
47
|
|
|
49
48
|
from cirq.transformers.analytical_decompositions.two_qubit_to_cz import (
|
|
50
|
-
# pylint: disable=line-too-long
|
|
51
49
|
two_qubit_matrix_to_cz_operations as two_qubit_matrix_to_cz_operations,
|
|
52
|
-
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations,
|
|
50
|
+
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations, # noqa: E501
|
|
53
51
|
)
|
|
54
52
|
|
|
55
53
|
from cirq.transformers.analytical_decompositions.two_qubit_to_fsim import (
|
|
56
|
-
#
|
|
57
|
-
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates,
|
|
54
|
+
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates, # noqa: E501
|
|
58
55
|
)
|
|
59
56
|
|
|
60
57
|
from cirq.transformers.analytical_decompositions.two_qubit_to_ms import (
|
|
@@ -698,7 +698,6 @@ def test_with_non_clifford_measurements():
|
|
|
698
698
|
|
|
699
699
|
|
|
700
700
|
def test_cross_clifford_pieces_filling_merge():
|
|
701
|
-
# pylint: disable=line-too-long
|
|
702
701
|
"""Test case diagrams.
|
|
703
702
|
Input:
|
|
704
703
|
0: ─────────────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───@─────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───@───PhXZ(a=0.2,x=0.2,z=0.1)───H───
|
|
@@ -729,8 +728,7 @@ def test_cross_clifford_pieces_filling_merge():
|
|
|
729
728
|
5: ───PhXZ(a=0.2,x=0.2,z=0.1)───@───PhXZ(a=0.2,x=0.2,z=0.1)───@─────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───@───PhXZ(a=-0.8,x=0.2,z=-0.9)───H────────────────────────
|
|
730
729
|
│
|
|
731
730
|
6: ───────────────────────────────────────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───X─────────────────────────@───PhXZ(a=0.8,x=0.8,z=0.5)─────H────────────────────────
|
|
732
|
-
"""
|
|
733
|
-
# pylint: enable=line-too-long
|
|
731
|
+
""" # noqa: E501
|
|
734
732
|
qubits = cirq.LineQubit.range(7)
|
|
735
733
|
phased_xz_gate = cirq.PhasedXZGate(axis_phase_exponent=0.2, x_exponent=0.2, z_exponent=0.1)
|
|
736
734
|
assert_dd(
|
|
@@ -761,7 +759,7 @@ def test_cross_clifford_pieces_filling_merge():
|
|
|
761
759
|
5: ───PhXZ(a=0.2,x=0.2,z=0.1)───@───PhXZ(a=0.2,x=0.2,z=0.1)───@─────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───@───PhXZ(a=-0.8,x=0.2,z=-0.9)───H────────────────────────
|
|
762
760
|
│
|
|
763
761
|
6: ───────────────────────────────────────────────────────────PhXZ(a=0.2,x=0.2,z=0.1)───X─────────────────────────@───PhXZ(a=0.8,x=0.8,z=0.5)─────H────────────────────────
|
|
764
|
-
""",
|
|
762
|
+
""", # noqa: E501
|
|
765
763
|
)
|
|
766
764
|
|
|
767
765
|
|
|
@@ -100,7 +100,6 @@ def test_merge_k_qubit_unitaries_raises() -> None:
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
def test_merge_complex_circuit_preserving_moment_structure() -> None:
|
|
103
|
-
# pylint: disable=line-too-long
|
|
104
103
|
q = cirq.LineQubit.range(3)
|
|
105
104
|
c_orig = cirq.Circuit(
|
|
106
105
|
cirq.Moment(cirq.H.on_each(*q)),
|
|
@@ -154,7 +153,8 @@ a: ═════════════════════════
|
|
|
154
153
|
│ │ ║
|
|
155
154
|
2: ───#2──────────────────────────────────────────────────────────────────X───────────[ 2: ───Z─── ][3]───M───────────────────────╫───
|
|
156
155
|
║ ║
|
|
157
|
-
a: ═══════════════════════════════════════════════════════════════════════════════════════════════════════@═══════════════════════^═══
|
|
156
|
+
a: ═══════════════════════════════════════════════════════════════════════════════════════════════════════@═══════════════════════^═══
|
|
157
|
+
''', # noqa: E501
|
|
158
158
|
)
|
|
159
159
|
|
|
160
160
|
component_id = 0
|
|
@@ -184,7 +184,8 @@ a: ═════════════════════════
|
|
|
184
184
|
│ │ ║
|
|
185
185
|
2: ───T[1]───iSwap^0.5───T[1]─────────────────────────────X───────────T[3]────────M─────────────────────────╫───
|
|
186
186
|
║ ║
|
|
187
|
-
a: ═══════════════════════════════════════════════════════════════════════════════@═════════════════════════^═══
|
|
187
|
+
a: ═══════════════════════════════════════════════════════════════════════════════@═════════════════════════^═══
|
|
188
|
+
''', # noqa: E501
|
|
188
189
|
)
|
|
189
190
|
|
|
190
191
|
|
|
@@ -41,7 +41,6 @@ def test_decompose_operations_raises_on_stuck():
|
|
|
41
41
|
cirq.testing.assert_same_circuits(c_orig, c_new)
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
# pylint: disable=line-too-long
|
|
45
44
|
def test_decompose_operations_to_target_gateset_default():
|
|
46
45
|
q = cirq.LineQubit.range(2)
|
|
47
46
|
c_orig = cirq.Circuit(
|
|
@@ -74,7 +73,7 @@ m: ═════════════════════════
|
|
|
74
73
|
1: ───────Y^-0.5───@───Y^0.5────@───Y^-0.5───@───Y^0.5───────×───────────╫───X───T───Y^-0.5───@───Y^0.5────@───Y^-0.5───@───Y^0.5───T───
|
|
75
74
|
║ ║
|
|
76
75
|
m: ══════════════════════════════════════════════════════════════════════@═══^══════════════════════════════════════════════════════════
|
|
77
|
-
''',
|
|
76
|
+
''', # noqa: E501
|
|
78
77
|
)
|
|
79
78
|
|
|
80
79
|
|
|
@@ -192,7 +191,7 @@ m: ═════════════════════@═══^═
|
|
|
192
191
|
║ ║
|
|
193
192
|
m: ═══════════════════════════════════════════════════════════════@═══^═════════════════════════════════════════════════════════
|
|
194
193
|
└────────┘ └────────┘ └────────┘
|
|
195
|
-
''',
|
|
194
|
+
''', # noqa: E501
|
|
196
195
|
)
|
|
197
196
|
|
|
198
197
|
with pytest.raises(ValueError, match="Unable to convert"):
|
|
@@ -116,7 +116,6 @@ def test_map_operations_does_not_insert_too_many_moments():
|
|
|
116
116
|
)
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
# pylint: disable=line-too-long
|
|
120
119
|
def test_map_operations_deep_subcircuits():
|
|
121
120
|
q = cirq.LineQubit.range(5)
|
|
122
121
|
c_orig = cirq.Circuit(cirq.CX(q[0], q[1]), cirq.CX(q[3], q[2]), cirq.CX(q[3], q[4]))
|
|
@@ -166,7 +165,7 @@ def test_map_operations_deep_subcircuits():
|
|
|
166
165
|
3: ───#4──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
167
166
|
│
|
|
168
167
|
4: ───#5──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
169
|
-
''',
|
|
168
|
+
''', # noqa: E501
|
|
170
169
|
)
|
|
171
170
|
|
|
172
171
|
c_mapped = cirq.map_operations(c_orig_with_circuit_ops, map_func, deep=True)
|
|
@@ -201,13 +200,10 @@ def test_map_operations_deep_subcircuits():
|
|
|
201
200
|
3: ───#4──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
202
201
|
│
|
|
203
202
|
4: ───#5──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
204
|
-
''',
|
|
203
|
+
''', # noqa: E501
|
|
205
204
|
)
|
|
206
205
|
|
|
207
206
|
|
|
208
|
-
# pylint: enable=line-too-long
|
|
209
|
-
|
|
210
|
-
|
|
211
207
|
@pytest.mark.parametrize("deep", [False, True])
|
|
212
208
|
def test_map_operations_preserves_circuit_tags(deep: bool) -> None:
|
|
213
209
|
tag = "should be preserved"
|
|
@@ -707,9 +703,6 @@ def test_merge_operations_deep():
|
|
|
707
703
|
)
|
|
708
704
|
|
|
709
705
|
|
|
710
|
-
# pylint: disable=line-too-long
|
|
711
|
-
|
|
712
|
-
|
|
713
706
|
def test_merge_operations_to_circuit_op_merges_connected_component():
|
|
714
707
|
c_orig = _create_circuit_to_merge()
|
|
715
708
|
cirq.testing.assert_has_diagram(
|
|
@@ -740,7 +733,7 @@ def test_merge_operations_to_circuit_op_merges_connected_component():
|
|
|
740
733
|
1: ───────┼───────────#2───────────────────────────────────────────────────────────@───────Y───────────X───
|
|
741
734
|
│ │
|
|
742
735
|
2: ───H───X────────────────────────────────────────────────────────────────────────X───────────────────────
|
|
743
|
-
''',
|
|
736
|
+
''', # noqa: E501
|
|
744
737
|
)
|
|
745
738
|
|
|
746
739
|
|
|
@@ -772,13 +765,11 @@ def test_merge_2q_unitaries_to_circuit_op():
|
|
|
772
765
|
1: ───┼────────────────────────────#2───────────────────────────────────────────────[ │ ]───────────────────────X───
|
|
773
766
|
│ [ 2: ───X─────── ][merged]
|
|
774
767
|
│ │
|
|
775
|
-
2: ───#2────────────────────────────────────────────────────────────────────────────#2───────────────────────────────────────M───
|
|
768
|
+
2: ───#2────────────────────────────────────────────────────────────────────────────#2───────────────────────────────────────M───
|
|
769
|
+
''', # noqa: E501
|
|
776
770
|
)
|
|
777
771
|
|
|
778
772
|
|
|
779
|
-
# pylint: enable=line-too-long
|
|
780
|
-
|
|
781
|
-
|
|
782
773
|
def test_merge_operations_respects_tags_to_ignore():
|
|
783
774
|
q = cirq.LineQubit.range(2)
|
|
784
775
|
c = cirq.Circuit(
|
cirq/value/linear_dict_test.py
CHANGED
|
@@ -410,7 +410,7 @@ def test_scalar_division(scalar, terms, terms_expected):
|
|
|
410
410
|
)
|
|
411
411
|
def test_expressions(expression, expected):
|
|
412
412
|
assert expression == expected
|
|
413
|
-
assert not expression != expected
|
|
413
|
+
assert not expression != expected # noqa: SIM202
|
|
414
414
|
assert cirq.approx_eq(expression, expected)
|
|
415
415
|
|
|
416
416
|
|
|
@@ -433,13 +433,12 @@ def test_bool(terms, bool_value):
|
|
|
433
433
|
),
|
|
434
434
|
)
|
|
435
435
|
def test_equal(terms_1, terms_2):
|
|
436
|
-
# pylint: disable=unnecessary-negation
|
|
437
436
|
linear_dict_1 = cirq.LinearDict(terms_1)
|
|
438
437
|
linear_dict_2 = cirq.LinearDict(terms_2)
|
|
439
438
|
assert linear_dict_1 == linear_dict_2
|
|
440
439
|
assert linear_dict_2 == linear_dict_1
|
|
441
|
-
assert not linear_dict_1 != linear_dict_2
|
|
442
|
-
assert not linear_dict_2 != linear_dict_1
|
|
440
|
+
assert not linear_dict_1 != linear_dict_2 # noqa: SIM202
|
|
441
|
+
assert not linear_dict_2 != linear_dict_1 # noqa: SIM202
|
|
443
442
|
|
|
444
443
|
|
|
445
444
|
@pytest.mark.parametrize(
|
|
@@ -453,13 +452,12 @@ def test_equal(terms_1, terms_2):
|
|
|
453
452
|
),
|
|
454
453
|
)
|
|
455
454
|
def test_unequal(terms_1, terms_2):
|
|
456
|
-
# pylint: disable=unnecessary-negation
|
|
457
455
|
linear_dict_1 = cirq.LinearDict(terms_1)
|
|
458
456
|
linear_dict_2 = cirq.LinearDict(terms_2)
|
|
459
457
|
assert linear_dict_1 != linear_dict_2
|
|
460
458
|
assert linear_dict_2 != linear_dict_1
|
|
461
|
-
assert not linear_dict_1 == linear_dict_2
|
|
462
|
-
assert not linear_dict_2 == linear_dict_1
|
|
459
|
+
assert not linear_dict_1 == linear_dict_2 # noqa: SIM201
|
|
460
|
+
assert not linear_dict_2 == linear_dict_1 # noqa: SIM201
|
|
463
461
|
|
|
464
462
|
|
|
465
463
|
@pytest.mark.parametrize(
|
|
@@ -103,7 +103,6 @@ def test_with_measurement_key_mapping():
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
def test_compare():
|
|
106
|
-
# pylint: disable=unnecessary-negation
|
|
107
106
|
assert cirq.MeasurementKey('a') < cirq.MeasurementKey('b')
|
|
108
107
|
assert cirq.MeasurementKey('a') <= cirq.MeasurementKey('b')
|
|
109
108
|
assert cirq.MeasurementKey('a') <= cirq.MeasurementKey('a')
|
cirq/value/timestamp_test.py
CHANGED
|
@@ -77,10 +77,9 @@ def test_cmp() -> None:
|
|
|
77
77
|
assert (i >= j) == (a >= b)
|
|
78
78
|
assert (i > j) == (a > b)
|
|
79
79
|
|
|
80
|
-
#
|
|
81
|
-
assert not (Timestamp() == 0)
|
|
80
|
+
assert not (Timestamp() == 0) # noqa: SIM201
|
|
82
81
|
assert Timestamp() != 0
|
|
83
|
-
assert not (Timestamp() == Duration())
|
|
82
|
+
assert not (Timestamp() == Duration()) # noqa: SIM201
|
|
84
83
|
assert Timestamp() != Duration()
|
|
85
84
|
|
|
86
85
|
|
|
@@ -86,7 +86,7 @@ def _value_equality_eq(self: _SupportsValueEquality, other: _SupportsValueEquali
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
def _value_equality_ne(self: _SupportsValueEquality, other: _SupportsValueEquality) -> bool:
|
|
89
|
-
return not self == other
|
|
89
|
+
return not self == other # noqa: SIM201
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
def _value_equality_hash(self: _SupportsValueEquality) -> int:
|
{cirq_core-1.6.0.dev20250613142538.dist-info → cirq_core-1.6.0.dev20250614001105.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.6.0.
|
|
3
|
+
Version: 1.6.0.dev20250614001105
|
|
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
|