@@ -108,7 +108,7 @@ def __init__(self):
108
108
common_gates .XPowGate .__init__ (self , exponent = 1.0 )
109
109
110
110
def __pow__ (self : '_PauliX' , exponent : 'cirq.TParamVal' ) -> common_gates .XPowGate :
111
- return common_gates .XPowGate (exponent = exponent )
111
+ return common_gates .XPowGate (exponent = exponent ) if exponent != 1 else _PauliX ()
112
112
113
113
def _with_exponent (self : '_PauliX' , exponent : 'cirq.TParamVal' ) -> common_gates .XPowGate :
114
114
return self .__pow__ (exponent )
@@ -135,7 +135,7 @@ def __init__(self):
135
135
common_gates .YPowGate .__init__ (self , exponent = 1.0 )
136
136
137
137
def __pow__ (self : '_PauliY' , exponent : 'cirq.TParamVal' ) -> common_gates .YPowGate :
138
- return common_gates .YPowGate (exponent = exponent )
138
+ return common_gates .YPowGate (exponent = exponent ) if exponent != 1 else _PauliY ()
139
139
140
140
def _with_exponent (self : '_PauliY' , exponent : 'cirq.TParamVal' ) -> common_gates .YPowGate :
141
141
return self .__pow__ (exponent )
@@ -162,7 +162,7 @@ def __init__(self):
162
162
common_gates .ZPowGate .__init__ (self , exponent = 1.0 )
163
163
164
164
def __pow__ (self : '_PauliZ' , exponent : 'cirq.TParamVal' ) -> common_gates .ZPowGate :
165
- return common_gates .ZPowGate (exponent = exponent )
165
+ return common_gates .ZPowGate (exponent = exponent ) if exponent != 1 else _PauliZ ()
166
166
167
167
def _with_exponent (self : '_PauliZ' , exponent : 'cirq.TParamVal' ) -> common_gates .ZPowGate :
168
168
return self .__pow__ (exponent )
0 commit comments