Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtins.pow: improve annotation #3647

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,20 @@ 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: ...

@overload
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
@overload
def pow(__x: int, __y: int, __z: int) -> Any: ...
@overload
def pow(__x: float, __y: float) -> float: ...
@overload
def pow(__x: float, __y: float, __z: float) -> float: ...
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
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: float, exp: float, mod: None = ...) -> float: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@overload
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
def quit(code: object = ...) -> NoReturn: ...
if sys.version_info < (3,):
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
Expand Down
22 changes: 14 additions & 8 deletions stdlib/2and3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,20 @@ 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: ...

@overload
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
@overload
def pow(__x: int, __y: int, __z: int) -> Any: ...
@overload
def pow(__x: float, __y: float) -> float: ...
@overload
def pow(__x: float, __y: float, __z: float) -> float: ...
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
@overload
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: float, exp: float, mod: None = ...) -> float: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@overload
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
def quit(code: object = ...) -> NoReturn: ...
if sys.version_info < (3,):
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
Expand Down