Skip to content

Commit 2b0f220

Browse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent cdcb45d commit 2b0f220

File tree

1 file changed

+1
-99
lines changed

1 file changed

+1
-99
lines changed

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ from typing import ( # noqa: Y022,UP035
6363
from typing_extensions import ( # noqa: Y023
6464
Concatenate,
6565
Literal,
66-
LiteralString,
6766
ParamSpec,
6867
Self,
6968
TypeAlias,
@@ -480,31 +479,16 @@ class str(Sequence[str]):
480479
def __new__(cls, object: object = "") -> Self: ...
481480
@overload
482481
def __new__(cls, object: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> Self: ...
483-
@overload
484-
def capitalize(self: LiteralString) -> LiteralString: ...
485-
@overload
486482
def capitalize(self) -> str: ... # type: ignore[misc]
487-
@overload
488-
def casefold(self: LiteralString) -> LiteralString: ...
489-
@overload
490483
def casefold(self) -> str: ... # type: ignore[misc]
491-
@overload
492-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
493-
@overload
494484
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
495485
def count(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
496486
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
497487
def endswith(
498488
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
499489
) -> bool: ...
500-
@overload
501-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
502-
@overload
503490
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
504491
def find(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
505-
@overload
506-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
507-
@overload
508492
def format(self, *args: object, **kwargs: object) -> str: ...
509493
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
510494
def index(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
@@ -520,98 +504,34 @@ class str(Sequence[str]):
520504
def isspace(self) -> bool: ...
521505
def istitle(self) -> bool: ...
522506
def isupper(self) -> bool: ...
523-
@overload
524-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
525-
@overload
526507
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
527-
@overload
528-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
529-
@overload
530508
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
531-
@overload
532-
def lower(self: LiteralString) -> LiteralString: ...
533-
@overload
534509
def lower(self) -> str: ... # type: ignore[misc]
535-
@overload
536-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
537-
@overload
538510
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
539-
@overload
540-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
541-
@overload
542511
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
543512
if sys.version_info >= (3, 13):
544-
@overload
545-
def replace(
546-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
547-
) -> LiteralString: ...
548-
@overload
549513
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
550514
else:
551-
@overload
552-
def replace(
553-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
554-
) -> LiteralString: ...
555-
@overload
556515
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
557516

558-
@overload
559-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
560-
@overload
561517
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
562-
@overload
563-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
564-
@overload
565518
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
566519
def rfind(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
567520
def rindex(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
568-
@overload
569-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
570-
@overload
571521
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
572-
@overload
573-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
574-
@overload
575522
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
576-
@overload
577-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
578-
@overload
579523
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
580-
@overload
581-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
582-
@overload
583524
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
584-
@overload
585-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
586-
@overload
587525
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
588-
@overload
589-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
590-
@overload
591526
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
592527
def startswith(
593528
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = None, end: SupportsIndex | None = None, /
594529
) -> bool: ...
595-
@overload
596-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
597-
@overload
598530
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
599-
@overload
600-
def swapcase(self: LiteralString) -> LiteralString: ...
601-
@overload
602531
def swapcase(self) -> str: ... # type: ignore[misc]
603-
@overload
604-
def title(self: LiteralString) -> LiteralString: ...
605-
@overload
606532
def title(self) -> str: ... # type: ignore[misc]
607533
def translate(self, table: _TranslateTable, /) -> str: ...
608-
@overload
609-
def upper(self: LiteralString) -> LiteralString: ...
610-
@overload
611534
def upper(self) -> str: ... # type: ignore[misc]
612-
@overload
613-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
614-
@overload
615535
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
616536
@staticmethod
617537
@overload
@@ -622,39 +542,21 @@ class str(Sequence[str]):
622542
@staticmethod
623543
@overload
624544
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
625-
@overload
626-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
627-
@overload
628545
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
629546
# Incompatible with Sequence.__contains__
630547
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
631548
def __eq__(self, value: object, /) -> bool: ...
632549
def __ge__(self, value: str, /) -> bool: ...
633-
@overload
634-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
635-
@overload
636-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
550+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
637551
def __gt__(self, value: str, /) -> bool: ...
638552
def __hash__(self) -> int: ...
639-
@overload
640-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
641-
@overload
642553
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
643554
def __le__(self, value: str, /) -> bool: ...
644555
def __len__(self) -> int: ...
645556
def __lt__(self, value: str, /) -> bool: ...
646-
@overload
647-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
648-
@overload
649557
def __mod__(self, value: Any, /) -> str: ...
650-
@overload
651-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
652-
@overload
653558
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
654559
def __ne__(self, value: object, /) -> bool: ...
655-
@overload
656-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
657-
@overload
658560
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
659561
def __getnewargs__(self) -> tuple[str]: ...
660562
def __format__(self, format_spec: str, /) -> str: ...

0 commit comments

Comments
 (0)