cirq-core 1.5.0.dev20250327205617__py3-none-any.whl → 1.5.0.dev20250327210023__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.

Files changed (415) hide show
  1. cirq/_compat_test.py +11 -9
  2. cirq/_import.py +6 -7
  3. cirq/_version.py +1 -1
  4. cirq/_version_test.py +1 -1
  5. cirq/circuits/_block_diagram_drawer.py +1 -2
  6. cirq/circuits/_block_diagram_drawer_test.py +3 -3
  7. cirq/circuits/_box_drawing_character_data.py +0 -1
  8. cirq/circuits/_box_drawing_character_data_test.py +2 -2
  9. cirq/circuits/_bucket_priority_queue.py +0 -1
  10. cirq/circuits/_bucket_priority_queue_test.py +1 -1
  11. cirq/circuits/circuit.py +1 -1
  12. cirq/circuits/circuit_operation.py +1 -1
  13. cirq/circuits/circuit_test.py +2 -3
  14. cirq/circuits/frozen_circuit.py +1 -1
  15. cirq/circuits/moment.py +4 -5
  16. cirq/circuits/optimization_pass.py +1 -1
  17. cirq/circuits/optimization_pass_test.py +3 -2
  18. cirq/circuits/qasm_output.py +3 -3
  19. cirq/circuits/qasm_output_test.py +2 -1
  20. cirq/circuits/text_diagram_drawer.py +3 -3
  21. cirq/circuits/text_diagram_drawer_test.py +5 -4
  22. cirq/contrib/acquaintance/bipartite.py +1 -2
  23. cirq/contrib/acquaintance/bipartite_test.py +0 -1
  24. cirq/contrib/acquaintance/devices.py +3 -4
  25. cirq/contrib/acquaintance/devices_test.py +0 -1
  26. cirq/contrib/acquaintance/executor.py +4 -6
  27. cirq/contrib/acquaintance/executor_test.py +2 -2
  28. cirq/contrib/acquaintance/gates.py +2 -3
  29. cirq/contrib/acquaintance/gates_test.py +1 -1
  30. cirq/contrib/acquaintance/inspection_utils.py +1 -2
  31. cirq/contrib/acquaintance/inspection_utils_test.py +1 -1
  32. cirq/contrib/acquaintance/mutation_utils.py +2 -4
  33. cirq/contrib/acquaintance/optimizers.py +2 -3
  34. cirq/contrib/acquaintance/optimizers_test.py +1 -1
  35. cirq/contrib/acquaintance/permutation.py +1 -1
  36. cirq/contrib/acquaintance/permutation_test.py +1 -1
  37. cirq/contrib/acquaintance/shift.py +1 -1
  38. cirq/contrib/acquaintance/strategies/complete.py +0 -1
  39. cirq/contrib/acquaintance/strategies/cubic.py +1 -1
  40. cirq/contrib/circuitdag/circuit_dag.py +2 -2
  41. cirq/contrib/circuitdag/circuit_dag_test.py +1 -1
  42. cirq/contrib/graph_device/graph_device.py +1 -3
  43. cirq/contrib/graph_device/graph_device_test.py +0 -1
  44. cirq/contrib/graph_device/hypergraph_test.py +1 -0
  45. cirq/contrib/json_test.py +2 -2
  46. cirq/contrib/noise_models/noise_models.py +1 -1
  47. cirq/contrib/paulistring/clifford_optimize.py +1 -1
  48. cirq/contrib/paulistring/clifford_optimize_test.py +0 -1
  49. cirq/contrib/paulistring/clifford_target_gateset.py +3 -3
  50. cirq/contrib/paulistring/optimize.py +2 -2
  51. cirq/contrib/paulistring/optimize_test.py +0 -1
  52. cirq/contrib/paulistring/pauli_string_dag_test.py +0 -1
  53. cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation.py +3 -3
  54. cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation_test.py +3 -4
  55. cirq/contrib/paulistring/pauli_string_optimize_test.py +1 -2
  56. cirq/contrib/paulistring/recombine.py +2 -2
  57. cirq/contrib/paulistring/recombine_test.py +1 -1
  58. cirq/contrib/paulistring/separate.py +1 -2
  59. cirq/contrib/qasm_import/_lexer.py +1 -0
  60. cirq/contrib/qasm_import/_lexer_test.py +1 -0
  61. cirq/contrib/qasm_import/_parser.py +2 -3
  62. cirq/contrib/qasm_import/_parser_test.py +1 -1
  63. cirq/contrib/qasm_import/qasm_test.py +1 -1
  64. cirq/contrib/quantum_volume/quantum_volume.py +1 -1
  65. cirq/contrib/quantum_volume/quantum_volume_test.py +3 -1
  66. cirq/contrib/quimb/density_matrix.py +1 -1
  67. cirq/contrib/quimb/state_vector.py +1 -1
  68. cirq/contrib/quirk/export_to_quirk.py +3 -3
  69. cirq/contrib/routing/device.py +1 -1
  70. cirq/contrib/routing/device_test.py +1 -2
  71. cirq/contrib/routing/greedy.py +2 -2
  72. cirq/contrib/routing/initialization_test.py +1 -1
  73. cirq/contrib/routing/swap_network.py +1 -1
  74. cirq/contrib/routing/utils.py +2 -2
  75. cirq/contrib/routing/utils_test.py +1 -2
  76. cirq/contrib/shuffle_circuits/shuffle_circuits_with_readout_benchmarking.py +2 -2
  77. cirq/contrib/shuffle_circuits/shuffle_circuits_with_readout_benchmarking_test.py +6 -4
  78. cirq/contrib/svg/svg.py +2 -3
  79. cirq/devices/device.py +3 -1
  80. cirq/devices/device_test.py +1 -0
  81. cirq/devices/grid_device_metadata.py +2 -1
  82. cirq/devices/grid_device_metadata_test.py +2 -1
  83. cirq/devices/grid_qubit.py +2 -2
  84. cirq/devices/insertion_noise_model.py +1 -1
  85. cirq/devices/insertion_noise_model_test.py +1 -1
  86. cirq/devices/line_qubit.py +1 -0
  87. cirq/devices/named_topologies.py +6 -6
  88. cirq/devices/named_topologies_test.py +5 -4
  89. cirq/devices/noise_model.py +2 -2
  90. cirq/devices/noise_properties.py +2 -2
  91. cirq/devices/noise_properties_test.py +2 -2
  92. cirq/devices/noise_utils.py +3 -3
  93. cirq/devices/superconducting_qubits_noise_properties.py +2 -2
  94. cirq/devices/superconducting_qubits_noise_properties_test.py +3 -3
  95. cirq/devices/thermal_noise_model.py +2 -1
  96. cirq/devices/unconstrained_device.py +1 -1
  97. cirq/experiments/qubit_characterizations.py +9 -10
  98. cirq/experiments/qubit_characterizations_test.py +4 -6
  99. cirq/experiments/random_quantum_circuit_generation.py +3 -4
  100. cirq/experiments/random_quantum_circuit_generation_test.py +4 -4
  101. cirq/experiments/readout_confusion_matrix.py +5 -3
  102. cirq/experiments/readout_confusion_matrix_test.py +2 -2
  103. cirq/experiments/single_qubit_readout_calibration.py +5 -4
  104. cirq/experiments/single_qubit_readout_calibration_test.py +1 -1
  105. cirq/experiments/t1_decay_experiment.py +4 -5
  106. cirq/experiments/t1_decay_experiment_test.py +1 -2
  107. cirq/experiments/t2_decay_experiment.py +0 -1
  108. cirq/experiments/t2_decay_experiment_test.py +1 -2
  109. cirq/experiments/two_qubit_xeb.py +13 -10
  110. cirq/experiments/two_qubit_xeb_test.py +3 -4
  111. cirq/experiments/xeb_fitting.py +6 -3
  112. cirq/experiments/xeb_fitting_test.py +5 -5
  113. cirq/experiments/xeb_sampling.py +5 -5
  114. cirq/experiments/xeb_simulation.py +3 -2
  115. cirq/experiments/z_phase_calibration.py +4 -3
  116. cirq/experiments/z_phase_calibration_test.py +4 -5
  117. cirq/interop/quirk/cells/arithmetic_cells.py +8 -8
  118. cirq/interop/quirk/cells/arithmetic_cells_test.py +1 -1
  119. cirq/interop/quirk/cells/cell.py +6 -6
  120. cirq/interop/quirk/cells/composite_cell.py +5 -5
  121. cirq/interop/quirk/cells/composite_cell_test.py +1 -1
  122. cirq/interop/quirk/cells/frequency_space_cells.py +2 -2
  123. cirq/interop/quirk/cells/ignored_cells.py +1 -1
  124. cirq/interop/quirk/cells/input_cells.py +1 -1
  125. cirq/interop/quirk/cells/input_cells_test.py +1 -1
  126. cirq/interop/quirk/cells/input_rotation_cells.py +1 -1
  127. cirq/interop/quirk/cells/input_rotation_cells_test.py +1 -1
  128. cirq/interop/quirk/cells/measurement_cells.py +1 -1
  129. cirq/interop/quirk/cells/parse.py +3 -4
  130. cirq/interop/quirk/cells/parse_test.py +1 -1
  131. cirq/interop/quirk/cells/single_qubit_rotation_cells.py +1 -1
  132. cirq/interop/quirk/cells/swap_cell_test.py +1 -1
  133. cirq/interop/quirk/cells/unsupported_cells.py +1 -1
  134. cirq/interop/quirk/url_to_circuit.py +7 -7
  135. cirq/interop/quirk/url_to_circuit_test.py +1 -1
  136. cirq/json_resolver_cache.py +6 -5
  137. cirq/linalg/combinators.py +2 -2
  138. cirq/linalg/combinators_test.py +1 -1
  139. cirq/linalg/decompositions.py +2 -2
  140. cirq/linalg/decompositions_test.py +1 -2
  141. cirq/linalg/diagonalize.py +1 -1
  142. cirq/linalg/diagonalize_test.py +1 -1
  143. cirq/linalg/predicates.py +2 -2
  144. cirq/linalg/predicates_test.py +1 -0
  145. cirq/linalg/tolerance.py +1 -1
  146. cirq/neutral_atoms/convert_to_neutral_atom_gates_test.py +0 -1
  147. cirq/ops/arithmetic_operation.py +2 -2
  148. cirq/ops/arithmetic_operation_test.py +2 -2
  149. cirq/ops/classically_controlled_operation.py +2 -2
  150. cirq/ops/clifford_gate.py +3 -3
  151. cirq/ops/clifford_gate_test.py +1 -1
  152. cirq/ops/common_channels.py +2 -2
  153. cirq/ops/common_gate_families.py +1 -1
  154. cirq/ops/common_gate_families_test.py +1 -0
  155. cirq/ops/common_gates.py +3 -3
  156. cirq/ops/control_values.py +2 -2
  157. cirq/ops/control_values_test.py +2 -1
  158. cirq/ops/controlled_gate.py +2 -2
  159. cirq/ops/controlled_operation.py +3 -3
  160. cirq/ops/dense_pauli_string.py +3 -3
  161. cirq/ops/diagonal_gate.py +1 -1
  162. cirq/ops/diagonal_gate_test.py +1 -0
  163. cirq/ops/eigen_gate.py +1 -1
  164. cirq/ops/eigen_gate_test.py +1 -1
  165. cirq/ops/fourier_transform.py +1 -1
  166. cirq/ops/fourier_transform_test.py +2 -1
  167. cirq/ops/gate_operation.py +5 -5
  168. cirq/ops/gateset_test.py +4 -2
  169. cirq/ops/global_phase_op.py +3 -3
  170. cirq/ops/identity.py +1 -1
  171. cirq/ops/kraus_channel.py +1 -0
  172. cirq/ops/kraus_channel_test.py +2 -1
  173. cirq/ops/linear_combinations.py +9 -9
  174. cirq/ops/matrix_gates.py +2 -2
  175. cirq/ops/measure_util.py +2 -2
  176. cirq/ops/measurement_gate.py +1 -1
  177. cirq/ops/measurement_gate_test.py +1 -0
  178. cirq/ops/mixed_unitary_channel.py +1 -0
  179. cirq/ops/mixed_unitary_channel_test.py +2 -1
  180. cirq/ops/named_qubit.py +0 -1
  181. cirq/ops/op_tree.py +1 -1
  182. cirq/ops/parallel_gate.py +1 -1
  183. cirq/ops/parallel_gate_test.py +2 -1
  184. cirq/ops/parity_gates.py +5 -6
  185. cirq/ops/pauli_gates.py +4 -5
  186. cirq/ops/pauli_gates_test.py +1 -0
  187. cirq/ops/pauli_interaction_gate.py +3 -3
  188. cirq/ops/pauli_interaction_gate_test.py +2 -3
  189. cirq/ops/pauli_measurement_gate.py +4 -4
  190. cirq/ops/pauli_string.py +5 -5
  191. cirq/ops/pauli_string_phasor.py +6 -7
  192. cirq/ops/pauli_string_phasor_test.py +2 -1
  193. cirq/ops/pauli_string_raw_types.py +1 -0
  194. cirq/ops/pauli_sum_exponential.py +1 -1
  195. cirq/ops/pauli_sum_exponential_test.py +0 -1
  196. cirq/ops/permutation_gate_test.py +1 -1
  197. cirq/ops/phased_x_gate.py +3 -4
  198. cirq/ops/phased_x_z_gate.py +3 -3
  199. cirq/ops/qubit_manager.py +2 -1
  200. cirq/ops/qubit_manager_test.py +2 -1
  201. cirq/ops/qubit_order.py +1 -1
  202. cirq/ops/random_gate_channel.py +1 -1
  203. cirq/ops/raw_types.py +4 -4
  204. cirq/ops/raw_types_test.py +2 -2
  205. cirq/ops/state_preparation_channel.py +2 -2
  206. cirq/ops/state_preparation_channel_test.py +2 -1
  207. cirq/ops/swap_gates.py +2 -2
  208. cirq/ops/three_qubit_gates.py +2 -3
  209. cirq/ops/three_qubit_gates_test.py +1 -0
  210. cirq/ops/two_qubit_diagonal_gate.py +3 -2
  211. cirq/ops/uniform_superposition_gate.py +3 -3
  212. cirq/ops/uniform_superposition_gate_test.py +1 -0
  213. cirq/ops/wait_gate.py +1 -1
  214. cirq/protocols/act_on_protocol_test.py +1 -1
  215. cirq/protocols/apply_channel_protocol.py +2 -2
  216. cirq/protocols/apply_mixture_protocol.py +1 -1
  217. cirq/protocols/approximate_equality_protocol.py +3 -4
  218. cirq/protocols/approximate_equality_protocol_test.py +3 -1
  219. cirq/protocols/circuit_diagram_info_protocol.py +5 -5
  220. cirq/protocols/decompose_protocol.py +3 -4
  221. cirq/protocols/decompose_protocol_test.py +1 -0
  222. cirq/protocols/equal_up_to_global_phase_protocol_test.py +1 -0
  223. cirq/protocols/has_stabilizer_effect_protocol.py +5 -5
  224. cirq/protocols/has_unitary_protocol.py +1 -1
  225. cirq/protocols/inverse_protocol.py +1 -1
  226. cirq/protocols/json_serialization_test.py +1 -1
  227. cirq/protocols/kraus_protocol.py +1 -2
  228. cirq/protocols/kraus_protocol_test.py +0 -1
  229. cirq/protocols/mixture_protocol_test.py +1 -2
  230. cirq/protocols/pauli_expansion_protocol.py +1 -0
  231. cirq/protocols/pow_protocol.py +1 -1
  232. cirq/protocols/qasm.py +1 -1
  233. cirq/protocols/qid_shape_protocol.py +1 -1
  234. cirq/protocols/resolve_parameters.py +1 -2
  235. cirq/protocols/resolve_parameters_test.py +2 -1
  236. cirq/protocols/trace_distance_bound.py +1 -1
  237. cirq/protocols/trace_distance_bound_test.py +1 -0
  238. cirq/protocols/unitary_protocol.py +2 -2
  239. cirq/qis/clifford_tableau.py +2 -1
  240. cirq/qis/entropy.py +1 -1
  241. cirq/qis/entropy_test.py +2 -1
  242. cirq/qis/measures.py +3 -3
  243. cirq/qis/noise_utils_test.py +4 -4
  244. cirq/qis/quantum_state_representation.py +1 -1
  245. cirq/qis/states.py +3 -2
  246. cirq/sim/classical_simulator.py +7 -6
  247. cirq/sim/classical_simulator_test.py +3 -1
  248. cirq/sim/clifford/stabilizer_state_ch_form.py +1 -0
  249. cirq/sim/density_matrix_simulator.py +1 -1
  250. cirq/sim/density_matrix_utils.py +1 -1
  251. cirq/sim/mux.py +2 -2
  252. cirq/sim/simulation_state.py +3 -4
  253. cirq/sim/simulation_state_base.py +1 -1
  254. cirq/sim/simulation_utils_test.py +2 -3
  255. cirq/sim/simulator_base.py +5 -5
  256. cirq/sim/simulator_test.py +2 -2
  257. cirq/sim/sparse_simulator.py +2 -2
  258. cirq/sim/sparse_simulator_test.py +1 -1
  259. cirq/sim/state_vector.py +2 -2
  260. cirq/sim/state_vector_simulator.py +4 -4
  261. cirq/study/flatten_expressions.py +2 -2
  262. cirq/study/flatten_expressions_test.py +1 -1
  263. cirq/study/resolver.py +1 -0
  264. cirq/study/result.py +3 -3
  265. cirq/study/sweepable.py +3 -2
  266. cirq/study/sweeps.py +4 -4
  267. cirq/study/sweeps_test.py +1 -0
  268. cirq/testing/circuit_compare.py +3 -4
  269. cirq/testing/circuit_compare_test.py +1 -2
  270. cirq/testing/consistent_act_on.py +3 -3
  271. cirq/testing/consistent_channels_test.py +2 -1
  272. cirq/testing/consistent_controlled_gate_op.py +3 -2
  273. cirq/testing/consistent_controlled_gate_op_test.py +2 -3
  274. cirq/testing/consistent_decomposition.py +1 -1
  275. cirq/testing/consistent_decomposition_test.py +1 -2
  276. cirq/testing/consistent_phase_by.py +1 -1
  277. cirq/testing/consistent_phase_by_test.py +1 -2
  278. cirq/testing/consistent_protocols.py +9 -9
  279. cirq/testing/consistent_protocols_test.py +3 -4
  280. cirq/testing/consistent_qasm.py +1 -1
  281. cirq/testing/consistent_qasm_test.py +1 -1
  282. cirq/testing/consistent_resolve_parameters.py +2 -1
  283. cirq/testing/consistent_specified_has_unitary_test.py +1 -1
  284. cirq/testing/consistent_unitary.py +3 -1
  285. cirq/testing/consistent_unitary_test.py +3 -3
  286. cirq/testing/devices.py +1 -1
  287. cirq/testing/devices_test.py +1 -0
  288. cirq/testing/equals_tester.py +1 -3
  289. cirq/testing/equals_tester_test.py +1 -0
  290. cirq/testing/equivalent_basis_map.py +1 -0
  291. cirq/testing/equivalent_basis_map_test.py +0 -1
  292. cirq/testing/json.py +2 -3
  293. cirq/testing/lin_alg_utils_test.py +1 -1
  294. cirq/testing/order_tester.py +1 -1
  295. cirq/testing/order_tester_test.py +1 -1
  296. cirq/testing/random_circuit.py +2 -2
  297. cirq/testing/random_circuit_test.py +1 -1
  298. cirq/testing/routing_devices_test.py +2 -1
  299. cirq/testing/sample_circuits.py +1 -1
  300. cirq/testing/sample_gates.py +3 -2
  301. cirq/testing/sample_gates_test.py +2 -2
  302. cirq/transformers/align.py +1 -0
  303. cirq/transformers/analytical_decompositions/clifford_decomposition.py +2 -1
  304. cirq/transformers/analytical_decompositions/clifford_decomposition_test.py +1 -1
  305. cirq/transformers/analytical_decompositions/controlled_gate_decomposition.py +1 -1
  306. cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py +1 -1
  307. cirq/transformers/analytical_decompositions/pauli_string_decomposition.py +2 -2
  308. cirq/transformers/analytical_decompositions/pauli_string_decomposition_test.py +4 -4
  309. cirq/transformers/analytical_decompositions/quantum_shannon_decomposition.py +6 -7
  310. cirq/transformers/analytical_decompositions/quantum_shannon_decomposition_test.py +5 -5
  311. cirq/transformers/analytical_decompositions/single_qubit_decompositions.py +1 -1
  312. cirq/transformers/analytical_decompositions/single_to_two_qubit_isometry.py +1 -1
  313. cirq/transformers/analytical_decompositions/single_to_two_qubit_isometry_test.py +1 -0
  314. cirq/transformers/analytical_decompositions/three_qubit_decomposition.py +2 -3
  315. cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py +1 -1
  316. cirq/transformers/analytical_decompositions/two_qubit_state_preparation.py +2 -1
  317. cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py +2 -1
  318. cirq/transformers/analytical_decompositions/two_qubit_to_cz.py +5 -6
  319. cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py +2 -2
  320. cirq/transformers/analytical_decompositions/two_qubit_to_fsim.py +1 -1
  321. cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py +1 -2
  322. cirq/transformers/analytical_decompositions/two_qubit_to_ms.py +2 -2
  323. cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap.py +1 -1
  324. cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py +2 -1
  325. cirq/transformers/drop_empty_moments.py +1 -0
  326. cirq/transformers/drop_negligible_operations.py +1 -0
  327. cirq/transformers/dynamical_decoupling.py +7 -7
  328. cirq/transformers/dynamical_decoupling_test.py +4 -2
  329. cirq/transformers/eject_phased_paulis.py +4 -3
  330. cirq/transformers/eject_phased_paulis_test.py +1 -1
  331. cirq/transformers/eject_z.py +2 -1
  332. cirq/transformers/eject_z_test.py +1 -1
  333. cirq/transformers/gauge_compiling/cphase_gauge.py +5 -5
  334. cirq/transformers/gauge_compiling/cz_gauge.py +4 -4
  335. cirq/transformers/gauge_compiling/gauge_compiling.py +9 -9
  336. cirq/transformers/gauge_compiling/gauge_compiling_test.py +8 -6
  337. cirq/transformers/gauge_compiling/gauge_compiling_test_utils.py +2 -2
  338. cirq/transformers/gauge_compiling/gauge_compiling_test_utils_test.py +2 -1
  339. cirq/transformers/gauge_compiling/iswap_gauge.py +2 -2
  340. cirq/transformers/gauge_compiling/spin_inversion_gauge.py +2 -2
  341. cirq/transformers/gauge_compiling/sqrt_cz_gauge.py +5 -5
  342. cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py +3 -2
  343. cirq/transformers/heuristic_decompositions/gate_tabulation_math_utils.py +2 -1
  344. cirq/transformers/heuristic_decompositions/gate_tabulation_math_utils_test.py +1 -1
  345. cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation.py +4 -4
  346. cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation_test.py +4 -4
  347. cirq/transformers/insertion_sort.py +1 -1
  348. cirq/transformers/merge_k_qubit_gates.py +2 -2
  349. cirq/transformers/merge_single_qubit_gates.py +1 -1
  350. cirq/transformers/noise_adding.py +4 -3
  351. cirq/transformers/noise_adding_test.py +3 -2
  352. cirq/transformers/optimize_for_target_gateset.py +1 -1
  353. cirq/transformers/optimize_for_target_gateset_test.py +2 -1
  354. cirq/transformers/randomized_measurements.py +2 -1
  355. cirq/transformers/randomized_measurements_test.py +2 -1
  356. cirq/transformers/routing/initial_mapper.py +1 -1
  357. cirq/transformers/routing/initial_mapper_test.py +1 -0
  358. cirq/transformers/routing/line_initial_mapper.py +3 -2
  359. cirq/transformers/routing/mapping_manager.py +2 -2
  360. cirq/transformers/routing/mapping_manager_test.py +2 -2
  361. cirq/transformers/routing/route_circuit_cqc.py +3 -2
  362. cirq/transformers/routing/route_circuit_cqc_test.py +2 -1
  363. cirq/transformers/routing/visualize_routed_circuit.py +1 -0
  364. cirq/transformers/routing/visualize_routed_circuit_test.py +1 -0
  365. cirq/transformers/stratify.py +2 -2
  366. cirq/transformers/synchronize_terminal_measurements.py +2 -1
  367. cirq/transformers/target_gatesets/compilation_target_gateset.py +1 -2
  368. cirq/transformers/target_gatesets/compilation_target_gateset_test.py +2 -0
  369. cirq/transformers/target_gatesets/cz_gateset.py +1 -1
  370. cirq/transformers/target_gatesets/cz_gateset_test.py +4 -2
  371. cirq/transformers/target_gatesets/sqrt_iswap_gateset.py +1 -1
  372. cirq/transformers/target_gatesets/sqrt_iswap_gateset_test.py +3 -2
  373. cirq/transformers/transformer_api.py +5 -4
  374. cirq/transformers/transformer_api_test.py +3 -3
  375. cirq/transformers/transformer_primitives.py +3 -4
  376. cirq/transformers/transformer_primitives_test.py +1 -0
  377. cirq/value/abc_alt.py +1 -2
  378. cirq/value/angle.py +2 -0
  379. cirq/value/classical_data.py +1 -0
  380. cirq/value/digits.py +1 -1
  381. cirq/value/duration.py +3 -3
  382. cirq/value/duration_test.py +2 -1
  383. cirq/value/linear_dict.py +2 -1
  384. cirq/value/measurement_key.py +1 -2
  385. cirq/value/periodic_value.py +0 -1
  386. cirq/value/probability.py +1 -0
  387. cirq/value/random_state.py +1 -1
  388. cirq/value/timestamp_test.py +2 -1
  389. cirq/value/value_equality_attr.py +1 -1
  390. cirq/vis/density_matrix.py +1 -1
  391. cirq/vis/density_matrix_test.py +2 -5
  392. cirq/vis/heatmap.py +0 -1
  393. cirq/vis/heatmap_test.py +2 -3
  394. cirq/vis/histogram.py +1 -1
  395. cirq/vis/histogram_test.py +1 -2
  396. cirq/vis/state_histogram.py +4 -2
  397. cirq/vis/state_histogram_test.py +2 -2
  398. cirq/work/collector.py +1 -1
  399. cirq/work/observable_grouping.py +2 -2
  400. cirq/work/observable_measurement.py +3 -3
  401. cirq/work/observable_measurement_data.py +2 -2
  402. cirq/work/observable_measurement_test.py +8 -8
  403. cirq/work/observable_readout_calibration.py +2 -2
  404. cirq/work/observable_readout_calibration_test.py +2 -1
  405. cirq/work/observable_settings.py +6 -6
  406. cirq/work/observable_settings_test.py +2 -2
  407. cirq/work/pauli_sum_collector.py +1 -1
  408. cirq/work/sampler.py +2 -3
  409. cirq/work/sampler_test.py +1 -2
  410. cirq/work/zeros_sampler.py +1 -1
  411. {cirq_core-1.5.0.dev20250327205617.dist-info → cirq_core-1.5.0.dev20250327210023.dist-info}/METADATA +1 -1
  412. {cirq_core-1.5.0.dev20250327205617.dist-info → cirq_core-1.5.0.dev20250327210023.dist-info}/RECORD +415 -415
  413. {cirq_core-1.5.0.dev20250327205617.dist-info → cirq_core-1.5.0.dev20250327210023.dist-info}/LICENSE +0 -0
  414. {cirq_core-1.5.0.dev20250327205617.dist-info → cirq_core-1.5.0.dev20250327210023.dist-info}/WHEEL +0 -0
  415. {cirq_core-1.5.0.dev20250327205617.dist-info → cirq_core-1.5.0.dev20250327210023.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
  """Tests for simulator.py"""
15
15
  import abc
16
- from typing import Generic, Dict, Any, List, Sequence, Union
16
+ from typing import Any, Dict, Generic, List, Sequence, Union
17
17
  from unittest import mock
18
18
 
19
19
  import duet
@@ -24,13 +24,13 @@ import cirq
24
24
  from cirq import study
25
25
  from cirq.sim.simulation_state import TSimulationState
26
26
  from cirq.sim.simulator import (
27
- TStepResult,
28
27
  SimulatesAmplitudes,
29
28
  SimulatesExpectationValues,
30
29
  SimulatesFinalState,
31
30
  SimulatesIntermediateState,
32
31
  SimulatesSamples,
33
32
  SimulationTrialResult,
33
+ TStepResult,
34
34
  )
35
35
 
36
36
 
@@ -14,12 +14,12 @@
14
14
 
15
15
  """A simulator that uses numpy's einsum for sparse matrix operations."""
16
16
 
17
- from typing import Any, Iterator, List, TYPE_CHECKING, Union, Sequence, Type, Optional
17
+ from typing import Any, Iterator, List, Optional, Sequence, Type, TYPE_CHECKING, Union
18
18
 
19
19
  import numpy as np
20
20
 
21
21
  from cirq import ops
22
- from cirq.sim import simulator, state_vector, state_vector_simulator, state_vector_simulation_state
22
+ from cirq.sim import simulator, state_vector, state_vector_simulation_state, state_vector_simulator
23
23
 
24
24
  if TYPE_CHECKING:
25
25
  import cirq
@@ -14,8 +14,8 @@
14
14
  import itertools
15
15
  import random
16
16
  from typing import Type
17
-
18
17
  from unittest import mock
18
+
19
19
  import numpy as np
20
20
  import pytest
21
21
  import sympy
cirq/sim/state_vector.py CHANGED
@@ -14,12 +14,12 @@
14
14
  """Helpers for handling quantum state vectors."""
15
15
 
16
16
  import abc
17
- from typing import List, Mapping, Optional, Tuple, TYPE_CHECKING, Sequence
17
+ from typing import List, Mapping, Optional, Sequence, Tuple, TYPE_CHECKING
18
18
 
19
19
  import numpy as np
20
20
 
21
21
  from cirq import linalg, qis, value
22
- from cirq.sim import simulator, simulation_utils
22
+ from cirq.sim import simulation_utils, simulator
23
23
 
24
24
  if TYPE_CHECKING:
25
25
  import cirq
@@ -14,15 +14,15 @@
14
14
  """Abstract classes for simulations which keep track of state vector."""
15
15
 
16
16
  import abc
17
- from functools import cached_property
18
- from typing import Any, Dict, Iterator, Sequence, Type, TYPE_CHECKING, Generic, TypeVar
19
17
  import warnings
18
+ from functools import cached_property
19
+ from typing import Any, Dict, Generic, Iterator, Sequence, Type, TYPE_CHECKING, TypeVar
20
20
 
21
21
  import numpy as np
22
22
 
23
- from cirq import _compat, ops, value, qis
24
- from cirq.sim import simulator, state_vector, simulator_base
23
+ from cirq import _compat, ops, qis, value
25
24
  from cirq.protocols import qid_shape
25
+ from cirq.sim import simulator, simulator_base, state_vector
26
26
 
27
27
  if TYPE_CHECKING:
28
28
  import cirq
@@ -13,13 +13,13 @@
13
13
  # limitations under the License.
14
14
  """Resolves symbolic expressions to unique symbols."""
15
15
 
16
- from typing import Any, Callable, List, Optional, Tuple, Union, TYPE_CHECKING
17
16
  import numbers
17
+ from typing import Any, Callable, List, Optional, Tuple, TYPE_CHECKING, Union
18
18
 
19
19
  import sympy
20
20
 
21
21
  from cirq import protocols
22
- from cirq.study import resolver, sweeps, sweepable
22
+ from cirq.study import resolver, sweepable, sweeps
23
23
 
24
24
  if TYPE_CHECKING:
25
25
  import cirq
@@ -13,10 +13,10 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import sympy
16
+
16
17
  import cirq
17
18
  from cirq.study import flatten_expressions
18
19
 
19
-
20
20
  # None of the following tests use expressions of the form
21
21
  # <constant term> - <other term> because the string of expressions containing
22
22
  # exactly two terms, one constant term and one non-constant term with a negative
cirq/study/resolver.py CHANGED
@@ -19,6 +19,7 @@ from typing import Any, cast, Dict, Iterator, Mapping, Optional, TYPE_CHECKING,
19
19
  import numpy as np
20
20
  import sympy
21
21
  from sympy.core import numbers as sympy_numbers
22
+
22
23
  from cirq._compat import proper_repr
23
24
  from cirq._doc import document
24
25
 
cirq/study/result.py CHANGED
@@ -19,22 +19,22 @@ import io
19
19
  from typing import (
20
20
  Any,
21
21
  Callable,
22
+ cast,
22
23
  Dict,
23
24
  Iterable,
24
25
  Mapping,
25
26
  Optional,
26
27
  Sequence,
27
- TYPE_CHECKING,
28
28
  Tuple,
29
+ TYPE_CHECKING,
29
30
  TypeVar,
30
31
  Union,
31
- cast,
32
32
  )
33
33
 
34
34
  import numpy as np
35
35
  import pandas as pd
36
36
 
37
- from cirq import value, ops
37
+ from cirq import ops, value
38
38
  from cirq._compat import proper_repr
39
39
  from cirq.study import resolver
40
40
 
cirq/study/sweepable.py CHANGED
@@ -14,13 +14,14 @@
14
14
 
15
15
  """Defines which types are Sweepable."""
16
16
 
17
- from typing import Iterable, Iterator, List, Optional, Sequence, Union, cast
18
17
  import warnings
18
+ from typing import cast, Iterable, Iterator, List, Optional, Sequence, Union
19
+
19
20
  from typing_extensions import Protocol
20
21
 
21
22
  from cirq._doc import document
22
23
  from cirq.study.resolver import ParamResolver, ParamResolverOrSimilarType
23
- from cirq.study.sweeps import ListSweep, Points, Sweep, UnitSweep, Zip, dict_to_product_sweep
24
+ from cirq.study.sweeps import dict_to_product_sweep, ListSweep, Points, Sweep, UnitSweep, Zip
24
25
 
25
26
  SweepLike = Union[ParamResolverOrSimilarType, Sweep]
26
27
  document(SweepLike, """An object similar to an iterable of parameter resolvers.""")
cirq/study/sweeps.py CHANGED
@@ -11,6 +11,9 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ import abc
15
+ import collections
16
+ import itertools
14
17
  from typing import (
15
18
  Any,
16
19
  cast,
@@ -21,14 +24,11 @@ from typing import (
21
24
  Optional,
22
25
  overload,
23
26
  Sequence,
24
- TYPE_CHECKING,
25
27
  Tuple,
28
+ TYPE_CHECKING,
26
29
  Union,
27
30
  )
28
31
 
29
- import abc
30
- import collections
31
- import itertools
32
32
  import sympy
33
33
 
34
34
  from cirq import protocols
cirq/study/sweeps_test.py CHANGED
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
  import pytest
15
15
  import sympy
16
+
16
17
  import cirq
17
18
 
18
19
 
@@ -12,16 +12,15 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
16
-
17
- from collections import defaultdict
18
15
  import itertools
19
16
  import random
17
+ from collections import defaultdict
18
+ from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
20
19
 
21
20
  import numpy as np
22
21
  import sympy
23
22
 
24
- from cirq import circuits, ops, linalg, protocols, qis
23
+ from cirq import circuits, linalg, ops, protocols, qis
25
24
  from cirq.testing import lin_alg_utils
26
25
 
27
26
 
@@ -12,9 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
-
17
15
  import numpy as np
16
+ import pytest
18
17
 
19
18
  import cirq
20
19
  from cirq.testing.circuit_compare import _assert_apply_unitary_works_when_axes_transposed
@@ -16,17 +16,17 @@ from typing import Any, cast, Optional, Type
16
16
 
17
17
  import numpy as np
18
18
 
19
+ from cirq import protocols
19
20
  from cirq.circuits.circuit import Circuit
20
21
  from cirq.devices import LineQubit
21
22
  from cirq.ops import common_gates
22
23
  from cirq.ops.dense_pauli_string import DensePauliString
23
- from cirq import protocols
24
24
  from cirq.qis import clifford_tableau
25
- from cirq.sim import state_vector_simulation_state, final_state_vector
25
+ from cirq.sim import final_state_vector, state_vector_simulation_state
26
26
  from cirq.sim.clifford import (
27
27
  clifford_tableau_simulation_state,
28
- stabilizer_state_ch_form,
29
28
  stabilizer_ch_form_simulation_state,
29
+ stabilizer_state_ch_form,
30
30
  )
31
31
 
32
32
 
@@ -12,8 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
15
  import numpy as np
16
+ import pytest
17
+
17
18
  import cirq
18
19
 
19
20
 
@@ -12,11 +12,12 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import Sequence, Optional, Union, Collection
15
+ from typing import Collection, Optional, Sequence, Union
16
16
 
17
- from cirq import devices, ops, protocols
18
17
  import numpy as np
19
18
 
19
+ from cirq import devices, ops, protocols
20
+
20
21
 
21
22
  def assert_controlled_and_controlled_by_identical(
22
23
  gate: ops.Gate,
@@ -12,11 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import Optional, Sequence, Union, Collection, Tuple, List
16
-
17
- import pytest
15
+ from typing import Collection, List, Optional, Sequence, Tuple, Union
18
16
 
19
17
  import numpy as np
18
+ import pytest
20
19
 
21
20
  import cirq
22
21
  from cirq.ops import control_values as cv
@@ -16,7 +16,7 @@ from typing import Any
16
16
 
17
17
  import numpy as np
18
18
 
19
- from cirq import devices, protocols, ops, circuits
19
+ from cirq import circuits, devices, ops, protocols
20
20
  from cirq.testing import lin_alg_utils
21
21
 
22
22
 
@@ -12,9 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
-
17
15
  import numpy as np
16
+ import pytest
18
17
  import sympy
19
18
 
20
19
  import cirq
@@ -17,7 +17,7 @@ from typing import Any
17
17
  import numpy as np
18
18
  import sympy
19
19
 
20
- from cirq import protocols, linalg
20
+ from cirq import linalg, protocols
21
21
  from cirq.testing import lin_alg_utils
22
22
 
23
23
 
@@ -12,9 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
-
17
15
  import numpy as np
16
+ import pytest
18
17
 
19
18
  import cirq
20
19
 
@@ -19,28 +19,28 @@ import numpy as np
19
19
  import sympy
20
20
 
21
21
  from cirq import ops, protocols, value
22
- from cirq.testing.consistent_act_on import assert_all_implemented_act_on_effects_match_unitary
23
22
  from cirq.testing.circuit_compare import (
24
23
  assert_has_consistent_apply_unitary,
25
24
  assert_has_consistent_qid_shape,
26
25
  )
26
+ from cirq.testing.consistent_act_on import assert_all_implemented_act_on_effects_match_unitary
27
+ from cirq.testing.consistent_controlled_gate_op import (
28
+ assert_controlled_and_controlled_by_identical,
29
+ assert_controlled_unitary_consistent,
30
+ )
27
31
  from cirq.testing.consistent_decomposition import (
28
- assert_decompose_is_consistent_with_unitary,
29
32
  assert_decompose_ends_at_default_gateset,
33
+ assert_decompose_is_consistent_with_unitary,
30
34
  )
31
- from cirq.testing.consistent_phase_by import assert_phase_by_is_consistent_with_unitary
32
- from cirq.testing.consistent_qasm import assert_qasm_is_consistent_with_unitary
33
35
  from cirq.testing.consistent_pauli_expansion import (
34
36
  assert_pauli_expansion_is_consistent_with_unitary,
35
37
  )
38
+ from cirq.testing.consistent_phase_by import assert_phase_by_is_consistent_with_unitary
39
+ from cirq.testing.consistent_qasm import assert_qasm_is_consistent_with_unitary
36
40
  from cirq.testing.consistent_resolve_parameters import assert_consistent_resolve_parameters
37
41
  from cirq.testing.consistent_specified_has_unitary import assert_specifies_has_unitary_if_unitary
38
- from cirq.testing.equivalent_repr_eval import assert_equivalent_repr
39
- from cirq.testing.consistent_controlled_gate_op import (
40
- assert_controlled_and_controlled_by_identical,
41
- assert_controlled_unitary_consistent,
42
- )
43
42
  from cirq.testing.consistent_unitary import assert_unitary_is_consistent
43
+ from cirq.testing.equivalent_repr_eval import assert_equivalent_repr
44
44
 
45
45
 
46
46
  def assert_implements_consistent_protocols(
@@ -13,16 +13,15 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from types import NotImplementedType
16
- from typing import AbstractSet, Sequence, Union, List, Tuple
17
-
18
- import pytest
16
+ from typing import AbstractSet, List, Sequence, Tuple, Union
19
17
 
20
18
  import numpy as np
19
+ import pytest
21
20
  import sympy
22
21
 
23
22
  import cirq
24
- from cirq._compat import proper_repr
25
23
  import cirq.testing.consistent_controlled_gate_op_test as controlled_gate_op_test
24
+ from cirq._compat import proper_repr
26
25
 
27
26
 
28
27
  class GoodGate(cirq.testing.SingleQubitGate):
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import warnings
16
- from typing import Any, List, Sequence, Optional
16
+ from typing import Any, List, Optional, Sequence
17
17
 
18
18
  import numpy as np
19
19
 
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ import warnings
15
16
  from typing import Tuple
16
17
 
17
- import warnings
18
18
  import numpy as np
19
19
  import pytest
20
20
 
@@ -14,9 +14,10 @@
14
14
 
15
15
  from typing import Any
16
16
 
17
- import cirq
18
17
  import sympy
19
18
 
19
+ import cirq
20
+
20
21
 
21
22
  def assert_consistent_resolve_parameters(val: Any):
22
23
  names = cirq.parameter_names(val)
@@ -12,8 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import pytest
16
15
  import numpy as np
16
+ import pytest
17
17
 
18
18
  import cirq
19
19
 
@@ -14,9 +14,11 @@
14
14
 
15
15
 
16
16
  from typing import Any
17
- import cirq
17
+
18
18
  import numpy as np
19
19
 
20
+ import cirq
21
+
20
22
 
21
23
  def assert_unitary_is_consistent(val: Any, ignoring_global_phase: bool = False):
22
24
  if not isinstance(val, (cirq.Operation, cirq.Gate)):
@@ -12,10 +12,10 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import cirq
16
-
17
- import pytest
18
15
  import numpy as np
16
+ import pytest
17
+
18
+ import cirq
19
19
 
20
20
 
21
21
  class InconsistentGate(cirq.Gate):
cirq/testing/devices.py CHANGED
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  """Provides test devices that can validate circuits."""
15
- from typing import Tuple, AbstractSet, cast
15
+ from typing import AbstractSet, cast, Tuple
16
16
 
17
17
  from cirq import devices, ops
18
18
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import pytest
15
+
15
16
  import cirq
16
17
  from cirq.testing.devices import ValidatingTestDevice
17
18
 
@@ -21,10 +21,8 @@ equal to each other. It will also check that a==b implies hash(a)==hash(b).
21
21
  """
22
22
 
23
23
  import collections
24
-
25
- from typing import Any, Callable, List, Tuple, Union
26
-
27
24
  import itertools
25
+ from typing import Any, Callable, List, Tuple, Union
28
26
 
29
27
 
30
28
  class EqualsTester:
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import fractions
16
+
16
17
  import pytest
17
18
 
18
19
  from cirq.testing.equals_tester import EqualsTester
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from typing import Dict, Optional, Sequence
16
+
16
17
  import numpy as np
17
18
 
18
19
  import cirq
@@ -14,7 +14,6 @@
14
14
  import pytest
15
15
 
16
16
  import cirq
17
-
18
17
  from cirq import circuits
19
18
 
20
19
 
cirq/testing/json.py CHANGED
@@ -18,12 +18,13 @@ import io
18
18
  import pathlib
19
19
  from dataclasses import dataclass
20
20
  from types import ModuleType
21
- from typing import List, Type, Dict, Iterator, Tuple, Set
21
+ from typing import Dict, Iterator, List, Set, Tuple, Type
22
22
 
23
23
  import numpy as np
24
24
  import pandas as pd
25
25
 
26
26
  import cirq
27
+ from cirq.protocols.json_serialization import ObjectFactory
27
28
 
28
29
  # This is the testing framework for json serialization
29
30
  # The actual tests live in cirq.protocols.json_serialization_test.py.
@@ -37,8 +38,6 @@ import cirq
37
38
  # - resolver cache: a resolver cache for the exposed types - see for example
38
39
  # cirq/json_resolver_cache.py or cirq/google/json_resolver_cache.py
39
40
 
40
- from cirq.protocols.json_serialization import ObjectFactory
41
-
42
41
 
43
42
  @dataclass
44
43
  class ModuleJsonTestSpec:
@@ -15,6 +15,7 @@
15
15
  import numpy as np
16
16
  import pytest
17
17
 
18
+ from cirq.linalg import is_orthogonal, is_special_orthogonal, is_special_unitary, is_unitary
18
19
  from cirq.testing import (
19
20
  assert_allclose_up_to_global_phase,
20
21
  random_density_matrix,
@@ -24,7 +25,6 @@ from cirq.testing import (
24
25
  random_superposition,
25
26
  random_unitary,
26
27
  )
27
- from cirq.linalg import is_unitary, is_orthogonal, is_special_unitary, is_special_orthogonal
28
28
 
29
29
 
30
30
  @pytest.mark.parametrize('dim', range(1, 10))
@@ -24,8 +24,8 @@ It will also check that a==b implies hash(a)==hash(b).
24
24
  """
25
25
 
26
26
  from typing import Any
27
- from cirq.testing.equals_tester import EqualsTester
28
27
 
28
+ from cirq.testing.equals_tester import EqualsTester
29
29
 
30
30
  _NAMED_COMPARISON_OPERATORS = [
31
31
  ('<', lambda a, b: a < b),
@@ -13,11 +13,11 @@
13
13
  # limitations under the License.
14
14
 
15
15
  import fractions
16
+
16
17
  import pytest
17
18
 
18
19
  import cirq
19
20
 
20
-
21
21
  CMP_OPS = [
22
22
  lambda a, b: a == b,
23
23
  lambda a, b: a != b,
@@ -12,11 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import List, Union, Sequence, Dict, Optional, TYPE_CHECKING
15
+ from typing import Dict, List, Optional, Sequence, TYPE_CHECKING, Union
16
16
 
17
17
  from cirq import circuits, ops, value
18
- from cirq.ops import Qid
19
18
  from cirq._doc import document
19
+ from cirq.ops import Qid
20
20
 
21
21
  if TYPE_CHECKING:
22
22
  import cirq
@@ -11,8 +11,8 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- from typing import Optional, Dict, Sequence, Union, cast
15
14
  import random
15
+ from typing import cast, Dict, Optional, Sequence, Union
16
16
 
17
17
  import numpy as np
18
18
  import pytest
@@ -11,8 +11,9 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
- import pytest
15
14
  import networkx as nx
15
+ import pytest
16
+
16
17
  import cirq
17
18
 
18
19
 
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
  from typing import TYPE_CHECKING
15
15
 
16
- from cirq import ops, circuits
16
+ from cirq import circuits, ops
17
17
 
18
18
  if TYPE_CHECKING:
19
19
  import cirq