From fc28064a07443a3e611673a39baef42b96e7d079 Mon Sep 17 00:00:00 2001 From: Jintao YU Date: Thu, 30 Dec 2021 01:06:23 +0800 Subject: [PATCH] Fix the deprecation warning for `ClassicallyControlledOperation` (#4780) The `_json_dict_` method of `ClassicallyControlledOperation` contains a `cirq_type` key, which causes a deprecation warning: https://github.com/quantumlib/Cirq/blob/01ae51eebf3b18a5cbee9fc0c697d4e1511c07f2/cirq-core/cirq/protocols/json_serialization.py#L281-L288 It is easy to fix by removing this item. Nevertheless, the real problem is in the manual for serialization, which says: https://github.com/quantumlib/Cirq/blob/01ae51eebf3b18a5cbee9fc0c697d4e1511c07f2/docs/dev/serialization.md?plain=1#L91-L95 It says a `cirq_type` is required, which contradicts the code. To avoid confusing developers in the future, I have modified it. close #4763 --- cirq/ops/classically_controlled_operation.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cirq/ops/classically_controlled_operation.py b/cirq/ops/classically_controlled_operation.py index 74a4c3dbb53..3ac6f18bb93 100644 --- a/cirq/ops/classically_controlled_operation.py +++ b/cirq/ops/classically_controlled_operation.py @@ -171,7 +171,6 @@ def _circuit_diagram_info_( def _json_dict_(self) -> Dict[str, Any]: return { - 'cirq_type': self.__class__.__name__, 'conditions': self._conditions, 'sub_operation': self._sub_operation, }