@@ -54,7 +54,7 @@ from typing import ( # noqa: Y027
54
54
overload ,
55
55
type_check_only ,
56
56
)
57
- from typing_extensions import Literal , LiteralString , SupportsIndex , TypeAlias , TypeGuard , final
57
+ from typing_extensions import Literal , SupportsIndex , TypeAlias , TypeGuard , final
58
58
59
59
if sys .version_info >= (3 , 9 ):
60
60
from types import GenericAlias
@@ -413,38 +413,20 @@ class str(Sequence[str]):
413
413
def __new__ (cls : type [Self ], object : object = ...) -> Self : ...
414
414
@overload
415
415
def __new__ (cls : type [Self ], object : ReadableBuffer , encoding : str = ..., errors : str = ...) -> Self : ...
416
- @overload
417
- def capitalize (self : LiteralString ) -> LiteralString : ...
418
- @overload
419
416
def capitalize (self ) -> str : ... # type: ignore[misc]
420
- @overload
421
- def casefold (self : LiteralString ) -> LiteralString : ...
422
- @overload
423
417
def casefold (self ) -> str : ... # type: ignore[misc]
424
- @overload
425
- def center (self : LiteralString , __width : SupportsIndex , __fillchar : LiteralString = ...) -> LiteralString : ...
426
- @overload
427
418
def center (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ... # type: ignore[misc]
428
419
def count (self , x : str , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...) -> int : ...
429
420
def encode (self , encoding : str = ..., errors : str = ...) -> bytes : ...
430
421
def endswith (
431
422
self , __suffix : str | tuple [str , ...], __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
432
423
) -> bool : ...
433
424
if sys .version_info >= (3 , 8 ):
434
- @overload
435
- def expandtabs (self : LiteralString , tabsize : SupportsIndex = ...) -> LiteralString : ...
436
- @overload
437
425
def expandtabs (self , tabsize : SupportsIndex = ...) -> str : ... # type: ignore[misc]
438
426
else :
439
- @overload
440
- def expandtabs (self : LiteralString , tabsize : int = ...) -> LiteralString : ...
441
- @overload
442
427
def expandtabs (self , tabsize : int = ...) -> str : ... # type: ignore[misc]
443
428
444
429
def find (self , __sub : str , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...) -> int : ...
445
- @overload
446
- def format (self : LiteralString , * args : LiteralString , ** kwargs : LiteralString ) -> LiteralString : ...
447
- @overload
448
430
def format (self , * args : object , ** kwargs : object ) -> str : ... # type: ignore[misc]
449
431
def format_map (self , map : _FormatMapMapping ) -> str : ...
450
432
def index (self , __sub : str , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...) -> int : ...
@@ -460,127 +442,53 @@ class str(Sequence[str]):
460
442
def isspace (self ) -> bool : ...
461
443
def istitle (self ) -> bool : ...
462
444
def isupper (self ) -> bool : ...
463
- @overload
464
- def join (self : LiteralString , __iterable : Iterable [LiteralString ]) -> LiteralString : ...
465
- @overload
466
445
def join (self , __iterable : Iterable [str ]) -> str : ... # type: ignore[misc]
467
- @overload
468
- def ljust (self : LiteralString , __width : SupportsIndex , __fillchar : LiteralString = ...) -> LiteralString : ...
469
- @overload
470
446
def ljust (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ... # type: ignore[misc]
471
- @overload
472
- def lower (self : LiteralString ) -> LiteralString : ...
473
- @overload
474
447
def lower (self ) -> str : ... # type: ignore[misc]
475
- @overload
476
- def lstrip (self : LiteralString , __chars : LiteralString | None = ...) -> LiteralString : ...
477
- @overload
478
448
def lstrip (self , __chars : str | None = ...) -> str : ... # type: ignore[misc]
479
- @overload
480
- def partition (self : LiteralString , __sep : LiteralString ) -> tuple [LiteralString , LiteralString , LiteralString ]: ...
481
- @overload
482
449
def partition (self , __sep : str ) -> tuple [str , str , str ]: ... # type: ignore[misc]
483
- @overload
484
- def replace (
485
- self : LiteralString , __old : LiteralString , __new : LiteralString , __count : SupportsIndex = ...
486
- ) -> LiteralString : ...
487
- @overload
488
450
def replace (self , __old : str , __new : str , __count : SupportsIndex = ...) -> str : ... # type: ignore[misc]
489
451
if sys .version_info >= (3 , 9 ):
490
- @overload
491
- def removeprefix (self : LiteralString , __prefix : LiteralString ) -> LiteralString : ...
492
- @overload
493
452
def removeprefix (self , __prefix : str ) -> str : ... # type: ignore[misc]
494
- @overload
495
- def removesuffix (self : LiteralString , __suffix : LiteralString ) -> LiteralString : ...
496
- @overload
497
453
def removesuffix (self , __suffix : str ) -> str : ... # type: ignore[misc]
498
454
499
455
def rfind (self , __sub : str , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...) -> int : ...
500
456
def rindex (self , __sub : str , __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...) -> int : ...
501
- @overload
502
- def rjust (self : LiteralString , __width : SupportsIndex , __fillchar : LiteralString = ...) -> LiteralString : ...
503
- @overload
504
457
def rjust (self , __width : SupportsIndex , __fillchar : str = ...) -> str : ... # type: ignore[misc]
505
- @overload
506
- def rpartition (self : LiteralString , __sep : LiteralString ) -> tuple [LiteralString , LiteralString , LiteralString ]: ...
507
- @overload
508
458
def rpartition (self , __sep : str ) -> tuple [str , str , str ]: ... # type: ignore[misc]
509
- @overload
510
- def rsplit (self : LiteralString , sep : LiteralString | None = ..., maxsplit : SupportsIndex = ...) -> list [LiteralString ]: ...
511
- @overload
512
459
def rsplit (self , sep : str | None = ..., maxsplit : SupportsIndex = ...) -> list [str ]: ... # type: ignore[misc]
513
- @overload
514
- def rstrip (self : LiteralString , __chars : LiteralString | None = ...) -> LiteralString : ...
515
- @overload
516
460
def rstrip (self , __chars : str | None = ...) -> str : ... # type: ignore[misc]
517
- @overload
518
- def split (self : LiteralString , sep : LiteralString | None = ..., maxsplit : SupportsIndex = ...) -> list [LiteralString ]: ...
519
- @overload
520
461
def split (self , sep : str | None = ..., maxsplit : SupportsIndex = ...) -> list [str ]: ... # type: ignore[misc]
521
- @overload
522
- def splitlines (self : LiteralString , keepends : bool = ...) -> list [LiteralString ]: ...
523
- @overload
524
462
def splitlines (self , keepends : bool = ...) -> list [str ]: ... # type: ignore[misc]
525
463
def startswith (
526
464
self , __prefix : str | tuple [str , ...], __start : SupportsIndex | None = ..., __end : SupportsIndex | None = ...
527
465
) -> bool : ...
528
- @overload
529
- def strip (self : LiteralString , __chars : LiteralString | None = ...) -> LiteralString : ...
530
- @overload
531
466
def strip (self , __chars : str | None = ...) -> str : ... # type: ignore[misc]
532
- @overload
533
- def swapcase (self : LiteralString ) -> LiteralString : ...
534
- @overload
535
467
def swapcase (self ) -> str : ... # type: ignore[misc]
536
- @overload
537
- def title (self : LiteralString ) -> LiteralString : ...
538
- @overload
539
468
def title (self ) -> str : ... # type: ignore[misc]
540
469
def translate (self , __table : _TranslateTable ) -> str : ...
541
- @overload
542
- def upper (self : LiteralString ) -> LiteralString : ...
543
- @overload
544
470
def upper (self ) -> str : ... # type: ignore[misc]
545
- @overload
546
- def zfill (self : LiteralString , __width : SupportsIndex ) -> LiteralString : ...
547
- @overload
548
471
def zfill (self , __width : SupportsIndex ) -> str : ... # type: ignore[misc]
549
472
@staticmethod
550
473
@overload
551
474
def maketrans (__x : dict [int , _T ] | dict [str , _T ] | dict [str | int , _T ]) -> dict [int , _T ]: ...
552
475
@staticmethod
553
476
@overload
554
477
def maketrans (__x : str , __y : str , __z : str | None = ...) -> dict [int , int | None ]: ...
555
- @overload
556
- def __add__ (self : LiteralString , __s : LiteralString ) -> LiteralString : ...
557
- @overload
558
478
def __add__ (self , __s : str ) -> str : ... # type: ignore[misc]
559
479
# Incompatible with Sequence.__contains__
560
480
def __contains__ (self , __o : str ) -> bool : ... # type: ignore[override]
561
481
def __eq__ (self , __x : object ) -> bool : ...
562
482
def __ge__ (self , __x : str ) -> bool : ...
563
483
def __getitem__ (self , __i : SupportsIndex | slice ) -> str : ...
564
484
def __gt__ (self , __x : str ) -> bool : ...
565
- @overload
566
- def __iter__ (self : LiteralString ) -> Iterator [LiteralString ]: ...
567
- @overload
568
485
def __iter__ (self ) -> Iterator [str ]: ... # type: ignore[misc]
569
486
def __le__ (self , __x : str ) -> bool : ...
570
487
def __len__ (self ) -> int : ...
571
488
def __lt__ (self , __x : str ) -> bool : ...
572
- @overload
573
- def __mod__ (self : LiteralString , __x : LiteralString | tuple [LiteralString , ...]) -> LiteralString : ...
574
- @overload
575
489
def __mod__ (self , __x : Any ) -> str : ... # type: ignore[misc]
576
- @overload
577
- def __mul__ (self : LiteralString , __n : SupportsIndex ) -> LiteralString : ...
578
- @overload
579
490
def __mul__ (self , __n : SupportsIndex ) -> str : ... # type: ignore[misc]
580
491
def __ne__ (self , __x : object ) -> bool : ...
581
- @overload
582
- def __rmul__ (self : LiteralString , __n : SupportsIndex ) -> LiteralString : ...
583
- @overload
584
492
def __rmul__ (self , __n : SupportsIndex ) -> str : ... # type: ignore[misc]
585
493
def __getnewargs__ (self ) -> tuple [str ]: ...
586
494
0 commit comments