Skip to content

Commit

Permalink
builtins.pow: improve annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jan 22, 2020
1 parent 8b241b5 commit 2a40d39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,16 @@ 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: Optional[int] = ...) -> int: ...
@overload
def pow(base: float, exp: float, mod: None = ...) -> float: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: Optional[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
18 changes: 10 additions & 8 deletions stdlib/2and3/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,16 @@ 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: Optional[int] = ...) -> int: ...
@overload
def pow(base: float, exp: float, mod: None = ...) -> float: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: Optional[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

0 comments on commit 2a40d39

Please sign in to comment.