We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`cirq.X**1` should be `_PauliX` instead of `XPowGate`
**Description of the issue**

As @ybc1991 pointed out - the type of `cirq.X**1` should be `_PauliX` instead of `XPowGate`. Context: https://github.com/quantumlib/Cirq/pull/4165/files#r646844399. 

Discussed on Cirq Cynque on June 9th 2021:
- We should just fix this 
- That would make the output type value-dependent. -- that is true, but it should be fine this direction, because _PauliX is a subclass of the XPowGate


**How to reproduce the issue**

```
print(type(cirq.X), type(cirq.X**1))
# Prints:
# <class 'cirq.ops.pauli_gates._PauliX'> <class 'cirq.ops.common_gates.XPowGate'>
```


--- 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-core/cirq/ops/pauli_gates.py`
Content:
```
1 # Copyright 2018 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 import abc
15 from typing import Any, cast, Tuple, TYPE_CHECKING, Union, Dict
16 
17 from cirq._doc import document
18 from cirq.ops import common_gates, raw_types, identity
19 from cirq.type_workarounds import NotImplementedType
20 
21 
22 if TYPE_CHECKING:
23     import cirq
24     from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation
25     from cirq.value.product_state import (
26         _XEigenState,
27         _YEigenState,
28         _ZEigenState,
29     )  # coverage: ignore
30 
31 
32 class Pauli(raw_types.Gate, metaclass=abc.ABCMeta):
33     """Represents the Pauli gates.
34 
35     This is an abstract class with no public subclasses. The only instances
36     of private subclasses are the X, Y, or Z Pauli gates defined below.
37     """
38 
39     _XYZ = None  # type: Tuple[Pauli, Pauli, Pauli]
40 
41     @staticmethod
42     def by_index(index: int) -> 'Pauli':
43         return Pauli._XYZ[index % 3]
44 
45     @staticmethod
46     def by_relative_index(p: 'Pauli', relative_index: int) -> 'Pauli':
47         return Pauli._XYZ[(p._index + relative_index) % 3]
48 
49     def __init__(self, index: int, name: str) -> None:
50         self._index = index
51         self._name = name
52 
53     def num_qubits(self):
54         return 1
55 
56     def _commutes_(self, other: Any, atol: float) -> Union[bool, NotImplementedType, None]:
57         if not isinstance(other, Pauli):
58             return NotImplemented
59         return self is other
60 
61     def third(self, second: 'Pauli') -> 'Pauli':
62         return Pauli._XYZ[(-self._index - second._index) % 3]
63 
64     def relative_index(self, second: 'Pauli') -> int:
65         """Relative index of self w.r.t. second in the (X, Y, Z) cycle."""
66         return (self._index - second._index + 1) % 3 - 1
67 
68     def phased_pauli_product(
69         self, other: Union['cirq.Pauli', 'identity.IdentityGate']
70     ) -> Tuple[complex, Union['cirq.Pauli', 'identity.IdentityGate']]:
71         if self == other:
72             return 1, identity.I
73         if other is identity.I:
74             return 1, self
75         return 1j ** cast(Pauli, other).relative_index(self), self.third(cast(Pauli, other))
76 
77     def __gt__(self, other):
78         if not isinstance(other, Pauli):
79             return NotImplemented
80         return (self._index - other._index) % 3 == 1
81 
82     def __lt__(self, other):
83         if not isinstance(other, Pauli):
84             return NotImplemented
85         return (other._index - self._index) % 3 == 1
86 
87     def on(self, *qubits: 'cirq.Qid') -> 'SingleQubitPauliStringGateOperation':
88         """Returns an application of this gate to the given qubits.
89 
90         Args:
91             *qubits: The collection of qubits to potentially apply the gate to.
92         """
93         if len(qubits) != 1:
94             raise ValueError(f'Expected a single qubit, got <{qubits!r}>.')
95         from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation
96 
97         return SingleQubitPauliStringGateOperation(self, qubits[0])
98 
99     @property
100     def _canonical_exponent(self):
101         """Overrides EigenGate._canonical_exponent in subclasses."""
102         return 1
103 
104 
105 class _PauliX(Pauli, common_gates.XPowGate):
106     def __init__(self):
107         Pauli.__init__(self, index=0, name='X')
108         common_gates.XPowGate.__init__(self, exponent=1.0)
109 
110     def __pow__(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:
111         return common_gates.XPowGate(exponent=exponent)
112 
113     def _with_exponent(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:
114         return self.__pow__(exponent)
115 
116     @classmethod
117     def _from_json_dict_(cls, exponent, global_shift, **kwargs):
118         assert global_shift == 0
119         assert exponent == 1
120         return Pauli._XYZ[0]
121 
122     @property
123     def basis(self: '_PauliX') -> Dict[int, '_XEigenState']:
124         from cirq.value.product_state import _XEigenState
125 
126         return {
127             +1: _XEigenState(+1),
128             -1: _XEigenState(-1),
129         }
130 
131 
132 class _PauliY(Pauli, common_gates.YPowGate):
133     def __init__(self):
134         Pauli.__init__(self, index=1, name='Y')
135         common_gates.YPowGate.__init__(self, exponent=1.0)
136 
137     def __pow__(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:
138         return common_gates.YPowGate(exponent=exponent)
139 
140     def _with_exponent(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:
141         return self.__pow__(exponent)
142 
143     @classmethod
144     def _from_json_dict_(cls, exponent, global_shift, **kwargs):
145         assert global_shift == 0
146         assert exponent == 1
147         return Pauli._XYZ[1]
148 
149     @property
150     def basis(self: '_PauliY') -> Dict[int, '_YEigenState']:
151         from cirq.value.product_state import _YEigenState
152 
153         return {
154             +1: _YEigenState(+1),
155             -1: _YEigenState(-1),
156         }
157 
158 
159 class _PauliZ(Pauli, common_gates.ZPowGate):
160     def __init__(self):
161         Pauli.__init__(self, index=2, name='Z')
162         common_gates.ZPowGate.__init__(self, exponent=1.0)
163 
164     def __pow__(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:
165         return common_gates.ZPowGate(exponent=exponent)
166 
167     def _with_exponent(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:
168         return self.__pow__(exponent)
169 
170     @classmethod
171     def _from_json_dict_(cls, exponent, global_shift, **kwargs):
172         assert global_shift == 0
173         assert exponent == 1
174         return Pauli._XYZ[2]
175 
176     @property
177     def basis(self: '_PauliZ') -> Dict[int, '_ZEigenState']:
178         from cirq.value.product_state import _ZEigenState
179 
180         return {
181             +1: _ZEigenState(+1),
182             -1: _ZEigenState(-1),
183         }
184 
185 
186 X = _PauliX()
187 document(
188     X,
189     """The Pauli X gate.
190 
191     Matrix:
192 
193         [[0, 1],
194          [1, 0]]
195     """,
196 )
197 
198 Y = _PauliY()
199 document(
200     Y,
201     """The Pauli Y gate.
202 
203     Matrix:
204 
205         [[0, -i],
206          [i, 0]]
207     """,
208 )
209 
210 Z = _PauliZ()
211 document(
212     Z,
213     """The Pauli Z gate.
214 
215     Matrix:
216 
217         [[1, 0],
218          [0, -1]]
219     """,
220 )
221 
222 Pauli._XYZ = (X, Y, Z)
223
```
--- 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-core/cirq/ops/pauli_gates.py b/cirq-core/cirq/ops/pauli_gates.py
--- a/cirq-core/cirq/ops/pauli_gates.py
+++ b/cirq-core/cirq/ops/pauli_gates.py
@@ -108,7 +108,7 @@
         common_gates.XPowGate.__init__(self, exponent=1.0)
 
     def __pow__(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:
-        return common_gates.XPowGate(exponent=exponent)
+        return common_gates.XPowGate(exponent=exponent) if exponent != 1 else _PauliX()
 
     def _with_exponent(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:
         return self.__pow__(exponent)
@@ -135,7 +135,7 @@
         common_gates.YPowGate.__init__(self, exponent=1.0)
 
     def __pow__(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:
-        return common_gates.YPowGate(exponent=exponent)
+        return common_gates.YPowGate(exponent=exponent) if exponent != 1 else _PauliY()
 
     def _with_exponent(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:
         return self.__pow__(exponent)
@@ -162,7 +162,7 @@
         common_gates.ZPowGate.__init__(self, exponent=1.0)
 
     def __pow__(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:
-        return common_gates.ZPowGate(exponent=exponent)
+        return common_gates.ZPowGate(exponent=exponent) if exponent != 1 else _PauliZ()
 
     def _with_exponent(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:
         return self.__pow__(exponent)

{"golden_diff": "diff --git a/cirq-core/cirq/ops/pauli_gates.py b/cirq-core/cirq/ops/pauli_gates.py\n--- a/cirq-core/cirq/ops/pauli_gates.py\n+++ b/cirq-core/cirq/ops/pauli_gates.py\n@@ -108,7 +108,7 @@\n         common_gates.XPowGate.__init__(self, exponent=1.0)\n \n     def __pow__(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n-        return common_gates.XPowGate(exponent=exponent)\n+        return common_gates.XPowGate(exponent=exponent) if exponent != 1 else _PauliX()\n \n     def _with_exponent(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n         return self.__pow__(exponent)\n@@ -135,7 +135,7 @@\n         common_gates.YPowGate.__init__(self, exponent=1.0)\n \n     def __pow__(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n-        return common_gates.YPowGate(exponent=exponent)\n+        return common_gates.YPowGate(exponent=exponent) if exponent != 1 else _PauliY()\n \n     def _with_exponent(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n         return self.__pow__(exponent)\n@@ -162,7 +162,7 @@\n         common_gates.ZPowGate.__init__(self, exponent=1.0)\n \n     def __pow__(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n-        return common_gates.ZPowGate(exponent=exponent)\n+        return common_gates.ZPowGate(exponent=exponent) if exponent != 1 else _PauliZ()\n \n     def _with_exponent(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n         return self.__pow__(exponent)\n", "issue": "`cirq.X**1` should be `_PauliX` instead of `XPowGate`\n**Description of the issue**\r\n\r\nAs @ybc1991 pointed out - the type of `cirq.X**1` should be `_PauliX` instead of `XPowGate`. Context: https://github.com/quantumlib/Cirq/pull/4165/files#r646844399. \r\n\r\nDiscussed on Cirq Cynque on June 9th 2021:\r\n- We should just fix this \r\n- That would make the output type value-dependent. -- that is true, but it should be fine this direction, because _PauliX is a subclass of the XPowGate\r\n\r\n\r\n**How to reproduce the issue**\r\n\r\n```\r\nprint(type(cirq.X), type(cirq.X**1))\r\n# Prints:\r\n# <class 'cirq.ops.pauli_gates._PauliX'> <class 'cirq.ops.common_gates.XPowGate'>\r\n```\r\n\n", "before_files": [{"content": "# Copyright 2018 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.\nimport abc\nfrom typing import Any, cast, Tuple, TYPE_CHECKING, Union, Dict\n\nfrom cirq._doc import document\nfrom cirq.ops import common_gates, raw_types, identity\nfrom cirq.type_workarounds import NotImplementedType\n\n\nif TYPE_CHECKING:\n    import cirq\n    from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation\n    from cirq.value.product_state import (\n        _XEigenState,\n        _YEigenState,\n        _ZEigenState,\n    )  # coverage: ignore\n\n\nclass Pauli(raw_types.Gate, metaclass=abc.ABCMeta):\n    \"\"\"Represents the Pauli gates.\n\n    This is an abstract class with no public subclasses. The only instances\n    of private subclasses are the X, Y, or Z Pauli gates defined below.\n    \"\"\"\n\n    _XYZ = None  # type: Tuple[Pauli, Pauli, Pauli]\n\n    @staticmethod\n    def by_index(index: int) -> 'Pauli':\n        return Pauli._XYZ[index % 3]\n\n    @staticmethod\n    def by_relative_index(p: 'Pauli', relative_index: int) -> 'Pauli':\n        return Pauli._XYZ[(p._index + relative_index) % 3]\n\n    def __init__(self, index: int, name: str) -> None:\n        self._index = index\n        self._name = name\n\n    def num_qubits(self):\n        return 1\n\n    def _commutes_(self, other: Any, atol: float) -> Union[bool, NotImplementedType, None]:\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return self is other\n\n    def third(self, second: 'Pauli') -> 'Pauli':\n        return Pauli._XYZ[(-self._index - second._index) % 3]\n\n    def relative_index(self, second: 'Pauli') -> int:\n        \"\"\"Relative index of self w.r.t. second in the (X, Y, Z) cycle.\"\"\"\n        return (self._index - second._index + 1) % 3 - 1\n\n    def phased_pauli_product(\n        self, other: Union['cirq.Pauli', 'identity.IdentityGate']\n    ) -> Tuple[complex, Union['cirq.Pauli', 'identity.IdentityGate']]:\n        if self == other:\n            return 1, identity.I\n        if other is identity.I:\n            return 1, self\n        return 1j ** cast(Pauli, other).relative_index(self), self.third(cast(Pauli, other))\n\n    def __gt__(self, other):\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return (self._index - other._index) % 3 == 1\n\n    def __lt__(self, other):\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return (other._index - self._index) % 3 == 1\n\n    def on(self, *qubits: 'cirq.Qid') -> 'SingleQubitPauliStringGateOperation':\n        \"\"\"Returns an application of this gate to the given qubits.\n\n        Args:\n            *qubits: The collection of qubits to potentially apply the gate to.\n        \"\"\"\n        if len(qubits) != 1:\n            raise ValueError(f'Expected a single qubit, got <{qubits!r}>.')\n        from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation\n\n        return SingleQubitPauliStringGateOperation(self, qubits[0])\n\n    @property\n    def _canonical_exponent(self):\n        \"\"\"Overrides EigenGate._canonical_exponent in subclasses.\"\"\"\n        return 1\n\n\nclass _PauliX(Pauli, common_gates.XPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=0, name='X')\n        common_gates.XPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n        return common_gates.XPowGate(exponent=exponent)\n\n    def _with_exponent(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[0]\n\n    @property\n    def basis(self: '_PauliX') -> Dict[int, '_XEigenState']:\n        from cirq.value.product_state import _XEigenState\n\n        return {\n            +1: _XEigenState(+1),\n            -1: _XEigenState(-1),\n        }\n\n\nclass _PauliY(Pauli, common_gates.YPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=1, name='Y')\n        common_gates.YPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n        return common_gates.YPowGate(exponent=exponent)\n\n    def _with_exponent(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[1]\n\n    @property\n    def basis(self: '_PauliY') -> Dict[int, '_YEigenState']:\n        from cirq.value.product_state import _YEigenState\n\n        return {\n            +1: _YEigenState(+1),\n            -1: _YEigenState(-1),\n        }\n\n\nclass _PauliZ(Pauli, common_gates.ZPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=2, name='Z')\n        common_gates.ZPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n        return common_gates.ZPowGate(exponent=exponent)\n\n    def _with_exponent(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[2]\n\n    @property\n    def basis(self: '_PauliZ') -> Dict[int, '_ZEigenState']:\n        from cirq.value.product_state import _ZEigenState\n\n        return {\n            +1: _ZEigenState(+1),\n            -1: _ZEigenState(-1),\n        }\n\n\nX = _PauliX()\ndocument(\n    X,\n    \"\"\"The Pauli X gate.\n\n    Matrix:\n\n        [[0, 1],\n         [1, 0]]\n    \"\"\",\n)\n\nY = _PauliY()\ndocument(\n    Y,\n    \"\"\"The Pauli Y gate.\n\n    Matrix:\n\n        [[0, -i],\n         [i, 0]]\n    \"\"\",\n)\n\nZ = _PauliZ()\ndocument(\n    Z,\n    \"\"\"The Pauli Z gate.\n\n    Matrix:\n\n        [[1, 0],\n         [0, -1]]\n    \"\"\",\n)\n\nPauli._XYZ = (X, Y, Z)\n", "path": "cirq-core/cirq/ops/pauli_gates.py"}], "after_files": [{"content": "# Copyright 2018 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.\nimport abc\nfrom typing import Any, cast, Tuple, TYPE_CHECKING, Union, Dict\n\nfrom cirq._doc import document\nfrom cirq.ops import common_gates, raw_types, identity\nfrom cirq.type_workarounds import NotImplementedType\n\n\nif TYPE_CHECKING:\n    import cirq\n    from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation\n    from cirq.value.product_state import (\n        _XEigenState,\n        _YEigenState,\n        _ZEigenState,\n    )  # coverage: ignore\n\n\nclass Pauli(raw_types.Gate, metaclass=abc.ABCMeta):\n    \"\"\"Represents the Pauli gates.\n\n    This is an abstract class with no public subclasses. The only instances\n    of private subclasses are the X, Y, or Z Pauli gates defined below.\n    \"\"\"\n\n    _XYZ = None  # type: Tuple[Pauli, Pauli, Pauli]\n\n    @staticmethod\n    def by_index(index: int) -> 'Pauli':\n        return Pauli._XYZ[index % 3]\n\n    @staticmethod\n    def by_relative_index(p: 'Pauli', relative_index: int) -> 'Pauli':\n        return Pauli._XYZ[(p._index + relative_index) % 3]\n\n    def __init__(self, index: int, name: str) -> None:\n        self._index = index\n        self._name = name\n\n    def num_qubits(self):\n        return 1\n\n    def _commutes_(self, other: Any, atol: float) -> Union[bool, NotImplementedType, None]:\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return self is other\n\n    def third(self, second: 'Pauli') -> 'Pauli':\n        return Pauli._XYZ[(-self._index - second._index) % 3]\n\n    def relative_index(self, second: 'Pauli') -> int:\n        \"\"\"Relative index of self w.r.t. second in the (X, Y, Z) cycle.\"\"\"\n        return (self._index - second._index + 1) % 3 - 1\n\n    def phased_pauli_product(\n        self, other: Union['cirq.Pauli', 'identity.IdentityGate']\n    ) -> Tuple[complex, Union['cirq.Pauli', 'identity.IdentityGate']]:\n        if self == other:\n            return 1, identity.I\n        if other is identity.I:\n            return 1, self\n        return 1j ** cast(Pauli, other).relative_index(self), self.third(cast(Pauli, other))\n\n    def __gt__(self, other):\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return (self._index - other._index) % 3 == 1\n\n    def __lt__(self, other):\n        if not isinstance(other, Pauli):\n            return NotImplemented\n        return (other._index - self._index) % 3 == 1\n\n    def on(self, *qubits: 'cirq.Qid') -> 'SingleQubitPauliStringGateOperation':\n        \"\"\"Returns an application of this gate to the given qubits.\n\n        Args:\n            *qubits: The collection of qubits to potentially apply the gate to.\n        \"\"\"\n        if len(qubits) != 1:\n            raise ValueError(f'Expected a single qubit, got <{qubits!r}>.')\n        from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation\n\n        return SingleQubitPauliStringGateOperation(self, qubits[0])\n\n    @property\n    def _canonical_exponent(self):\n        \"\"\"Overrides EigenGate._canonical_exponent in subclasses.\"\"\"\n        return 1\n\n\nclass _PauliX(Pauli, common_gates.XPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=0, name='X')\n        common_gates.XPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n        return common_gates.XPowGate(exponent=exponent) if exponent != 1 else _PauliX()\n\n    def _with_exponent(self: '_PauliX', exponent: 'cirq.TParamVal') -> common_gates.XPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[0]\n\n    @property\n    def basis(self: '_PauliX') -> Dict[int, '_XEigenState']:\n        from cirq.value.product_state import _XEigenState\n\n        return {\n            +1: _XEigenState(+1),\n            -1: _XEigenState(-1),\n        }\n\n\nclass _PauliY(Pauli, common_gates.YPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=1, name='Y')\n        common_gates.YPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n        return common_gates.YPowGate(exponent=exponent) if exponent != 1 else _PauliY()\n\n    def _with_exponent(self: '_PauliY', exponent: 'cirq.TParamVal') -> common_gates.YPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[1]\n\n    @property\n    def basis(self: '_PauliY') -> Dict[int, '_YEigenState']:\n        from cirq.value.product_state import _YEigenState\n\n        return {\n            +1: _YEigenState(+1),\n            -1: _YEigenState(-1),\n        }\n\n\nclass _PauliZ(Pauli, common_gates.ZPowGate):\n    def __init__(self):\n        Pauli.__init__(self, index=2, name='Z')\n        common_gates.ZPowGate.__init__(self, exponent=1.0)\n\n    def __pow__(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n        return common_gates.ZPowGate(exponent=exponent) if exponent != 1 else _PauliZ()\n\n    def _with_exponent(self: '_PauliZ', exponent: 'cirq.TParamVal') -> common_gates.ZPowGate:\n        return self.__pow__(exponent)\n\n    @classmethod\n    def _from_json_dict_(cls, exponent, global_shift, **kwargs):\n        assert global_shift == 0\n        assert exponent == 1\n        return Pauli._XYZ[2]\n\n    @property\n    def basis(self: '_PauliZ') -> Dict[int, '_ZEigenState']:\n        from cirq.value.product_state import _ZEigenState\n\n        return {\n            +1: _ZEigenState(+1),\n            -1: _ZEigenState(-1),\n        }\n\n\nX = _PauliX()\ndocument(\n    X,\n    \"\"\"The Pauli X gate.\n\n    Matrix:\n\n        [[0, 1],\n         [1, 0]]\n    \"\"\",\n)\n\nY = _PauliY()\ndocument(\n    Y,\n    \"\"\"The Pauli Y gate.\n\n    Matrix:\n\n        [[0, -i],\n         [i, 0]]\n    \"\"\",\n)\n\nZ = _PauliZ()\ndocument(\n    Z,\n    \"\"\"The Pauli Z gate.\n\n    Matrix:\n\n        [[1, 0],\n         [0, -1]]\n    \"\"\",\n)\n\nPauli._XYZ = (X, Y, Z)\n", "path": "cirq-core/cirq/ops/pauli_gates.py"}]}