Skip to content

Commit 67da9a0

Browse files
committed
Remove use of LiteralString in builtins (#13743)
1 parent a17ff5d commit 67da9a0

File tree

1 file changed

+1
-99
lines changed

1 file changed

+1
-99
lines changed

mypy/typeshed/stdlib/builtins.pyi

+1-99
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ from typing import ( # noqa: Y022
6262
from typing_extensions import ( # noqa: Y023
6363
Concatenate,
6464
Literal,
65-
LiteralString,
6665
ParamSpec,
6766
Self,
6867
TypeAlias,
@@ -445,31 +444,16 @@ class str(Sequence[str]):
445444
def __new__(cls, object: object = ...) -> Self: ...
446445
@overload
447446
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
448-
@overload
449-
def capitalize(self: LiteralString) -> LiteralString: ...
450-
@overload
451447
def capitalize(self) -> str: ... # type: ignore[misc]
452-
@overload
453-
def casefold(self: LiteralString) -> LiteralString: ...
454-
@overload
455448
def casefold(self) -> str: ... # type: ignore[misc]
456-
@overload
457-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
458-
@overload
459449
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
460450
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
461451
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
462452
def endswith(
463453
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
464454
) -> bool: ...
465-
@overload
466-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
467-
@overload
468455
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
469456
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
470-
@overload
471-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
472-
@overload
473457
def format(self, *args: object, **kwargs: object) -> str: ...
474458
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
475459
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -485,99 +469,35 @@ class str(Sequence[str]):
485469
def isspace(self) -> bool: ...
486470
def istitle(self) -> bool: ...
487471
def isupper(self) -> bool: ...
488-
@overload
489-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
490-
@overload
491472
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
492-
@overload
493-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
494-
@overload
495473
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
496-
@overload
497-
def lower(self: LiteralString) -> LiteralString: ...
498-
@overload
499474
def lower(self) -> str: ... # type: ignore[misc]
500-
@overload
501-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
502-
@overload
503475
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
504-
@overload
505-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
506-
@overload
507476
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
508477
if sys.version_info >= (3, 13):
509-
@overload
510-
def replace(
511-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
512-
) -> LiteralString: ...
513-
@overload
514478
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
515479
else:
516-
@overload
517-
def replace(
518-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
519-
) -> LiteralString: ...
520-
@overload
521480
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
522481
if sys.version_info >= (3, 9):
523-
@overload
524-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
525-
@overload
526482
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
527-
@overload
528-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
529-
@overload
530483
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
531484

532485
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
533486
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
534-
@overload
535-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
536-
@overload
537487
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
538-
@overload
539-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
540-
@overload
541488
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
542-
@overload
543-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
544-
@overload
545489
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
546-
@overload
547-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
548-
@overload
549490
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
550-
@overload
551-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
552-
@overload
553491
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
554-
@overload
555-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
556-
@overload
557492
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
558493
def startswith(
559494
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
560495
) -> bool: ...
561-
@overload
562-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
563-
@overload
564496
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
565-
@overload
566-
def swapcase(self: LiteralString) -> LiteralString: ...
567-
@overload
568497
def swapcase(self) -> str: ... # type: ignore[misc]
569-
@overload
570-
def title(self: LiteralString) -> LiteralString: ...
571-
@overload
572498
def title(self) -> str: ... # type: ignore[misc]
573499
def translate(self, table: _TranslateTable, /) -> str: ...
574-
@overload
575-
def upper(self: LiteralString) -> LiteralString: ...
576-
@overload
577500
def upper(self) -> str: ... # type: ignore[misc]
578-
@overload
579-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
580-
@overload
581501
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
582502
@staticmethod
583503
@overload
@@ -588,39 +508,21 @@ class str(Sequence[str]):
588508
@staticmethod
589509
@overload
590510
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
591-
@overload
592-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
593-
@overload
594511
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
595512
# Incompatible with Sequence.__contains__
596513
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
597514
def __eq__(self, value: object, /) -> bool: ...
598515
def __ge__(self, value: str, /) -> bool: ...
599-
@overload
600-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
601-
@overload
602-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
516+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
603517
def __gt__(self, value: str, /) -> bool: ...
604518
def __hash__(self) -> int: ...
605-
@overload
606-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
607-
@overload
608519
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
609520
def __le__(self, value: str, /) -> bool: ...
610521
def __len__(self) -> int: ...
611522
def __lt__(self, value: str, /) -> bool: ...
612-
@overload
613-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
614-
@overload
615523
def __mod__(self, value: Any, /) -> str: ...
616-
@overload
617-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
618-
@overload
619524
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
620525
def __ne__(self, value: object, /) -> bool: ...
621-
@overload
622-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
623-
@overload
624526
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
625527
def __getnewargs__(self) -> tuple[str]: ...
626528

0 commit comments

Comments
 (0)