Skip to content

Commit

Permalink
Fix raiser is not callable. (quantumlib#5155)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBroughton authored and tonybruguier committed Apr 14, 2022
1 parent dc68419 commit 286d0db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cirq-core/cirq/protocols/pow_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Any, overload, TYPE_CHECKING, TypeVar, Union
from typing import Any, cast, overload, TYPE_CHECKING, TypeVar, Union, Callable

if TYPE_CHECKING:
import cirq
Expand Down Expand Up @@ -81,7 +81,7 @@ def pow(val: Any, exponent: Any, default: Any = RaiseTypeErrorIfNotProvided) ->
TypeError: `val` doesn't have a __pow__ method (or that method returned
NotImplemented) and no `default` value was specified.
"""
raiser = getattr(val, '__pow__', None)
raiser = cast(Union[None, Callable], getattr(val, '__pow__', None))
result = NotImplemented if raiser is None else raiser(exponent)
if result is not NotImplemented:
return result
Expand Down
1 change: 1 addition & 0 deletions dev_tools/requirements/deps/format.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r flynt.txt
black==21.12b0
click<=8.0.4

0 comments on commit 286d0db

Please sign in to comment.