@@ -334,13 +334,16 @@ class str(Sequence[str]):
334
334
def __new__ (cls : Type [_T ], o : bytes , encoding : str = ..., errors : str = ...) -> _T : ...
335
335
def capitalize (self ) -> str : ...
336
336
def casefold (self ) -> str : ...
337
- def center (self , __width : int , __fillchar : str = ...) -> str : ...
337
+ def center (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ...
338
338
def count (self , x : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
339
339
def encode (self , encoding : str = ..., errors : str = ...) -> bytes : ...
340
340
def endswith (
341
341
self , __suffix : Union [str , Tuple [str , ...]], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
342
342
) -> bool : ...
343
- def expandtabs (self , tabsize : int = ...) -> str : ...
343
+ if sys .version_info >= (3 , 8 ):
344
+ def expandtabs (self , tabsize : SupportsIndex = ...) -> str : ...
345
+ else :
346
+ def expandtabs (self , tabsize : int = ...) -> str : ...
344
347
def find (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
345
348
def format (self , * args : object , ** kwargs : object ) -> str : ...
346
349
def format_map (self , map : _FormatMapMapping ) -> str : ...
@@ -359,21 +362,21 @@ class str(Sequence[str]):
359
362
def istitle (self ) -> bool : ...
360
363
def isupper (self ) -> bool : ...
361
364
def join (self , __iterable : Iterable [str ]) -> str : ...
362
- def ljust (self , __width : int , __fillchar : str = ...) -> str : ...
365
+ def ljust (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ...
363
366
def lower (self ) -> str : ...
364
367
def lstrip (self , __chars : Optional [str ] = ...) -> str : ...
365
368
def partition (self , __sep : str ) -> Tuple [str , str , str ]: ...
366
- def replace (self , __old : str , __new : str , __count : int = ...) -> str : ...
369
+ def replace (self , __old : str , __new : str , __count : SupportsIndex = ...) -> str : ...
367
370
if sys .version_info >= (3 , 9 ):
368
371
def removeprefix (self , __prefix : str ) -> str : ...
369
372
def removesuffix (self , __suffix : str ) -> str : ...
370
373
def rfind (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
371
374
def rindex (self , __sub : str , __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...) -> int : ...
372
- def rjust (self , __width : int , __fillchar : str = ...) -> str : ...
375
+ def rjust (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ...
373
376
def rpartition (self , __sep : str ) -> Tuple [str , str , str ]: ...
374
- def rsplit (self , sep : Optional [str ] = ..., maxsplit : int = ...) -> List [str ]: ...
377
+ def rsplit (self , sep : Optional [str ] = ..., maxsplit : SupportsIndex = ...) -> List [str ]: ...
375
378
def rstrip (self , __chars : Optional [str ] = ...) -> str : ...
376
- def split (self , sep : Optional [str ] = ..., maxsplit : int = ...) -> List [str ]: ...
379
+ def split (self , sep : Optional [str ] = ..., maxsplit : SupportsIndex = ...) -> List [str ]: ...
377
380
def splitlines (self , keepends : bool = ...) -> List [str ]: ...
378
381
def startswith (
379
382
self , __prefix : Union [str , Tuple [str , ...]], __start : Optional [SupportsIndex ] = ..., __end : Optional [SupportsIndex ] = ...
@@ -383,7 +386,7 @@ class str(Sequence[str]):
383
386
def title (self ) -> str : ...
384
387
def translate (self , __table : Union [Mapping [int , Union [int , str , None ]], Sequence [Union [int , str , None ]]]) -> str : ...
385
388
def upper (self ) -> str : ...
386
- def zfill (self , __width : int ) -> str : ...
389
+ def zfill (self , __width : SupportsIndex ) -> str : ...
387
390
@staticmethod
388
391
@overload
389
392
def maketrans (__x : Union [Dict [int , _T ], Dict [str , _T ], Dict [Union [str , int ], _T ]]) -> Dict [int , _T ]: ...
@@ -403,28 +406,28 @@ class str(Sequence[str]):
403
406
def __len__ (self ) -> int : ...
404
407
def __lt__ (self , x : str ) -> bool : ...
405
408
def __mod__ (self , x : Any ) -> str : ...
406
- def __mul__ (self , n : int ) -> str : ...
409
+ def __mul__ (self , n : SupportsIndex ) -> str : ...
407
410
def __ne__ (self , x : object ) -> bool : ...
408
411
def __repr__ (self ) -> str : ...
409
- def __rmul__ (self , n : int ) -> str : ...
412
+ def __rmul__ (self , n : SupportsIndex ) -> str : ...
410
413
def __str__ (self ) -> str : ...
411
414
def __getnewargs__ (self ) -> Tuple [str ]: ...
412
415
413
416
class bytes (ByteString ):
414
417
@overload
415
- def __new__ (cls : Type [_T ], ints : Iterable [int ]) -> _T : ...
418
+ def __new__ (cls : Type [_T ], ints : Iterable [SupportsIndex ]) -> _T : ...
416
419
@overload
417
420
def __new__ (cls : Type [_T ], string : str , encoding : str , errors : str = ...) -> _T : ...
418
421
@overload
419
- def __new__ (cls : Type [_T ], length : int ) -> _T : ...
422
+ def __new__ (cls : Type [_T ], length : SupportsIndex ) -> _T : ...
420
423
@overload
421
424
def __new__ (cls : Type [_T ]) -> _T : ...
422
425
@overload
423
426
def __new__ (cls : Type [_T ], o : SupportsBytes ) -> _T : ...
424
427
def capitalize (self ) -> bytes : ...
425
- def center (self , __width : int , __fillchar : bytes = ...) -> bytes : ...
428
+ def center (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytes : ...
426
429
def count (
427
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
430
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
428
431
) -> int : ...
429
432
def decode (self , encoding : str = ..., errors : str = ...) -> str : ...
430
433
def endswith (
@@ -433,16 +436,19 @@ class bytes(ByteString):
433
436
__start : Optional [SupportsIndex ] = ...,
434
437
__end : Optional [SupportsIndex ] = ...,
435
438
) -> bool : ...
436
- def expandtabs (self , tabsize : int = ...) -> bytes : ...
439
+ if sys .version_info >= (3 , 8 ):
440
+ def expandtabs (self , tabsize : SupportsIndex = ...) -> bytes : ...
441
+ else :
442
+ def expandtabs (self , tabsize : int = ...) -> bytes : ...
437
443
def find (
438
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
444
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
439
445
) -> int : ...
440
446
if sys .version_info >= (3 , 8 ):
441
- def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : int = ...) -> str : ...
447
+ def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : SupportsIndex = ...) -> str : ...
442
448
else :
443
449
def hex (self ) -> str : ...
444
450
def index (
445
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
451
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
446
452
) -> int : ...
447
453
def isalnum (self ) -> bool : ...
448
454
def isalpha (self ) -> bool : ...
@@ -454,25 +460,25 @@ class bytes(ByteString):
454
460
def istitle (self ) -> bool : ...
455
461
def isupper (self ) -> bool : ...
456
462
def join (self , __iterable_of_bytes : Iterable [Union [ByteString , memoryview ]]) -> bytes : ...
457
- def ljust (self , __width : int , __fillchar : bytes = ...) -> bytes : ...
463
+ def ljust (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytes : ...
458
464
def lower (self ) -> bytes : ...
459
465
def lstrip (self , __bytes : Optional [bytes ] = ...) -> bytes : ...
460
466
def partition (self , __sep : bytes ) -> Tuple [bytes , bytes , bytes ]: ...
461
- def replace (self , __old : bytes , __new : bytes , __count : int = ...) -> bytes : ...
467
+ def replace (self , __old : bytes , __new : bytes , __count : SupportsIndex = ...) -> bytes : ...
462
468
if sys .version_info >= (3 , 9 ):
463
469
def removeprefix (self , __prefix : bytes ) -> bytes : ...
464
470
def removesuffix (self , __suffix : bytes ) -> bytes : ...
465
471
def rfind (
466
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
472
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
467
473
) -> int : ...
468
474
def rindex (
469
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
475
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
470
476
) -> int : ...
471
- def rjust (self , __width : int , __fillchar : bytes = ...) -> bytes : ...
477
+ def rjust (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytes : ...
472
478
def rpartition (self , __sep : bytes ) -> Tuple [bytes , bytes , bytes ]: ...
473
- def rsplit (self , sep : Optional [bytes ] = ..., maxsplit : int = ...) -> List [bytes ]: ...
479
+ def rsplit (self , sep : Optional [bytes ] = ..., maxsplit : SupportsIndex = ...) -> List [bytes ]: ...
474
480
def rstrip (self , __bytes : Optional [bytes ] = ...) -> bytes : ...
475
- def split (self , sep : Optional [bytes ] = ..., maxsplit : int = ...) -> List [bytes ]: ...
481
+ def split (self , sep : Optional [bytes ] = ..., maxsplit : SupportsIndex = ...) -> List [bytes ]: ...
476
482
def splitlines (self , keepends : bool = ...) -> List [bytes ]: ...
477
483
def startswith (
478
484
self ,
@@ -485,7 +491,7 @@ class bytes(ByteString):
485
491
def title (self ) -> bytes : ...
486
492
def translate (self , __table : Optional [bytes ], delete : bytes = ...) -> bytes : ...
487
493
def upper (self ) -> bytes : ...
488
- def zfill (self , __width : int ) -> bytes : ...
494
+ def zfill (self , __width : SupportsIndex ) -> bytes : ...
489
495
@classmethod
490
496
def fromhex (cls , __s : str ) -> bytes : ...
491
497
@staticmethod
@@ -496,15 +502,15 @@ class bytes(ByteString):
496
502
def __repr__ (self ) -> str : ...
497
503
def __hash__ (self ) -> int : ...
498
504
@overload
499
- def __getitem__ (self , i : int ) -> int : ...
505
+ def __getitem__ (self , i : SupportsIndex ) -> int : ...
500
506
@overload
501
507
def __getitem__ (self , s : slice ) -> bytes : ...
502
508
def __add__ (self , s : bytes ) -> bytes : ...
503
- def __mul__ (self , n : int ) -> bytes : ...
504
- def __rmul__ (self , n : int ) -> bytes : ...
509
+ def __mul__ (self , n : SupportsIndex ) -> bytes : ...
510
+ def __rmul__ (self , n : SupportsIndex ) -> bytes : ...
505
511
def __mod__ (self , value : Any ) -> bytes : ...
506
512
# Incompatible with Sequence.__contains__
507
- def __contains__ (self , o : Union [ int , bytes ] ) -> bool : ... # type: ignore
513
+ def __contains__ (self , o : SupportsIndex | bytes ) -> bool : ... # type: ignore
508
514
def __eq__ (self , x : object ) -> bool : ...
509
515
def __ne__ (self , x : object ) -> bool : ...
510
516
def __lt__ (self , x : bytes ) -> bool : ...
@@ -517,16 +523,16 @@ class bytearray(MutableSequence[int], ByteString):
517
523
@overload
518
524
def __init__ (self ) -> None : ...
519
525
@overload
520
- def __init__ (self , ints : Iterable [int ]) -> None : ...
526
+ def __init__ (self , ints : Iterable [SupportsIndex ]) -> None : ...
521
527
@overload
522
528
def __init__ (self , string : str , encoding : str , errors : str = ...) -> None : ...
523
529
@overload
524
- def __init__ (self , length : int ) -> None : ...
525
- def append (self , __item : int ) -> None : ...
530
+ def __init__ (self , length : SupportsIndex ) -> None : ...
531
+ def append (self , __item : SupportsIndex ) -> None : ...
526
532
def capitalize (self ) -> bytearray : ...
527
- def center (self , __width : int , __fillchar : bytes = ...) -> bytearray : ...
533
+ def center (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytearray : ...
528
534
def count (
529
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
535
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
530
536
) -> int : ...
531
537
def copy (self ) -> bytearray : ...
532
538
def decode (self , encoding : str = ..., errors : str = ...) -> str : ...
@@ -536,19 +542,22 @@ class bytearray(MutableSequence[int], ByteString):
536
542
__start : Optional [SupportsIndex ] = ...,
537
543
__end : Optional [SupportsIndex ] = ...,
538
544
) -> bool : ...
539
- def expandtabs (self , tabsize : int = ...) -> bytearray : ...
540
- def extend (self , __iterable_of_ints : Iterable [int ]) -> None : ...
545
+ if sys .version_info >= (3 , 8 ):
546
+ def expandtabs (self , tabsize : SupportsIndex = ...) -> bytearray : ...
547
+ else :
548
+ def expandtabs (self , tabsize : int = ...) -> bytearray : ...
549
+ def extend (self , __iterable_of_ints : Iterable [SupportsIndex ]) -> None : ...
541
550
def find (
542
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
551
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
543
552
) -> int : ...
544
553
if sys .version_info >= (3 , 8 ):
545
- def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : int = ...) -> str : ...
554
+ def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : SupportsIndex = ...) -> str : ...
546
555
else :
547
556
def hex (self ) -> str : ...
548
557
def index (
549
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
558
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
550
559
) -> int : ...
551
- def insert (self , __index : int , __item : int ) -> None : ...
560
+ def insert (self , __index : SupportsIndex , __item : SupportsIndex ) -> None : ...
552
561
def isalnum (self ) -> bool : ...
553
562
def isalpha (self ) -> bool : ...
554
563
if sys .version_info >= (3 , 7 ):
@@ -559,25 +568,25 @@ class bytearray(MutableSequence[int], ByteString):
559
568
def istitle (self ) -> bool : ...
560
569
def isupper (self ) -> bool : ...
561
570
def join (self , __iterable_of_bytes : Iterable [Union [ByteString , memoryview ]]) -> bytearray : ...
562
- def ljust (self , __width : int , __fillchar : bytes = ...) -> bytearray : ...
571
+ def ljust (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytearray : ...
563
572
def lower (self ) -> bytearray : ...
564
573
def lstrip (self , __bytes : Optional [bytes ] = ...) -> bytearray : ...
565
574
def partition (self , __sep : bytes ) -> Tuple [bytearray , bytearray , bytearray ]: ...
566
575
if sys .version_info >= (3 , 9 ):
567
576
def removeprefix (self , __prefix : bytes ) -> bytearray : ...
568
577
def removesuffix (self , __suffix : bytes ) -> bytearray : ...
569
- def replace (self , __old : bytes , __new : bytes , __count : int = ...) -> bytearray : ...
578
+ def replace (self , __old : bytes , __new : bytes , __count : SupportsIndex = ...) -> bytearray : ...
570
579
def rfind (
571
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
580
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
572
581
) -> int : ...
573
582
def rindex (
574
- self , __sub : Union [ bytes , int ] , __start : Optional [ SupportsIndex ] = ..., __end : Optional [ SupportsIndex ] = ...
583
+ self , __sub : bytes | SupportsIndex , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
575
584
) -> int : ...
576
- def rjust (self , __width : int , __fillchar : bytes = ...) -> bytearray : ...
585
+ def rjust (self , __width : SupportsIndex , __fillchar : bytes = ...) -> bytearray : ...
577
586
def rpartition (self , __sep : bytes ) -> Tuple [bytearray , bytearray , bytearray ]: ...
578
- def rsplit (self , sep : Optional [bytes ] = ..., maxsplit : int = ...) -> List [bytearray ]: ...
587
+ def rsplit (self , sep : Optional [bytes ] = ..., maxsplit : SupportsIndex = ...) -> List [bytearray ]: ...
579
588
def rstrip (self , __bytes : Optional [bytes ] = ...) -> bytearray : ...
580
- def split (self , sep : Optional [bytes ] = ..., maxsplit : int = ...) -> List [bytearray ]: ...
589
+ def split (self , sep : Optional [bytes ] = ..., maxsplit : SupportsIndex = ...) -> List [bytearray ]: ...
581
590
def splitlines (self , keepends : bool = ...) -> List [bytearray ]: ...
582
591
def startswith (
583
592
self ,
@@ -590,7 +599,7 @@ class bytearray(MutableSequence[int], ByteString):
590
599
def title (self ) -> bytearray : ...
591
600
def translate (self , __table : Optional [bytes ], delete : bytes = ...) -> bytearray : ...
592
601
def upper (self ) -> bytearray : ...
593
- def zfill (self , __width : int ) -> bytearray : ...
602
+ def zfill (self , __width : SupportsIndex ) -> bytearray : ...
594
603
@classmethod
595
604
def fromhex (cls , __string : str ) -> bytearray : ...
596
605
@staticmethod
@@ -601,22 +610,22 @@ class bytearray(MutableSequence[int], ByteString):
601
610
def __repr__ (self ) -> str : ...
602
611
__hash__ : None # type: ignore
603
612
@overload
604
- def __getitem__ (self , i : int ) -> int : ...
613
+ def __getitem__ (self , i : SupportsIndex ) -> int : ...
605
614
@overload
606
615
def __getitem__ (self , s : slice ) -> bytearray : ...
607
616
@overload
608
- def __setitem__ (self , i : int , x : int ) -> None : ...
617
+ def __setitem__ (self , i : SupportsIndex , x : SupportsIndex ) -> None : ...
609
618
@overload
610
- def __setitem__ (self , s : slice , x : Union [ Iterable [int ], bytes ] ) -> None : ...
611
- def __delitem__ (self , i : Union [ int , slice ] ) -> None : ...
619
+ def __setitem__ (self , s : slice , x : Iterable [SupportsIndex ] | bytes ) -> None : ...
620
+ def __delitem__ (self , i : SupportsIndex | slice ) -> None : ...
612
621
def __add__ (self , s : bytes ) -> bytearray : ...
613
622
def __iadd__ (self , s : Iterable [int ]) -> bytearray : ...
614
- def __mul__ (self , n : int ) -> bytearray : ...
615
- def __rmul__ (self , n : int ) -> bytearray : ...
616
- def __imul__ (self , n : int ) -> bytearray : ...
623
+ def __mul__ (self , n : SupportsIndex ) -> bytearray : ...
624
+ def __rmul__ (self , n : SupportsIndex ) -> bytearray : ...
625
+ def __imul__ (self , n : SupportsIndex ) -> bytearray : ...
617
626
def __mod__ (self , value : Any ) -> bytes : ...
618
627
# Incompatible with Sequence.__contains__
619
- def __contains__ (self , o : Union [ int , bytes ] ) -> bool : ... # type: ignore
628
+ def __contains__ (self , o : SupportsIndex | bytes ) -> bool : ... # type: ignore
620
629
def __eq__ (self , x : object ) -> bool : ...
621
630
def __ne__ (self , x : object ) -> bool : ...
622
631
def __lt__ (self , x : bytes ) -> bool : ...
@@ -645,7 +654,7 @@ class memoryview(Sized, Sequence[int]):
645
654
) -> None : ...
646
655
def cast (self , format : str , shape : Union [List [int ], Tuple [int ]] = ...) -> memoryview : ...
647
656
@overload
648
- def __getitem__ (self , i : int ) -> int : ...
657
+ def __getitem__ (self , i : SupportsIndex ) -> int : ...
649
658
@overload
650
659
def __getitem__ (self , s : slice ) -> memoryview : ...
651
660
def __contains__ (self , x : object ) -> bool : ...
@@ -654,7 +663,7 @@ class memoryview(Sized, Sequence[int]):
654
663
@overload
655
664
def __setitem__ (self , s : slice , o : bytes ) -> None : ...
656
665
@overload
657
- def __setitem__ (self , i : int , o : int ) -> None : ...
666
+ def __setitem__ (self , i : SupportsIndex , o : SupportsIndex ) -> None : ...
658
667
if sys .version_info >= (3 , 8 ):
659
668
def tobytes (self , order : Optional [Literal ["C" , "F" , "A" ]] = ...) -> bytes : ...
660
669
else :
@@ -664,7 +673,7 @@ class memoryview(Sized, Sequence[int]):
664
673
def toreadonly (self ) -> memoryview : ...
665
674
def release (self ) -> None : ...
666
675
if sys .version_info >= (3 , 8 ):
667
- def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : int = ...) -> str : ...
676
+ def hex (self , sep : Union [str , bytes ] = ..., bytes_per_sep : SupportsIndex = ...) -> str : ...
668
677
else :
669
678
def hex (self ) -> str : ...
670
679
0 commit comments