Format: application/octet-stream
⬇ Download File (4.2 KB)
   1  # Note: these stubs are incomplete. The more complex type
   2  # signatures are currently omitted.
   3  
   4  import sys
   5  from abc import ABCMeta, abstractmethod
   6  from typing import Any, Optional, SupportsFloat, overload
   7  
   8  class Number(metaclass=ABCMeta):
   9      @abstractmethod
  10      def __hash__(self) -> int: ...
  11  
  12  class Complex(Number):
  13      @abstractmethod
  14      def __complex__(self) -> complex: ...
  15      if sys.version_info >= (3, 0):
  16          def __bool__(self) -> bool: ...
  17      else:
  18          def __nonzero__(self) -> bool: ...
  19      @property
  20      @abstractmethod
  21      def real(self) -> Any: ...
  22      @property
  23      @abstractmethod
  24      def imag(self) -> Any: ...
  25      @abstractmethod
  26      def __add__(self, other: Any) -> Any: ...
  27      @abstractmethod
  28      def __radd__(self, other: Any) -> Any: ...
  29      @abstractmethod
  30      def __neg__(self) -> Any: ...
  31      @abstractmethod
  32      def __pos__(self) -> Any: ...
  33      def __sub__(self, other: Any) -> Any: ...
  34      def __rsub__(self, other: Any) -> Any: ...
  35      @abstractmethod
  36      def __mul__(self, other: Any) -> Any: ...
  37      @abstractmethod
  38      def __rmul__(self, other: Any) -> Any: ...
  39      if sys.version_info < (3, 0):
  40          @abstractmethod
  41          def __div__(self, other): ...
  42          @abstractmethod
  43          def __rdiv__(self, other): ...
  44      @abstractmethod
  45      def __truediv__(self, other: Any) -> Any: ...
  46      @abstractmethod
  47      def __rtruediv__(self, other: Any) -> Any: ...
  48      @abstractmethod
  49      def __pow__(self, exponent: Any) -> Any: ...
  50      @abstractmethod
  51      def __rpow__(self, base: Any) -> Any: ...
  52      def __abs__(self) -> Real: ...
  53      def conjugate(self) -> Any: ...
  54      def __eq__(self, other: Any) -> bool: ...
  55      if sys.version_info < (3, 0):
  56          def __ne__(self, other: Any) -> bool: ...
  57  
  58  class Real(Complex, SupportsFloat):
  59      @abstractmethod
  60      def __float__(self) -> float: ...
  61      @abstractmethod
  62      def __trunc__(self) -> int: ...
  63      if sys.version_info >= (3, 0):
  64          @abstractmethod
  65          def __floor__(self) -> int: ...
  66          @abstractmethod
  67          def __ceil__(self) -> int: ...
  68          @abstractmethod
  69          @overload
  70          def __round__(self, ndigits: None = ...) -> int: ...
  71          @abstractmethod
  72          @overload
  73          def __round__(self, ndigits: int) -> Any: ...
  74      def __divmod__(self, other: Any) -> Any: ...
  75      def __rdivmod__(self, other: Any) -> Any: ...
  76      @abstractmethod
  77      def __floordiv__(self, other: Any) -> int: ...
  78      @abstractmethod
  79      def __rfloordiv__(self, other: Any) -> int: ...
  80      @abstractmethod
  81      def __mod__(self, other: Any) -> Any: ...
  82      @abstractmethod
  83      def __rmod__(self, other: Any) -> Any: ...
  84      @abstractmethod
  85      def __lt__(self, other: Any) -> bool: ...
  86      @abstractmethod
  87      def __le__(self, other: Any) -> bool: ...
  88      def __complex__(self) -> complex: ...
  89      @property
  90      def real(self) -> Any: ...
  91      @property
  92      def imag(self) -> Any: ...
  93      def conjugate(self) -> Any: ...
  94  
  95  class Rational(Real):
  96      @property
  97      @abstractmethod
  98      def numerator(self) -> int: ...
  99      @property
 100      @abstractmethod
 101      def denominator(self) -> int: ...
 102      def __float__(self) -> float: ...
 103  
 104  class Integral(Rational):
 105      if sys.version_info >= (3, 0):
 106          @abstractmethod
 107          def __int__(self) -> int: ...
 108      else:
 109          @abstractmethod
 110          def __long__(self) -> long: ...
 111      def __index__(self) -> int: ...
 112      @abstractmethod
 113      def __pow__(self, exponent: Any, modulus: Optional[Any] = ...) -> Any: ...
 114      @abstractmethod
 115      def __lshift__(self, other: Any) -> Any: ...
 116      @abstractmethod
 117      def __rlshift__(self, other: Any) -> Any: ...
 118      @abstractmethod
 119      def __rshift__(self, other: Any) -> Any: ...
 120      @abstractmethod
 121      def __rrshift__(self, other: Any) -> Any: ...
 122      @abstractmethod
 123      def __and__(self, other: Any) -> Any: ...
 124      @abstractmethod
 125      def __rand__(self, other: Any) -> Any: ...
 126      @abstractmethod
 127      def __xor__(self, other: Any) -> Any: ...
 128      @abstractmethod
 129      def __rxor__(self, other: Any) -> Any: ...
 130      @abstractmethod
 131      def __or__(self, other: Any) -> Any: ...
 132      @abstractmethod
 133      def __ror__(self, other: Any) -> Any: ...
 134      @abstractmethod
 135      def __invert__(self) -> Any: ...
 136      def __float__(self) -> float: ...
 137      @property
 138      def numerator(self) -> int: ...
 139      @property
 140      def denominator(self) -> int: ...
 141