Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)

* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
Akuli
2021-05-15 15:33:39 +03:00
committed by GitHub
parent b0ef85288d
commit 17dcea4a68
106 changed files with 1539 additions and 3275 deletions

View File

@@ -1,7 +1,6 @@
# Note: these stubs are incomplete. The more complex type
# signatures are currently omitted.
import sys
from abc import ABCMeta, abstractmethod
from typing import Any, Optional, SupportsFloat, overload
@@ -12,10 +11,7 @@ class Number(metaclass=ABCMeta):
class Complex(Number):
@abstractmethod
def __complex__(self) -> complex: ...
if sys.version_info >= (3, 0):
def __bool__(self) -> bool: ...
else:
def __nonzero__(self) -> bool: ...
def __bool__(self) -> bool: ...
@property
@abstractmethod
def real(self) -> Any: ...
@@ -36,11 +32,6 @@ class Complex(Number):
def __mul__(self, other: Any) -> Any: ...
@abstractmethod
def __rmul__(self, other: Any) -> Any: ...
if sys.version_info < (3, 0):
@abstractmethod
def __div__(self, other): ...
@abstractmethod
def __rdiv__(self, other): ...
@abstractmethod
def __truediv__(self, other: Any) -> Any: ...
@abstractmethod
@@ -52,25 +43,22 @@ class Complex(Number):
def __abs__(self) -> Real: ...
def conjugate(self) -> Any: ...
def __eq__(self, other: Any) -> bool: ...
if sys.version_info < (3, 0):
def __ne__(self, other: Any) -> bool: ...
class Real(Complex, SupportsFloat):
@abstractmethod
def __float__(self) -> float: ...
@abstractmethod
def __trunc__(self) -> int: ...
if sys.version_info >= (3, 0):
@abstractmethod
def __floor__(self) -> int: ...
@abstractmethod
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
@abstractmethod
def __floor__(self) -> int: ...
@abstractmethod
def __ceil__(self) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: None = ...) -> int: ...
@abstractmethod
@overload
def __round__(self, ndigits: int) -> Any: ...
def __divmod__(self, other: Any) -> Any: ...
def __rdivmod__(self, other: Any) -> Any: ...
@abstractmethod
@@ -102,12 +90,8 @@ class Rational(Real):
def __float__(self) -> float: ...
class Integral(Rational):
if sys.version_info >= (3, 0):
@abstractmethod
def __int__(self) -> int: ...
else:
@abstractmethod
def __long__(self) -> long: ...
@abstractmethod
def __int__(self) -> int: ...
def __index__(self) -> int: ...
@abstractmethod
def __pow__(self, exponent: Any, modulus: Optional[Any] = ...) -> Any: ...