Skip to content

Commit 2530747

Browse files
1 parent a75a7ae commit 2530747

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cirq/protocols/pow_protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Any, overload, TYPE_CHECKING, TypeVar, Union
15+
from typing import Any, cast, overload, TYPE_CHECKING, TypeVar, Union, Callable
1616

1717
if TYPE_CHECKING:
1818
import cirq
@@ -81,7 +81,7 @@ def pow(val: Any, exponent: Any, default: Any = RaiseTypeErrorIfNotProvided) ->
8181
TypeError: `val` doesn't have a __pow__ method (or that method returned
8282
NotImplemented) and no `default` value was specified.
8383
"""
84-
raiser = getattr(val, '__pow__', None)
84+
raiser = cast(Union[None, Callable], getattr(val, '__pow__', None))
8585
result = NotImplemented if raiser is None else raiser(exponent)
8686
if result is not NotImplemented:
8787
return result

0 commit comments

Comments
 (0)