Skip to content

Commit a6c7063

Browse files
hauntsaninjamypybot
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent 713b57f commit a6c7063

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,
@@ -478,31 +477,16 @@ class str(Sequence[str]):
478477
def __new__(cls, object: object = ...) -> Self: ...
479478
@overload
480479
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
481-
@overload
482-
def capitalize(self: LiteralString) -> LiteralString: ...
483-
@overload
484480
def capitalize(self) -> str: ... # type: ignore[misc]
485-
@overload
486-
def casefold(self: LiteralString) -> LiteralString: ...
487-
@overload
488481
def casefold(self) -> str: ... # type: ignore[misc]
489-
@overload
490-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
491-
@overload
492482
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
493483
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
494484
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
495485
def endswith(
496486
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
497487
) -> bool: ...
498-
@overload
499-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
500-
@overload
501488
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
502489
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
503-
@overload
504-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
505-
@overload
506490
def format(self, *args: object, **kwargs: object) -> str: ...
507491
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
508492
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -518,98 +502,34 @@ class str(Sequence[str]):
518502
def isspace(self) -> bool: ...
519503
def istitle(self) -> bool: ...
520504
def isupper(self) -> bool: ...
521-
@overload
522-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
523-
@overload
524505
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
525-
@overload
526-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
527-
@overload
528506
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
529-
@overload
530-
def lower(self: LiteralString) -> LiteralString: ...
531-
@overload
532507
def lower(self) -> str: ... # type: ignore[misc]
533-
@overload
534-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
535-
@overload
536508
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
537-
@overload
538-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
539-
@overload
540509
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
541510
if sys.version_info >= (3, 13):
542-
@overload
543-
def replace(
544-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
545-
) -> LiteralString: ...
546-
@overload
547511
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
548512
else:
549-
@overload
550-
def replace(
551-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
552-
) -> LiteralString: ...
553-
@overload
554513
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
555514

556-
@overload
557-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
558-
@overload
559515
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
560-
@overload
561-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
562-
@overload
563516
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
564517
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
565518
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
566-
@overload
567-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
568-
@overload
569519
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
570-
@overload
571-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
572-
@overload
573520
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
574-
@overload
575-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
576-
@overload
577521
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
578-
@overload
579-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
580-
@overload
581522
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
582-
@overload
583-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
584-
@overload
585523
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
586-
@overload
587-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
588-
@overload
589524
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
590525
def startswith(
591526
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
592527
) -> bool: ...
593-
@overload
594-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
595-
@overload
596528
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
597-
@overload
598-
def swapcase(self: LiteralString) -> LiteralString: ...
599-
@overload
600529
def swapcase(self) -> str: ... # type: ignore[misc]
601-
@overload
602-
def title(self: LiteralString) -> LiteralString: ...
603-
@overload
604530
def title(self) -> str: ... # type: ignore[misc]
605531
def translate(self, table: _TranslateTable, /) -> str: ...
606-
@overload
607-
def upper(self: LiteralString) -> LiteralString: ...
608-
@overload
609532
def upper(self) -> str: ... # type: ignore[misc]
610-
@overload
611-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
612-
@overload
613533
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
614534
@staticmethod
615535
@overload
@@ -620,39 +540,21 @@ class str(Sequence[str]):
620540
@staticmethod
621541
@overload
622542
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
623-
@overload
624-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
625-
@overload
626543
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
627544
# Incompatible with Sequence.__contains__
628545
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
629546
def __eq__(self, value: object, /) -> bool: ...
630547
def __ge__(self, value: str, /) -> bool: ...
631-
@overload
632-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
633-
@overload
634-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
548+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
635549
def __gt__(self, value: str, /) -> bool: ...
636550
def __hash__(self) -> int: ...
637-
@overload
638-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
639-
@overload
640551
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
641552
def __le__(self, value: str, /) -> bool: ...
642553
def __len__(self) -> int: ...
643554
def __lt__(self, value: str, /) -> bool: ...
644-
@overload
645-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
646-
@overload
647555
def __mod__(self, value: Any, /) -> str: ...
648-
@overload
649-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
650-
@overload
651556
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
652557
def __ne__(self, value: object, /) -> bool: ...
653-
@overload
654-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
655-
@overload
656558
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
657559
def __getnewargs__(self) -> tuple[str]: ...
658560
def __format__(self, format_spec: str, /) -> str: ...

0 commit comments

Comments
 (0)