Skip to content

Commit 01b8004

Browse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (python#13743)
1 parent 057734c commit 01b8004

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,UP035
6262
from typing_extensions import ( # noqa: Y023
6363
Concatenate,
6464
Literal,
65-
LiteralString,
6665
ParamSpec,
6766
Self,
6867
TypeAlias,
@@ -440,31 +439,16 @@ class str(Sequence[str]):
440439
def __new__(cls, object: object = ...) -> Self: ...
441440
@overload
442441
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
443-
@overload
444-
def capitalize(self: LiteralString) -> LiteralString: ...
445-
@overload
446442
def capitalize(self) -> str: ... # type: ignore[misc]
447-
@overload
448-
def casefold(self: LiteralString) -> LiteralString: ...
449-
@overload
450443
def casefold(self) -> str: ... # type: ignore[misc]
451-
@overload
452-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
453-
@overload
454444
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
455445
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
456446
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
457447
def endswith(
458448
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
459449
) -> bool: ...
460-
@overload
461-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
462-
@overload
463450
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
464451
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
465-
@overload
466-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
467-
@overload
468452
def format(self, *args: object, **kwargs: object) -> str: ...
469453
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
470454
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -480,98 +464,34 @@ class str(Sequence[str]):
480464
def isspace(self) -> bool: ...
481465
def istitle(self) -> bool: ...
482466
def isupper(self) -> bool: ...
483-
@overload
484-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
485-
@overload
486467
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
487-
@overload
488-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
489-
@overload
490468
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
491-
@overload
492-
def lower(self: LiteralString) -> LiteralString: ...
493-
@overload
494469
def lower(self) -> str: ... # type: ignore[misc]
495-
@overload
496-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
497-
@overload
498470
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
499-
@overload
500-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
501-
@overload
502471
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
503472
if sys.version_info >= (3, 13):
504-
@overload
505-
def replace(
506-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
507-
) -> LiteralString: ...
508-
@overload
509473
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
510474
else:
511-
@overload
512-
def replace(
513-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
514-
) -> LiteralString: ...
515-
@overload
516475
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
517476

518-
@overload
519-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
520-
@overload
521477
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
522-
@overload
523-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
524-
@overload
525478
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
526479
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
527480
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
528-
@overload
529-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
530-
@overload
531481
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
532-
@overload
533-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
534-
@overload
535482
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
536-
@overload
537-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
538-
@overload
539483
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
540-
@overload
541-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
542-
@overload
543484
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
544-
@overload
545-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
546-
@overload
547485
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
548-
@overload
549-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
550-
@overload
551486
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
552487
def startswith(
553488
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
554489
) -> bool: ...
555-
@overload
556-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
557-
@overload
558490
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
559-
@overload
560-
def swapcase(self: LiteralString) -> LiteralString: ...
561-
@overload
562491
def swapcase(self) -> str: ... # type: ignore[misc]
563-
@overload
564-
def title(self: LiteralString) -> LiteralString: ...
565-
@overload
566492
def title(self) -> str: ... # type: ignore[misc]
567493
def translate(self, table: _TranslateTable, /) -> str: ...
568-
@overload
569-
def upper(self: LiteralString) -> LiteralString: ...
570-
@overload
571494
def upper(self) -> str: ... # type: ignore[misc]
572-
@overload
573-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
574-
@overload
575495
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
576496
@staticmethod
577497
@overload
@@ -582,39 +502,21 @@ class str(Sequence[str]):
582502
@staticmethod
583503
@overload
584504
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
585-
@overload
586-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
587-
@overload
588505
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
589506
# Incompatible with Sequence.__contains__
590507
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
591508
def __eq__(self, value: object, /) -> bool: ...
592509
def __ge__(self, value: str, /) -> bool: ...
593-
@overload
594-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
595-
@overload
596-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
510+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
597511
def __gt__(self, value: str, /) -> bool: ...
598512
def __hash__(self) -> int: ...
599-
@overload
600-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
601-
@overload
602513
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
603514
def __le__(self, value: str, /) -> bool: ...
604515
def __len__(self) -> int: ...
605516
def __lt__(self, value: str, /) -> bool: ...
606-
@overload
607-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
608-
@overload
609517
def __mod__(self, value: Any, /) -> str: ...
610-
@overload
611-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
612-
@overload
613518
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
614519
def __ne__(self, value: object, /) -> bool: ...
615-
@overload
616-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
617-
@overload
618520
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
619521
def __getnewargs__(self) -> tuple[str]: ...
620522

0 commit comments

Comments
 (0)