Skip to content

Commit a4caebd

Browse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (python#13743)
1 parent 8d1843a commit a4caebd

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,
@@ -453,31 +452,16 @@ class str(Sequence[str]):
453452
def __new__(cls, object: object = ...) -> Self: ...
454453
@overload
455454
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
456-
@overload
457-
def capitalize(self: LiteralString) -> LiteralString: ...
458-
@overload
459455
def capitalize(self) -> str: ... # type: ignore[misc]
460-
@overload
461-
def casefold(self: LiteralString) -> LiteralString: ...
462-
@overload
463456
def casefold(self) -> str: ... # type: ignore[misc]
464-
@overload
465-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
466-
@overload
467457
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
468458
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
469459
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
470460
def endswith(
471461
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
472462
) -> bool: ...
473-
@overload
474-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
475-
@overload
476463
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
477464
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
478-
@overload
479-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
480-
@overload
481465
def format(self, *args: object, **kwargs: object) -> str: ...
482466
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
483467
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -493,98 +477,34 @@ class str(Sequence[str]):
493477
def isspace(self) -> bool: ...
494478
def istitle(self) -> bool: ...
495479
def isupper(self) -> bool: ...
496-
@overload
497-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
498-
@overload
499480
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
500-
@overload
501-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
502-
@overload
503481
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
504-
@overload
505-
def lower(self: LiteralString) -> LiteralString: ...
506-
@overload
507482
def lower(self) -> str: ... # type: ignore[misc]
508-
@overload
509-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
510-
@overload
511483
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
512-
@overload
513-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
514-
@overload
515484
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
516485
if sys.version_info >= (3, 13):
517-
@overload
518-
def replace(
519-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
520-
) -> LiteralString: ...
521-
@overload
522486
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
523487
else:
524-
@overload
525-
def replace(
526-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
527-
) -> LiteralString: ...
528-
@overload
529488
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
530489

531-
@overload
532-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
533-
@overload
534490
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
535-
@overload
536-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
537-
@overload
538491
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
539492
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
540493
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
541-
@overload
542-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
543-
@overload
544494
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
545-
@overload
546-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
547-
@overload
548495
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
549-
@overload
550-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
551-
@overload
552496
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
553-
@overload
554-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
555-
@overload
556497
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
557-
@overload
558-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
559-
@overload
560498
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
561-
@overload
562-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
563-
@overload
564499
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
565500
def startswith(
566501
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
567502
) -> bool: ...
568-
@overload
569-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
570-
@overload
571503
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
572-
@overload
573-
def swapcase(self: LiteralString) -> LiteralString: ...
574-
@overload
575504
def swapcase(self) -> str: ... # type: ignore[misc]
576-
@overload
577-
def title(self: LiteralString) -> LiteralString: ...
578-
@overload
579505
def title(self) -> str: ... # type: ignore[misc]
580506
def translate(self, table: _TranslateTable, /) -> str: ...
581-
@overload
582-
def upper(self: LiteralString) -> LiteralString: ...
583-
@overload
584507
def upper(self) -> str: ... # type: ignore[misc]
585-
@overload
586-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
587-
@overload
588508
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
589509
@staticmethod
590510
@overload
@@ -595,39 +515,21 @@ class str(Sequence[str]):
595515
@staticmethod
596516
@overload
597517
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
598-
@overload
599-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
600-
@overload
601518
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
602519
# Incompatible with Sequence.__contains__
603520
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
604521
def __eq__(self, value: object, /) -> bool: ...
605522
def __ge__(self, value: str, /) -> bool: ...
606-
@overload
607-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
608-
@overload
609-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
523+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
610524
def __gt__(self, value: str, /) -> bool: ...
611525
def __hash__(self) -> int: ...
612-
@overload
613-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
614-
@overload
615526
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
616527
def __le__(self, value: str, /) -> bool: ...
617528
def __len__(self) -> int: ...
618529
def __lt__(self, value: str, /) -> bool: ...
619-
@overload
620-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
621-
@overload
622530
def __mod__(self, value: Any, /) -> str: ...
623-
@overload
624-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
625-
@overload
626531
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
627532
def __ne__(self, value: object, /) -> bool: ...
628-
@overload
629-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
630-
@overload
631533
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
632534
def __getnewargs__(self) -> tuple[str]: ...
633535

0 commit comments

Comments
 (0)