We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ControlledOperation objects do not (un)pickle
Python version 3.6.8
Cirq Version = 0.6.0.dev (also in 0.5.0)

Attempting to unpickle any ops.ControlledOperation object, either by pickle or by dill, results in an error.

Code to reproduce:

```
import pickle
import cirq
import sympy

dump=pickle.dumps(cirq.Rx(sympy.Symbol('param')).on(cirq.LineQubit(0)).controlled_by(cirq.LineQubit(1)))
load=pickle.loads(dump)
```

Error message:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py", line 1558, in _loads
    encoding=encoding, errors=errors).load()
  File "/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py", line 1050, in load
    dispatch[key[0]](self)
  File "/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py", line 1323, in load_newobj
    obj = cls.__new__(cls, *args)
TypeError: __new__() missing 2 required positional arguments: 'controls' and 'sub_operation'
```
Extra info/commentary:

Though this issue doesn't reside exclusively in cirq, it does restrict the (full) use of cirq with some standard python modules. In my particular use case, it prevents use of the multiprocessing module to parallelize the simulation of circuits.



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cirq/ops/controlled_operation.py`
Content:
```
1 # Copyright 2019 The Cirq Developers
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from typing import Union, Any, Optional, List, Sequence
15 
16 import numpy as np
17 
18 from cirq import protocols, linalg, value
19 from cirq.ops import raw_types, gate_operation
20 from cirq.type_workarounds import NotImplementedType
21 from cirq.protocols import trace_distance_from_angle_list
22 
23 
24 @value.value_equality
25 class ControlledOperation(raw_types.Operation):
26     def __new__(cls,
27                 controls: Sequence[raw_types.Qid],
28                 sub_operation: raw_types.Operation):
29         """Auto-flatten nested controlled operations."""
30         if isinstance(sub_operation, ControlledOperation):
31             return ControlledOperation(
32                 tuple(controls) + sub_operation.controls,
33                 sub_operation.sub_operation)
34         return super().__new__(cls)
35 
36     def __init__(self,
37                  controls: Sequence[raw_types.Qid],
38                  sub_operation: raw_types.Operation):
39         self.controls = tuple(controls)
40         self.sub_operation = sub_operation
41 
42     @property
43     def qubits(self):
44         return self.controls + self.sub_operation.qubits
45 
46     def with_qubits(self, *new_qubits):
47         n = len(self.controls)
48         return ControlledOperation(
49             new_qubits[:n],
50             self.sub_operation.with_qubits(*new_qubits[n:]))
51 
52     def _decompose_(self):
53         result = protocols.decompose_once(self.sub_operation, NotImplemented)
54         if result is NotImplemented:
55             return NotImplemented
56 
57         return [ControlledOperation(self.controls, op) for op in result]
58 
59     def _value_equality_values_(self):
60         return frozenset(self.controls), self.sub_operation
61 
62     def _apply_unitary_(self, args: protocols.ApplyUnitaryArgs) -> np.ndarray:
63         n = len(self.controls)
64         control_axes = args.axes[:n]
65         sub_axes = args.axes[n:]
66         active = linalg.slice_for_qubits_equal_to(control_axes, -1)
67         view_axes = _positions_after_removals_at(
68             initial_positions=sub_axes,
69             removals=control_axes)
70         target_view = args.target_tensor[active]
71         buffer_view = args.available_buffer[active]
72         result = protocols.apply_unitary(
73             self.sub_operation,
74             protocols.ApplyUnitaryArgs(
75                 target_view,
76                 buffer_view,
77                 view_axes),
78             default=NotImplemented)
79 
80         if result is NotImplemented:
81             return NotImplemented
82 
83         if result is target_view:
84             return args.target_tensor
85 
86         # HACK: assume they didn't somehow escape the slice view and edit the
87         # rest of target_tensor.
88         args.target_tensor[active] = result
89         return args.target_tensor
90 
91     def _has_unitary_(self) -> bool:
92         return protocols.has_unitary(self.sub_operation)
93 
94     def _unitary_(self) -> Union[np.ndarray, NotImplementedType]:
95         sub_matrix = protocols.unitary(self.sub_operation, None)
96         if sub_matrix is None:
97             return NotImplemented
98         return linalg.block_diag(
99                     np.eye(pow(2, len(self.qubits))-sub_matrix.shape[0]),
100                     sub_matrix)
101 
102     def __str__(self):
103         if isinstance(self.sub_operation, gate_operation.GateOperation):
104             return '{}{}({})'.format(
105                 'C' * len(self.controls),
106                 self.sub_operation.gate,
107                 ', '.join(map(str, self.qubits)))
108         return 'C({}, {})'.format(', '.join(str(q) for q in self.controls),
109                                   str(self.sub_operation))
110 
111     def __repr__(self):
112         return ('cirq.ControlledOperation(controls={!r}, '
113                 'sub_operation={!r})'.format(self.controls,
114                                              self.sub_operation))
115 
116     def _is_parameterized_(self) -> bool:
117         return protocols.is_parameterized(self.sub_operation)
118 
119     def _resolve_parameters_(self, resolver):
120         new_sub_op = protocols.resolve_parameters(self.sub_operation, resolver)
121         return ControlledOperation(self.controls, new_sub_op)
122 
123     def _trace_distance_bound_(self) -> Optional[float]:
124         if self._is_parameterized_():
125             return None
126         u = protocols.unitary(self.sub_operation, default=None)
127         if u is None:
128             return NotImplemented
129         angle_list = np.append(np.angle(np.linalg.eigvals(u)), 0)
130         return trace_distance_from_angle_list(angle_list)
131 
132     def __pow__(self, exponent: Any) -> 'ControlledOperation':
133         new_sub_op = protocols.pow(self.sub_operation,
134                                    exponent,
135                                    NotImplemented)
136         if new_sub_op is NotImplemented:
137             return NotImplemented
138         return ControlledOperation(self.controls, new_sub_op)
139 
140     def _circuit_diagram_info_(self,
141                                args: protocols.CircuitDiagramInfoArgs
142                                ) -> Optional[protocols.CircuitDiagramInfo]:
143         n = len(self.controls)
144 
145         sub_args = protocols.CircuitDiagramInfoArgs(
146             known_qubit_count=(args.known_qubit_count - n
147                                if args.known_qubit_count is not None else None),
148             known_qubits=(args.known_qubits[n:]
149                           if args.known_qubits is not None else None),
150             use_unicode_characters=args.use_unicode_characters,
151             precision=args.precision,
152             qubit_map=args.qubit_map)
153         sub_info = protocols.circuit_diagram_info(self.sub_operation,
154                                                   sub_args,
155                                                   None)
156         if sub_info is None:
157             return NotImplemented
158 
159         return protocols.CircuitDiagramInfo(wire_symbols=('@',) * n +
160                                             sub_info.wire_symbols,
161                                             exponent=sub_info.exponent)
162 
163 
164 def _positions_after_removals_at(initial_positions: Sequence[int],
165                                  removals: Sequence[int]) -> List[int]:
166     # TODO: O(n lg n) instead of O(n**2)
167     result = []
168     for p in initial_positions:
169         change = len([1 for r in removals if r < p])
170         result.append(p - change)
171     return result
172
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cirq/ops/controlled_operation.py b/cirq/ops/controlled_operation.py
--- a/cirq/ops/controlled_operation.py
+++ b/cirq/ops/controlled_operation.py
@@ -23,21 +23,17 @@
 
 @value.value_equality
 class ControlledOperation(raw_types.Operation):
-    def __new__(cls,
-                controls: Sequence[raw_types.Qid],
-                sub_operation: raw_types.Operation):
-        """Auto-flatten nested controlled operations."""
-        if isinstance(sub_operation, ControlledOperation):
-            return ControlledOperation(
-                tuple(controls) + sub_operation.controls,
-                sub_operation.sub_operation)
-        return super().__new__(cls)
 
     def __init__(self,
                  controls: Sequence[raw_types.Qid],
                  sub_operation: raw_types.Operation):
-        self.controls = tuple(controls)
-        self.sub_operation = sub_operation
+        if not isinstance(sub_operation, ControlledOperation):
+            self.controls = tuple(controls)
+            self.sub_operation = sub_operation
+        else:
+            # Auto-flatten nested controlled operations.
+            self.controls = tuple(controls) + sub_operation.controls
+            self.sub_operation = sub_operation.sub_operation
 
     @property
     def qubits(self):

{"golden_diff": "diff --git a/cirq/ops/controlled_operation.py b/cirq/ops/controlled_operation.py\n--- a/cirq/ops/controlled_operation.py\n+++ b/cirq/ops/controlled_operation.py\n@@ -23,21 +23,17 @@\n \n @value.value_equality\n class ControlledOperation(raw_types.Operation):\n-    def __new__(cls,\n-                controls: Sequence[raw_types.Qid],\n-                sub_operation: raw_types.Operation):\n-        \"\"\"Auto-flatten nested controlled operations.\"\"\"\n-        if isinstance(sub_operation, ControlledOperation):\n-            return ControlledOperation(\n-                tuple(controls) + sub_operation.controls,\n-                sub_operation.sub_operation)\n-        return super().__new__(cls)\n \n     def __init__(self,\n                  controls: Sequence[raw_types.Qid],\n                  sub_operation: raw_types.Operation):\n-        self.controls = tuple(controls)\n-        self.sub_operation = sub_operation\n+        if not isinstance(sub_operation, ControlledOperation):\n+            self.controls = tuple(controls)\n+            self.sub_operation = sub_operation\n+        else:\n+            # Auto-flatten nested controlled operations.\n+            self.controls = tuple(controls) + sub_operation.controls\n+            self.sub_operation = sub_operation.sub_operation\n \n     @property\n     def qubits(self):\n", "issue": "ControlledOperation objects do not (un)pickle\nPython version 3.6.8\r\nCirq Version = 0.6.0.dev (also in 0.5.0)\r\n\r\nAttempting to unpickle any ops.ControlledOperation object, either by pickle or by dill, results in an error.\r\n\r\nCode to reproduce:\r\n\r\n```\r\nimport pickle\r\nimport cirq\r\nimport sympy\r\n\r\ndump=pickle.dumps(cirq.Rx(sympy.Symbol('param')).on(cirq.LineQubit(0)).controlled_by(cirq.LineQubit(1)))\r\nload=pickle.loads(dump)\r\n```\r\n\r\nError message:\r\n```\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py\", line 1558, in _loads\r\n    encoding=encoding, errors=errors).load()\r\n  File \"/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py\", line 1050, in load\r\n    dispatch[key[0]](self)\r\n  File \"/Users/sumneralperin-lea/anaconda3/envs/quantum/lib/python3.6/pickle.py\", line 1323, in load_newobj\r\n    obj = cls.__new__(cls, *args)\r\nTypeError: __new__() missing 2 required positional arguments: 'controls' and 'sub_operation'\r\n```\r\nExtra info/commentary:\r\n\r\nThough this issue doesn't reside exclusively in cirq, it does restrict the (full) use of cirq with some standard python modules. In my particular use case, it prevents use of the multiprocessing module to parallelize the simulation of circuits.\r\n\r\n\n", "before_files": [{"content": "# Copyright 2019 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Union, Any, Optional, List, Sequence\n\nimport numpy as np\n\nfrom cirq import protocols, linalg, value\nfrom cirq.ops import raw_types, gate_operation\nfrom cirq.type_workarounds import NotImplementedType\nfrom cirq.protocols import trace_distance_from_angle_list\n\n\n@value.value_equality\nclass ControlledOperation(raw_types.Operation):\n    def __new__(cls,\n                controls: Sequence[raw_types.Qid],\n                sub_operation: raw_types.Operation):\n        \"\"\"Auto-flatten nested controlled operations.\"\"\"\n        if isinstance(sub_operation, ControlledOperation):\n            return ControlledOperation(\n                tuple(controls) + sub_operation.controls,\n                sub_operation.sub_operation)\n        return super().__new__(cls)\n\n    def __init__(self,\n                 controls: Sequence[raw_types.Qid],\n                 sub_operation: raw_types.Operation):\n        self.controls = tuple(controls)\n        self.sub_operation = sub_operation\n\n    @property\n    def qubits(self):\n        return self.controls + self.sub_operation.qubits\n\n    def with_qubits(self, *new_qubits):\n        n = len(self.controls)\n        return ControlledOperation(\n            new_qubits[:n],\n            self.sub_operation.with_qubits(*new_qubits[n:]))\n\n    def _decompose_(self):\n        result = protocols.decompose_once(self.sub_operation, NotImplemented)\n        if result is NotImplemented:\n            return NotImplemented\n\n        return [ControlledOperation(self.controls, op) for op in result]\n\n    def _value_equality_values_(self):\n        return frozenset(self.controls), self.sub_operation\n\n    def _apply_unitary_(self, args: protocols.ApplyUnitaryArgs) -> np.ndarray:\n        n = len(self.controls)\n        control_axes = args.axes[:n]\n        sub_axes = args.axes[n:]\n        active = linalg.slice_for_qubits_equal_to(control_axes, -1)\n        view_axes = _positions_after_removals_at(\n            initial_positions=sub_axes,\n            removals=control_axes)\n        target_view = args.target_tensor[active]\n        buffer_view = args.available_buffer[active]\n        result = protocols.apply_unitary(\n            self.sub_operation,\n            protocols.ApplyUnitaryArgs(\n                target_view,\n                buffer_view,\n                view_axes),\n            default=NotImplemented)\n\n        if result is NotImplemented:\n            return NotImplemented\n\n        if result is target_view:\n            return args.target_tensor\n\n        # HACK: assume they didn't somehow escape the slice view and edit the\n        # rest of target_tensor.\n        args.target_tensor[active] = result\n        return args.target_tensor\n\n    def _has_unitary_(self) -> bool:\n        return protocols.has_unitary(self.sub_operation)\n\n    def _unitary_(self) -> Union[np.ndarray, NotImplementedType]:\n        sub_matrix = protocols.unitary(self.sub_operation, None)\n        if sub_matrix is None:\n            return NotImplemented\n        return linalg.block_diag(\n                    np.eye(pow(2, len(self.qubits))-sub_matrix.shape[0]),\n                    sub_matrix)\n\n    def __str__(self):\n        if isinstance(self.sub_operation, gate_operation.GateOperation):\n            return '{}{}({})'.format(\n                'C' * len(self.controls),\n                self.sub_operation.gate,\n                ', '.join(map(str, self.qubits)))\n        return 'C({}, {})'.format(', '.join(str(q) for q in self.controls),\n                                  str(self.sub_operation))\n\n    def __repr__(self):\n        return ('cirq.ControlledOperation(controls={!r}, '\n                'sub_operation={!r})'.format(self.controls,\n                                             self.sub_operation))\n\n    def _is_parameterized_(self) -> bool:\n        return protocols.is_parameterized(self.sub_operation)\n\n    def _resolve_parameters_(self, resolver):\n        new_sub_op = protocols.resolve_parameters(self.sub_operation, resolver)\n        return ControlledOperation(self.controls, new_sub_op)\n\n    def _trace_distance_bound_(self) -> Optional[float]:\n        if self._is_parameterized_():\n            return None\n        u = protocols.unitary(self.sub_operation, default=None)\n        if u is None:\n            return NotImplemented\n        angle_list = np.append(np.angle(np.linalg.eigvals(u)), 0)\n        return trace_distance_from_angle_list(angle_list)\n\n    def __pow__(self, exponent: Any) -> 'ControlledOperation':\n        new_sub_op = protocols.pow(self.sub_operation,\n                                   exponent,\n                                   NotImplemented)\n        if new_sub_op is NotImplemented:\n            return NotImplemented\n        return ControlledOperation(self.controls, new_sub_op)\n\n    def _circuit_diagram_info_(self,\n                               args: protocols.CircuitDiagramInfoArgs\n                               ) -> Optional[protocols.CircuitDiagramInfo]:\n        n = len(self.controls)\n\n        sub_args = protocols.CircuitDiagramInfoArgs(\n            known_qubit_count=(args.known_qubit_count - n\n                               if args.known_qubit_count is not None else None),\n            known_qubits=(args.known_qubits[n:]\n                          if args.known_qubits is not None else None),\n            use_unicode_characters=args.use_unicode_characters,\n            precision=args.precision,\n            qubit_map=args.qubit_map)\n        sub_info = protocols.circuit_diagram_info(self.sub_operation,\n                                                  sub_args,\n                                                  None)\n        if sub_info is None:\n            return NotImplemented\n\n        return protocols.CircuitDiagramInfo(wire_symbols=('@',) * n +\n                                            sub_info.wire_symbols,\n                                            exponent=sub_info.exponent)\n\n\ndef _positions_after_removals_at(initial_positions: Sequence[int],\n                                 removals: Sequence[int]) -> List[int]:\n    # TODO: O(n lg n) instead of O(n**2)\n    result = []\n    for p in initial_positions:\n        change = len([1 for r in removals if r < p])\n        result.append(p - change)\n    return result\n", "path": "cirq/ops/controlled_operation.py"}], "after_files": [{"content": "# Copyright 2019 The Cirq Developers\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Union, Any, Optional, List, Sequence\n\nimport numpy as np\n\nfrom cirq import protocols, linalg, value\nfrom cirq.ops import raw_types, gate_operation\nfrom cirq.type_workarounds import NotImplementedType\nfrom cirq.protocols import trace_distance_from_angle_list\n\n\n@value.value_equality\nclass ControlledOperation(raw_types.Operation):\n\n    def __init__(self,\n                 controls: Sequence[raw_types.Qid],\n                 sub_operation: raw_types.Operation):\n        if not isinstance(sub_operation, ControlledOperation):\n            self.controls = tuple(controls)\n            self.sub_operation = sub_operation\n        else:\n            # Auto-flatten nested controlled operations.\n            self.controls = tuple(controls) + sub_operation.controls\n            self.sub_operation = sub_operation.sub_operation\n\n    @property\n    def qubits(self):\n        return self.controls + self.sub_operation.qubits\n\n    def with_qubits(self, *new_qubits):\n        n = len(self.controls)\n        return ControlledOperation(\n            new_qubits[:n],\n            self.sub_operation.with_qubits(*new_qubits[n:]))\n\n    def _decompose_(self):\n        result = protocols.decompose_once(self.sub_operation, NotImplemented)\n        if result is NotImplemented:\n            return NotImplemented\n\n        return [ControlledOperation(self.controls, op) for op in result]\n\n    def _value_equality_values_(self):\n        return frozenset(self.controls), self.sub_operation\n\n    def _apply_unitary_(self, args: protocols.ApplyUnitaryArgs) -> np.ndarray:\n        n = len(self.controls)\n        control_axes = args.axes[:n]\n        sub_axes = args.axes[n:]\n        active = linalg.slice_for_qubits_equal_to(control_axes, -1)\n        view_axes = _positions_after_removals_at(\n            initial_positions=sub_axes,\n            removals=control_axes)\n        target_view = args.target_tensor[active]\n        buffer_view = args.available_buffer[active]\n        result = protocols.apply_unitary(\n            self.sub_operation,\n            protocols.ApplyUnitaryArgs(\n                target_view,\n                buffer_view,\n                view_axes),\n            default=NotImplemented)\n\n        if result is NotImplemented:\n            return NotImplemented\n\n        if result is target_view:\n            return args.target_tensor\n\n        # HACK: assume they didn't somehow escape the slice view and edit the\n        # rest of target_tensor.\n        args.target_tensor[active] = result\n        return args.target_tensor\n\n    def _has_unitary_(self) -> bool:\n        return protocols.has_unitary(self.sub_operation)\n\n    def _unitary_(self) -> Union[np.ndarray, NotImplementedType]:\n        sub_matrix = protocols.unitary(self.sub_operation, None)\n        if sub_matrix is None:\n            return NotImplemented\n        return linalg.block_diag(\n                    np.eye(pow(2, len(self.qubits))-sub_matrix.shape[0]),\n                    sub_matrix)\n\n    def __str__(self):\n        if isinstance(self.sub_operation, gate_operation.GateOperation):\n            return '{}{}({})'.format(\n                'C' * len(self.controls),\n                self.sub_operation.gate,\n                ', '.join(map(str, self.qubits)))\n        return 'C({}, {})'.format(', '.join(str(q) for q in self.controls),\n                                  str(self.sub_operation))\n\n    def __repr__(self):\n        return ('cirq.ControlledOperation(controls={!r}, '\n                'sub_operation={!r})'.format(self.controls,\n                                             self.sub_operation))\n\n    def _is_parameterized_(self) -> bool:\n        return protocols.is_parameterized(self.sub_operation)\n\n    def _resolve_parameters_(self, resolver):\n        new_sub_op = protocols.resolve_parameters(self.sub_operation, resolver)\n        return ControlledOperation(self.controls, new_sub_op)\n\n    def _trace_distance_bound_(self) -> Optional[float]:\n        if self._is_parameterized_():\n            return None\n        u = protocols.unitary(self.sub_operation, default=None)\n        if u is None:\n            return NotImplemented\n        angle_list = np.append(np.angle(np.linalg.eigvals(u)), 0)\n        return trace_distance_from_angle_list(angle_list)\n\n    def __pow__(self, exponent: Any) -> 'ControlledOperation':\n        new_sub_op = protocols.pow(self.sub_operation,\n                                   exponent,\n                                   NotImplemented)\n        if new_sub_op is NotImplemented:\n            return NotImplemented\n        return ControlledOperation(self.controls, new_sub_op)\n\n    def _circuit_diagram_info_(self,\n                               args: protocols.CircuitDiagramInfoArgs\n                               ) -> Optional[protocols.CircuitDiagramInfo]:\n        n = len(self.controls)\n\n        sub_args = protocols.CircuitDiagramInfoArgs(\n            known_qubit_count=(args.known_qubit_count - n\n                               if args.known_qubit_count is not None else None),\n            known_qubits=(args.known_qubits[n:]\n                          if args.known_qubits is not None else None),\n            use_unicode_characters=args.use_unicode_characters,\n            precision=args.precision,\n            qubit_map=args.qubit_map)\n        sub_info = protocols.circuit_diagram_info(self.sub_operation,\n                                                  sub_args,\n                                                  None)\n        if sub_info is None:\n            return NotImplemented\n\n        return protocols.CircuitDiagramInfo(wire_symbols=('@',) * n +\n                                            sub_info.wire_symbols,\n                                            exponent=sub_info.exponent)\n\n\ndef _positions_after_removals_at(initial_positions: Sequence[int],\n                                 removals: Sequence[int]) -> List[int]:\n    # TODO: O(n lg n) instead of O(n**2)\n    result = []\n    for p in initial_positions:\n        change = len([1 for r in removals if r < p])\n        result.append(p - change)\n    return result\n", "path": "cirq/ops/controlled_operation.py"}]}