@@ -59,14 +59,11 @@ from typing import (
59
59
overload ,
60
60
runtime_checkable ,
61
61
)
62
- from typing_extensions import Literal
62
+ from typing_extensions import Literal , SupportsIndex
63
63
64
64
if sys .version_info >= (3 , 9 ):
65
65
from types import GenericAlias
66
66
67
- class _SupportsIndex (Protocol ):
68
- def __index__ (self ) -> int : ...
69
-
70
67
class _SupportsTrunc (Protocol ):
71
68
def __trunc__ (self ) -> int : ...
72
69
@@ -170,7 +167,7 @@ class super(object):
170
167
171
168
class int :
172
169
@overload
173
- def __new__ (cls : Type [_T ], x : Union [str , bytes , SupportsInt , _SupportsIndex , _SupportsTrunc ] = ...) -> _T : ...
170
+ def __new__ (cls : Type [_T ], x : Union [str , bytes , SupportsInt , SupportsIndex , _SupportsTrunc ] = ...) -> _T : ...
174
171
@overload
175
172
def __new__ (cls : Type [_T ], x : Union [str , bytes , bytearray ], base : int ) -> _T : ...
176
173
if sys .version_info >= (3 , 8 ):
@@ -242,7 +239,7 @@ class int:
242
239
def __index__ (self ) -> int : ...
243
240
244
241
class float :
245
- def __new__ (cls : Type [_T ], x : Union [SupportsFloat , _SupportsIndex , str , bytes , bytearray ] = ...) -> _T : ...
242
+ def __new__ (cls : Type [_T ], x : Union [SupportsFloat , SupportsIndex , str , bytes , bytearray ] = ...) -> _T : ...
246
243
def as_integer_ratio (self ) -> Tuple [int , int ]: ...
247
244
def hex (self ) -> str : ...
248
245
def is_integer (self ) -> bool : ...
@@ -299,7 +296,7 @@ class complex:
299
296
@overload
300
297
def __new__ (cls : Type [_T ], real : float = ..., imag : float = ...) -> _T : ...
301
298
@overload
302
- def __new__ (cls : Type [_T ], real : Union [str , SupportsComplex , _SupportsIndex ]) -> _T : ...
299
+ def __new__ (cls : Type [_T ], real : Union [str , SupportsComplex , SupportsIndex ]) -> _T : ...
303
300
@property
304
301
def real (self ) -> float : ...
305
302
@property
@@ -335,19 +332,19 @@ class str(Sequence[str]):
335
332
def capitalize (self ) -> str : ...
336
333
def casefold (self ) -> str : ...
337
334
def center (self , __width : int , __fillchar : str = ...) -> str : ...
338
- def count (self , x : str , __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...) -> int : ...
335
+ def count (self , x : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
339
336
def encode (self , encoding : str = ..., errors : str = ...) -> bytes : ...
340
337
def endswith (
341
338
self ,
342
339
__suffix : Union [str , Tuple [str , ...]],
343
- __start : Optional [_SupportsIndex ] = ...,
344
- __end : Optional [_SupportsIndex ] = ...,
340
+ __start : Optional [SupportsIndex ] = ...,
341
+ __end : Optional [SupportsIndex ] = ...,
345
342
) -> bool : ...
346
343
def expandtabs (self , tabsize : int = ...) -> str : ...
347
- def find (self , __sub : str , __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...) -> int : ...
344
+ def find (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
348
345
def format (self , * args : object , ** kwargs : object ) -> str : ...
349
346
def format_map (self , map : _FormatMapMapping ) -> str : ...
350
- def index (self , __sub : str , __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...) -> int : ...
347
+ def index (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
351
348
def isalnum (self ) -> bool : ...
352
349
def isalpha (self ) -> bool : ...
353
350
if sys .version_info >= (3 , 7 ):
@@ -370,8 +367,8 @@ class str(Sequence[str]):
370
367
if sys .version_info >= (3 , 9 ):
371
368
def removeprefix (self , __prefix : str ) -> str : ...
372
369
def removesuffix (self , __suffix : str ) -> str : ...
373
- def rfind (self , __sub : str , __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...) -> int : ...
374
- def rindex (self , __sub : str , __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...) -> int : ...
370
+ def rfind (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
371
+ def rindex (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
375
372
def rjust (self , __width : int , __fillchar : str = ...) -> str : ...
376
373
def rpartition (self , __sep : str ) -> Tuple [str , str , str ]: ...
377
374
def rsplit (self , sep : Optional [str ] = ..., maxsplit : int = ...) -> List [str ]: ...
@@ -381,8 +378,8 @@ class str(Sequence[str]):
381
378
def startswith (
382
379
self ,
383
380
__prefix : Union [str , Tuple [str , ...]],
384
- __start : Optional [_SupportsIndex ] = ...,
385
- __end : Optional [_SupportsIndex ] = ...,
381
+ __start : Optional [SupportsIndex ] = ...,
382
+ __end : Optional [SupportsIndex ] = ...,
386
383
) -> bool : ...
387
384
def strip (self , __chars : Optional [str ] = ...) -> str : ...
388
385
def swapcase (self ) -> str : ...
@@ -430,25 +427,25 @@ class bytes(ByteString):
430
427
def capitalize (self ) -> bytes : ...
431
428
def center (self , __width : int , __fillchar : bytes = ...) -> bytes : ...
432
429
def count (
433
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
430
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
434
431
) -> int : ...
435
432
def decode (self , encoding : str = ..., errors : str = ...) -> str : ...
436
433
def endswith (
437
434
self ,
438
435
__suffix : Union [bytes , Tuple [bytes , ...]],
439
- __start : Optional [_SupportsIndex ] = ...,
440
- __end : Optional [_SupportsIndex ] = ...,
436
+ __start : Optional [SupportsIndex ] = ...,
437
+ __end : Optional [SupportsIndex ] = ...,
441
438
) -> bool : ...
442
439
def expandtabs (self , tabsize : int = ...) -> bytes : ...
443
440
def find (
444
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
441
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
445
442
) -> int : ...
446
443
if sys .version_info >= (3 , 8 ):
447
444
def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : int = ...) -> str : ...
448
445
else :
449
446
def hex (self ) -> str : ...
450
447
def index (
451
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
448
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
452
449
) -> int : ...
453
450
def isalnum (self ) -> bool : ...
454
451
def isalpha (self ) -> bool : ...
@@ -469,10 +466,10 @@ class bytes(ByteString):
469
466
def removeprefix (self , __prefix : bytes ) -> bytes : ...
470
467
def removesuffix (self , __suffix : bytes ) -> bytes : ...
471
468
def rfind (
472
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
469
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
473
470
) -> int : ...
474
471
def rindex (
475
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
472
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
476
473
) -> int : ...
477
474
def rjust (self , __width : int , __fillchar : bytes = ...) -> bytes : ...
478
475
def rpartition (self , __sep : bytes ) -> Tuple [bytes , bytes , bytes ]: ...
@@ -483,8 +480,8 @@ class bytes(ByteString):
483
480
def startswith (
484
481
self ,
485
482
__prefix : Union [bytes , Tuple [bytes , ...]],
486
- __start : Optional [_SupportsIndex ] = ...,
487
- __end : Optional [_SupportsIndex ] = ...,
483
+ __start : Optional [SupportsIndex ] = ...,
484
+ __end : Optional [SupportsIndex ] = ...,
488
485
) -> bool : ...
489
486
def strip (self , __bytes : Optional [bytes ] = ...) -> bytes : ...
490
487
def swapcase (self ) -> bytes : ...
@@ -532,27 +529,27 @@ class bytearray(MutableSequence[int], ByteString):
532
529
def capitalize (self ) -> bytearray : ...
533
530
def center (self , __width : int , __fillchar : bytes = ...) -> bytearray : ...
534
531
def count (
535
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
532
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
536
533
) -> int : ...
537
534
def copy (self ) -> bytearray : ...
538
535
def decode (self , encoding : str = ..., errors : str = ...) -> str : ...
539
536
def endswith (
540
537
self ,
541
538
__suffix : Union [bytes , Tuple [bytes , ...]],
542
- __start : Optional [_SupportsIndex ] = ...,
543
- __end : Optional [_SupportsIndex ] = ...,
539
+ __start : Optional [SupportsIndex ] = ...,
540
+ __end : Optional [SupportsIndex ] = ...,
544
541
) -> bool : ...
545
542
def expandtabs (self , tabsize : int = ...) -> bytearray : ...
546
543
def extend (self , __iterable_of_ints : Iterable [int ]) -> None : ...
547
544
def find (
548
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
545
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
549
546
) -> int : ...
550
547
if sys .version_info >= (3 , 8 ):
551
548
def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : int = ...) -> str : ...
552
549
else :
553
550
def hex (self ) -> str : ...
554
551
def index (
555
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
552
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
556
553
) -> int : ...
557
554
def insert (self , __index : int , __item : int ) -> None : ...
558
555
def isalnum (self ) -> bool : ...
@@ -574,10 +571,10 @@ class bytearray(MutableSequence[int], ByteString):
574
571
def removesuffix (self , __suffix : bytes ) -> bytearray : ...
575
572
def replace (self , __old : bytes , __new : bytes , __count : int = ...) -> bytearray : ...
576
573
def rfind (
577
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
574
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
578
575
) -> int : ...
579
576
def rindex (
580
- self , __sub : Union [bytes , int ], __start : Optional [_SupportsIndex ] = ..., __end : Optional [_SupportsIndex ] = ...
577
+ self , __sub : Union [bytes , int ], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
581
578
) -> int : ...
582
579
def rjust (self , __width : int , __fillchar : bytes = ...) -> bytearray : ...
583
580
def rpartition (self , __sep : bytes ) -> Tuple [bytearray , bytearray , bytearray ]: ...
@@ -588,8 +585,8 @@ class bytearray(MutableSequence[int], ByteString):
588
585
def startswith (
589
586
self ,
590
587
__prefix : Union [bytes , Tuple [bytes , ...]],
591
- __start : Optional [_SupportsIndex ] = ...,
592
- __end : Optional [_SupportsIndex ] = ...,
588
+ __start : Optional [SupportsIndex ] = ...,
589
+ __end : Optional [SupportsIndex ] = ...,
593
590
) -> bool : ...
594
591
def strip (self , __bytes : Optional [bytes ] = ...) -> bytearray : ...
595
592
def swapcase (self ) -> bytearray : ...
@@ -769,14 +766,14 @@ class list(MutableSequence[_T], Generic[_T]):
769
766
def __str__ (self ) -> str : ...
770
767
__hash__ : None # type: ignore
771
768
@overload
772
- def __getitem__ (self , i : _SupportsIndex ) -> _T : ...
769
+ def __getitem__ (self , i : SupportsIndex ) -> _T : ...
773
770
@overload
774
771
def __getitem__ (self , s : slice ) -> List [_T ]: ...
775
772
@overload
776
- def __setitem__ (self , i : _SupportsIndex , o : _T ) -> None : ...
773
+ def __setitem__ (self , i : SupportsIndex , o : _T ) -> None : ...
777
774
@overload
778
775
def __setitem__ (self , s : slice , o : Iterable [_T ]) -> None : ...
779
- def __delitem__ (self , i : Union [_SupportsIndex , slice ]) -> None : ...
776
+ def __delitem__ (self , i : Union [SupportsIndex , slice ]) -> None : ...
780
777
def __add__ (self , x : List [_T ]) -> List [_T ]: ...
781
778
def __iadd__ (self : _S , x : Iterable [_T ]) -> _S : ...
782
779
def __mul__ (self , n : int ) -> List [_T ]: ...
@@ -910,16 +907,16 @@ class range(Sequence[int]):
910
907
stop : int
911
908
step : int
912
909
@overload
913
- def __init__ (self , stop : _SupportsIndex ) -> None : ...
910
+ def __init__ (self , stop : SupportsIndex ) -> None : ...
914
911
@overload
915
- def __init__ (self , start : _SupportsIndex , stop : _SupportsIndex , step : _SupportsIndex = ...) -> None : ...
912
+ def __init__ (self , start : SupportsIndex , stop : SupportsIndex , step : SupportsIndex = ...) -> None : ...
916
913
def count (self , value : int ) -> int : ...
917
914
def index (self , value : int ) -> int : ... # type: ignore
918
915
def __len__ (self ) -> int : ...
919
916
def __contains__ (self , o : object ) -> bool : ...
920
917
def __iter__ (self ) -> Iterator [int ]: ...
921
918
@overload
922
- def __getitem__ (self , i : _SupportsIndex ) -> int : ...
919
+ def __getitem__ (self , i : SupportsIndex ) -> int : ...
923
920
@overload
924
921
def __getitem__ (self , s : slice ) -> range : ...
925
922
def __repr__ (self ) -> str : ...
@@ -954,7 +951,7 @@ def abs(__x: SupportsAbs[_T]) -> _T: ...
954
951
def all (__iterable : Iterable [object ]) -> bool : ...
955
952
def any (__iterable : Iterable [object ]) -> bool : ...
956
953
def ascii (__obj : object ) -> str : ...
957
- def bin (__number : Union [int , _SupportsIndex ]) -> str : ...
954
+ def bin (__number : Union [int , SupportsIndex ]) -> str : ...
958
955
959
956
if sys .version_info >= (3 , 7 ):
960
957
def breakpoint (* args : Any , ** kws : Any ) -> None : ...
@@ -1024,7 +1021,7 @@ def globals() -> Dict[str, Any]: ...
1024
1021
def hasattr (__obj : Any , __name : str ) -> bool : ...
1025
1022
def hash (__obj : object ) -> int : ...
1026
1023
def help (* args : Any , ** kwds : Any ) -> None : ...
1027
- def hex (__number : Union [int , _SupportsIndex ]) -> str : ...
1024
+ def hex (__number : Union [int , SupportsIndex ]) -> str : ...
1028
1025
def id (__obj : object ) -> int : ...
1029
1026
def input (__prompt : Any = ...) -> str : ...
1030
1027
@overload
@@ -1114,7 +1111,7 @@ def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThanT], d
1114
1111
def next (__i : Iterator [_T ]) -> _T : ...
1115
1112
@overload
1116
1113
def next (__i : Iterator [_T ], default : _VT ) -> Union [_T , _VT ]: ...
1117
- def oct (__number : Union [int , _SupportsIndex ]) -> str : ...
1114
+ def oct (__number : Union [int , SupportsIndex ]) -> str : ...
1118
1115
1119
1116
_OpenFile = Union [AnyPath , int ]
1120
1117
_Opener = Callable [[str , int ], int ]
0 commit comments