mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add support for __pow__ with pow() builtin (#4109)
This commit is contained in:
@@ -1416,6 +1416,12 @@ else:
|
||||
# This is only available after from __future__ import print_function.
|
||||
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
|
||||
|
||||
_E = TypeVar("_E", contravariant=True)
|
||||
_M = TypeVar("_M", contravariant=True)
|
||||
class _SupportsPow2(Protocol[_E, _T_co]):
|
||||
def __pow__(self, __other: _E) -> _T_co: ...
|
||||
class _SupportsPow3(Protocol[_E, _M, _T_co]):
|
||||
def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def pow(base: int, exp: int, mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
|
||||
@@ -1423,6 +1429,10 @@ if sys.version_info >= (3, 8):
|
||||
def pow(base: int, exp: int, mod: int) -> int: ...
|
||||
@overload
|
||||
def pow(base: float, exp: float, mod: None = ...) -> float: ...
|
||||
@overload
|
||||
def pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co: ...
|
||||
@overload
|
||||
def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
|
||||
else:
|
||||
@overload
|
||||
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
|
||||
@@ -1430,6 +1440,10 @@ else:
|
||||
def pow(__base: int, __exp: int, __mod: int) -> int: ...
|
||||
@overload
|
||||
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
|
||||
@overload
|
||||
def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
|
||||
@overload
|
||||
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
|
||||
def quit(code: object = ...) -> NoReturn: ...
|
||||
if sys.version_info < (3,):
|
||||
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
|
||||
|
||||
Reference in New Issue
Block a user