@@ -17,6 +17,11 @@ import sys
1717if sys .version_info >= (3 ,):
1818 from typing import SupportsBytes , SupportsRound
1919
20+ if sys .version_info >= (3 , 8 ):
21+ from typing import Literal
22+ else :
23+ from typing_extensions import Literal
24+
2025_T = TypeVar ('_T' )
2126_T_co = TypeVar ('_T_co' , covariant = True )
2227_KT = TypeVar ('_KT' )
@@ -29,6 +34,9 @@ _T4 = TypeVar('_T4')
2934_T5 = TypeVar ('_T5' )
3035_TT = TypeVar ('_TT' , bound = 'type' )
3136
37+ class _SupportsIndex (Protocol ):
38+ def __index__ (self ) -> int : ...
39+
3240class object :
3341 __doc__ : Optional [str ]
3442 __dict__ : Dict [str , Any ]
@@ -129,10 +137,12 @@ class super(object):
129137
130138class int :
131139 @overload
132- def __init__ (self , x : Union [Text , bytes , SupportsInt ] = ...) -> None : ...
140+ def __init__ (self , x : Union [Text , bytes , SupportsInt , _SupportsIndex ] = ...) -> None : ...
133141 @overload
134142 def __init__ (self , x : Union [Text , bytes , bytearray ], base : int ) -> None : ...
135143
144+ if sys .version_info >= (3 , 8 ):
145+ def as_integer_ratio (self ) -> Tuple [int , Literal [1 ]]: ...
136146 @property
137147 def real (self ) -> int : ...
138148 @property
@@ -209,7 +219,7 @@ class int:
209219 def __index__ (self ) -> int : ...
210220
211221class float :
212- def __init__ (self , x : Union [SupportsFloat , Text , bytes , bytearray ] = ...) -> None : ...
222+ def __init__ (self , x : Union [SupportsFloat , _SupportsIndex , Text , bytes , bytearray ] = ...) -> None : ...
213223 def as_integer_ratio (self ) -> Tuple [int , int ]: ...
214224 def hex (self ) -> str : ...
215225 def is_integer (self ) -> bool : ...
@@ -271,11 +281,9 @@ class float:
271281
272282class complex :
273283 @overload
274- def __init__ (self , re : float = ..., im : float = ...) -> None : ...
275- @overload
276- def __init__ (self , s : str ) -> None : ...
284+ def __init__ (self , real : float = ..., imag : float = ...) -> None : ...
277285 @overload
278- def __init__ (self , s : SupportsComplex ) -> None : ...
286+ def __init__ (self , real : Union [ str , SupportsComplex , _SupportsIndex ] ) -> None : ...
279287
280288 @property
281289 def real (self ) -> float : ...
@@ -987,6 +995,8 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
987995 def __setitem__ (self , k : _KT , v : _VT ) -> None : ...
988996 def __delitem__ (self , v : _KT ) -> None : ...
989997 def __iter__ (self ) -> Iterator [_KT ]: ...
998+ if sys .version_info >= (3 , 8 ):
999+ def __reversed__ (self ) -> Iterator [_KT ]: ...
9901000 def __str__ (self ) -> str : ...
9911001 __hash__ : None # type: ignore
9921002
@@ -1117,8 +1127,6 @@ if sys.version_info < (3,):
11171127if sys .version_info >= (3 ,):
11181128 def ascii (__o : object ) -> str : ...
11191129
1120- class _SupportsIndex (Protocol ):
1121- def __index__ (self ) -> int : ...
11221130def bin (__number : Union [int , _SupportsIndex ]) -> str : ...
11231131
11241132if sys .version_info >= (3 , 7 ):
0 commit comments