Skip to content

Commit

Permalink
Fix the deprecation warning for ClassicallyControlledOperation (qua…
Browse files Browse the repository at this point in the history
…ntumlib#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 quantumlib#4763
  • Loading branch information
yjt98765 authored Dec 29, 2021
1 parent a48ab9e commit fc28064
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion cirq/ops/classically_controlled_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit fc28064

Please sign in to comment.