Skip to content
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
1 change: 1 addition & 0 deletions pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"stdlib/distutils/dist.pyi",
"stdlib/importlib/readers.pyi",
"stdlib/lib2to3/fixes/*.pyi",
"stdlib/numbers.pyi",
"stdlib/_tkinter.pyi",
"stdlib/tkinter/__init__.pyi",
"stdlib/tkinter/filedialog.pyi",
Expand Down
81 changes: 41 additions & 40 deletions stdlib/numbers.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Note: these stubs are incomplete. The more complex type
# signatures are currently omitted.

from _typeshed import Incomplete
from abc import ABCMeta, abstractmethod
from typing import Any, SupportsFloat, overload
from typing import SupportsFloat, overload

__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]

Expand All @@ -16,36 +17,36 @@ class Complex(Number):
def __bool__(self) -> bool: ...
@property
@abstractmethod
def real(self) -> Any: ...
def real(self): ...
@property
@abstractmethod
def imag(self) -> Any: ...
def imag(self): ...
@abstractmethod
def __add__(self, other: Any) -> Any: ...
def __add__(self, other): ...
@abstractmethod
def __radd__(self, other: Any) -> Any: ...
def __radd__(self, other): ...
@abstractmethod
def __neg__(self) -> Any: ...
def __neg__(self): ...
@abstractmethod
def __pos__(self) -> Any: ...
def __sub__(self, other: Any) -> Any: ...
def __rsub__(self, other: Any) -> Any: ...
def __pos__(self): ...
def __sub__(self, other): ...
def __rsub__(self, other): ...
@abstractmethod
def __mul__(self, other: Any) -> Any: ...
def __mul__(self, other): ...
@abstractmethod
def __rmul__(self, other: Any) -> Any: ...
def __rmul__(self, other): ...
@abstractmethod
def __truediv__(self, other: Any) -> Any: ...
def __truediv__(self, other): ...
@abstractmethod
def __rtruediv__(self, other: Any) -> Any: ...
def __rtruediv__(self, other): ...
@abstractmethod
def __pow__(self, exponent: Any) -> Any: ...
def __pow__(self, exponent): ...
@abstractmethod
def __rpow__(self, base: Any) -> Any: ...
def __rpow__(self, base): ...
@abstractmethod
def __abs__(self) -> Real: ...
@abstractmethod
def conjugate(self) -> Any: ...
def conjugate(self): ...
@abstractmethod
def __eq__(self, other: object) -> bool: ...

Expand All @@ -63,27 +64,27 @@ class Real(Complex, SupportsFloat):
def __round__(self, ndigits: None = None) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
def __round__(self, ndigits: int): ...
def __divmod__(self, other): ...
def __rdivmod__(self, other): ...
@abstractmethod
def __floordiv__(self, other: Any) -> int: ...
def __floordiv__(self, other) -> int: ...
@abstractmethod
def __rfloordiv__(self, other: Any) -> int: ...
def __rfloordiv__(self, other) -> int: ...
@abstractmethod
def __mod__(self, other: Any) -> Any: ...
def __mod__(self, other): ...
@abstractmethod
def __rmod__(self, other: Any) -> Any: ...
def __rmod__(self, other): ...
@abstractmethod
def __lt__(self, other: Any) -> bool: ...
def __lt__(self, other) -> bool: ...
@abstractmethod
def __le__(self, other: Any) -> bool: ...
def __le__(self, other) -> bool: ...
def __complex__(self) -> complex: ...
@property
def real(self) -> Any: ...
def real(self): ...
@property
def imag(self) -> Any: ...
def conjugate(self) -> Any: ...
def imag(self): ...
def conjugate(self): ...

class Rational(Real):
@property
Expand All @@ -99,29 +100,29 @@ class Integral(Rational):
def __int__(self) -> int: ...
def __index__(self) -> int: ...
@abstractmethod
def __pow__(self, exponent: Any, modulus: Any | None = None) -> Any: ...
def __pow__(self, exponent, modulus: Incomplete | None = None): ...
@abstractmethod
def __lshift__(self, other: Any) -> Any: ...
def __lshift__(self, other): ...
@abstractmethod
def __rlshift__(self, other: Any) -> Any: ...
def __rlshift__(self, other): ...
@abstractmethod
def __rshift__(self, other: Any) -> Any: ...
def __rshift__(self, other): ...
@abstractmethod
def __rrshift__(self, other: Any) -> Any: ...
def __rrshift__(self, other): ...
@abstractmethod
def __and__(self, other: Any) -> Any: ...
def __and__(self, other): ...
@abstractmethod
def __rand__(self, other: Any) -> Any: ...
def __rand__(self, other): ...
@abstractmethod
def __xor__(self, other: Any) -> Any: ...
def __xor__(self, other): ...
@abstractmethod
def __rxor__(self, other: Any) -> Any: ...
def __rxor__(self, other): ...
@abstractmethod
def __or__(self, other: Any) -> Any: ...
def __or__(self, other): ...
@abstractmethod
def __ror__(self, other: Any) -> Any: ...
def __ror__(self, other): ...
@abstractmethod
def __invert__(self) -> Any: ...
def __invert__(self): ...
def __float__(self) -> float: ...
@property
def numerator(self) -> int: ...
Expand Down