Skip to content

Commit

Permalink
Add back comments to builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Apr 19, 2022
1 parent 632a75f commit 78b9dd0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class object:
def __format__(self, __format_spec: str) -> str: ...
def __getattribute__(self, __name: str) -> Any: ...
def __sizeof__(self) -> int: ...
# return type of pickle methods is rather hard to express in the current type system
# see #6661 and https://docs.python.org/3/library/pickle.html#object.__reduce__
def __reduce__(self) -> str | tuple[Any, ...]: ...
if sys.version_info >= (3, 8):
def __reduce_ex__(self, __protocol: SupportsIndex) -> str | tuple[Any, ...]: ...
Expand Down Expand Up @@ -258,6 +260,8 @@ class int:
def __pow__(self, __x: _PositiveInteger, __modulo: None = ...) -> int: ...
@overload
def __pow__(self, __x: _NegativeInteger, __modulo: None = ...) -> float: ...
# positive x -> int; negative x -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def __pow__(self, __x: int, __modulo: None = ...) -> Any: ...
def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ...
Expand Down Expand Up @@ -313,6 +317,8 @@ class float:
def __divmod__(self, __x: float) -> tuple[float, float]: ...
@overload
def __pow__(self, __x: int, __mod: None = ...) -> float: ...
# positive x -> float; negative x -> complex
# return type must be Any as `float | complex` causes too many false-positive errors
@overload
def __pow__(self, __x: float, __mod: None = ...) -> Any: ...
def __radd__(self, __x: float) -> float: ...
Expand All @@ -322,6 +328,7 @@ class float:
def __rtruediv__(self, __x: float) -> float: ...
def __rmod__(self, __x: float) -> float: ...
def __rdivmod__(self, __x: float) -> tuple[float, float]: ...
# Returns complex if the argument is negative.
def __rpow__(self, __x: float, __mod: None = ...) -> Any: ...
def __getnewargs__(self) -> tuple[float]: ...
def __trunc__(self) -> int: ...
Expand Down Expand Up @@ -1411,10 +1418,15 @@ if sys.version_info >= (3, 8):
def pow(base: int, exp: _PositiveInteger, mod: None = ...) -> int: ... # type: ignore[misc]
@overload
def pow(base: int, exp: _NegativeInteger, mod: None = ...) -> float: ... # type: ignore[misc]
# int base & positive-int exp -> int; int base & negative-int exp -> float
# return type must be Any as `int | float` causes too many false-positive errors
@overload
def pow(base: int, exp: int, mod: None = ...) -> Any: ...
@overload
def pow(base: float, exp: int, mod: None = ...) -> float: ...
# float base & float exp could return float or complex
# return type must be Any (same as complex base, complex exp),
# as `float | complex` causes too many false-positive errors
@overload
def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = ...) -> Any: ...
@overload
Expand Down

0 comments on commit 78b9dd0

Please sign in to comment.