Skip to content

Commit b4280cb

Browse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent 17c7728 commit b4280cb

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,
@@ -468,31 +467,16 @@ class str(Sequence[str]):
468467
def __new__(cls, object: object = ...) -> Self: ...
469468
@overload
470469
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
471-
@overload
472-
def capitalize(self: LiteralString) -> LiteralString: ...
473-
@overload
474470
def capitalize(self) -> str: ... # type: ignore[misc]
475-
@overload
476-
def casefold(self: LiteralString) -> LiteralString: ...
477-
@overload
478471
def casefold(self) -> str: ... # type: ignore[misc]
479-
@overload
480-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
481-
@overload
482472
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
483473
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
484474
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
485475
def endswith(
486476
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
487477
) -> bool: ...
488-
@overload
489-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
490-
@overload
491478
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
492479
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
493-
@overload
494-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
495-
@overload
496480
def format(self, *args: object, **kwargs: object) -> str: ...
497481
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
498482
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -508,98 +492,34 @@ class str(Sequence[str]):
508492
def isspace(self) -> bool: ...
509493
def istitle(self) -> bool: ...
510494
def isupper(self) -> bool: ...
511-
@overload
512-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
513-
@overload
514495
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
515-
@overload
516-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
517-
@overload
518496
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
519-
@overload
520-
def lower(self: LiteralString) -> LiteralString: ...
521-
@overload
522497
def lower(self) -> str: ... # type: ignore[misc]
523-
@overload
524-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
525-
@overload
526498
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
527-
@overload
528-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
529-
@overload
530499
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
531500
if sys.version_info >= (3, 13):
532-
@overload
533-
def replace(
534-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
535-
) -> LiteralString: ...
536-
@overload
537501
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
538502
else:
539-
@overload
540-
def replace(
541-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
542-
) -> LiteralString: ...
543-
@overload
544503
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
545504

546-
@overload
547-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
548-
@overload
549505
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
550-
@overload
551-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
552-
@overload
553506
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
554507
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
555508
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
556-
@overload
557-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
558-
@overload
559509
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
560-
@overload
561-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
562-
@overload
563510
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
564-
@overload
565-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
566-
@overload
567511
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
568-
@overload
569-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
570-
@overload
571512
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
572-
@overload
573-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
574-
@overload
575513
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
576-
@overload
577-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
578-
@overload
579514
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
580515
def startswith(
581516
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
582517
) -> bool: ...
583-
@overload
584-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
585-
@overload
586518
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
587-
@overload
588-
def swapcase(self: LiteralString) -> LiteralString: ...
589-
@overload
590519
def swapcase(self) -> str: ... # type: ignore[misc]
591-
@overload
592-
def title(self: LiteralString) -> LiteralString: ...
593-
@overload
594520
def title(self) -> str: ... # type: ignore[misc]
595521
def translate(self, table: _TranslateTable, /) -> str: ...
596-
@overload
597-
def upper(self: LiteralString) -> LiteralString: ...
598-
@overload
599522
def upper(self) -> str: ... # type: ignore[misc]
600-
@overload
601-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
602-
@overload
603523
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
604524
@staticmethod
605525
@overload
@@ -610,39 +530,21 @@ class str(Sequence[str]):
610530
@staticmethod
611531
@overload
612532
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
613-
@overload
614-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
615-
@overload
616533
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
617534
# Incompatible with Sequence.__contains__
618535
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
619536
def __eq__(self, value: object, /) -> bool: ...
620537
def __ge__(self, value: str, /) -> bool: ...
621-
@overload
622-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
623-
@overload
624-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
538+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
625539
def __gt__(self, value: str, /) -> bool: ...
626540
def __hash__(self) -> int: ...
627-
@overload
628-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
629-
@overload
630541
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
631542
def __le__(self, value: str, /) -> bool: ...
632543
def __len__(self) -> int: ...
633544
def __lt__(self, value: str, /) -> bool: ...
634-
@overload
635-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
636-
@overload
637545
def __mod__(self, value: Any, /) -> str: ...
638-
@overload
639-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
640-
@overload
641546
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
642547
def __ne__(self, value: object, /) -> bool: ...
643-
@overload
644-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
645-
@overload
646548
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
647549
def __getnewargs__(self) -> tuple[str]: ...
648550
def __format__(self, format_spec: str, /) -> str: ...

0 commit comments

Comments
 (0)