Skip to content

Commit 5707cdd

Browse files
hauntsaninjamypybot
authored and
mypybot
committed
Remove use of LiteralString in builtins (#13743)
1 parent cd1b8f5 commit 5707cdd

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
@@ -63,7 +63,6 @@ from typing import ( # noqa: Y022
6363
from typing_extensions import ( # noqa: Y023
6464
Concatenate,
6565
Literal,
66-
LiteralString,
6766
ParamSpec,
6867
Self,
6968
TypeAlias,
@@ -438,31 +437,16 @@ class str(Sequence[str]):
438437
def __new__(cls, object: object = ...) -> Self: ...
439438
@overload
440439
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
441-
@overload
442-
def capitalize(self: LiteralString) -> LiteralString: ...
443-
@overload
444440
def capitalize(self) -> str: ... # type: ignore[misc]
445-
@overload
446-
def casefold(self: LiteralString) -> LiteralString: ...
447-
@overload
448441
def casefold(self) -> str: ... # type: ignore[misc]
449-
@overload
450-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
451-
@overload
452442
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
453443
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
454444
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
455445
def endswith(
456446
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
457447
) -> bool: ...
458-
@overload
459-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
460-
@overload
461448
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
462449
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
463-
@overload
464-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
465-
@overload
466450
def format(self, *args: object, **kwargs: object) -> str: ...
467451
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
468452
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -478,99 +462,35 @@ class str(Sequence[str]):
478462
def isspace(self) -> bool: ...
479463
def istitle(self) -> bool: ...
480464
def isupper(self) -> bool: ...
481-
@overload
482-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
483-
@overload
484465
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
485-
@overload
486-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
487-
@overload
488466
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
489-
@overload
490-
def lower(self: LiteralString) -> LiteralString: ...
491-
@overload
492467
def lower(self) -> str: ... # type: ignore[misc]
493-
@overload
494-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
495-
@overload
496468
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
497-
@overload
498-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
499-
@overload
500469
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
501470
if sys.version_info >= (3, 13):
502-
@overload
503-
def replace(
504-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
505-
) -> LiteralString: ...
506-
@overload
507471
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
508472
else:
509-
@overload
510-
def replace(
511-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
512-
) -> LiteralString: ...
513-
@overload
514473
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
515474
if sys.version_info >= (3, 9):
516-
@overload
517-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
518-
@overload
519475
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
520-
@overload
521-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
522-
@overload
523476
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
524477

525478
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
526479
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
527-
@overload
528-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
529-
@overload
530480
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
531-
@overload
532-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
533-
@overload
534481
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
535-
@overload
536-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
537-
@overload
538482
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
539-
@overload
540-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
541-
@overload
542483
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
543-
@overload
544-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
545-
@overload
546484
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
547-
@overload
548-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
549-
@overload
550485
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
551486
def startswith(
552487
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
553488
) -> bool: ...
554-
@overload
555-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
556-
@overload
557489
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
558-
@overload
559-
def swapcase(self: LiteralString) -> LiteralString: ...
560-
@overload
561490
def swapcase(self) -> str: ... # type: ignore[misc]
562-
@overload
563-
def title(self: LiteralString) -> LiteralString: ...
564-
@overload
565491
def title(self) -> str: ... # type: ignore[misc]
566492
def translate(self, table: _TranslateTable, /) -> str: ...
567-
@overload
568-
def upper(self: LiteralString) -> LiteralString: ...
569-
@overload
570493
def upper(self) -> str: ... # type: ignore[misc]
571-
@overload
572-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
573-
@overload
574494
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
575495
@staticmethod
576496
@overload
@@ -581,39 +501,21 @@ class str(Sequence[str]):
581501
@staticmethod
582502
@overload
583503
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
584-
@overload
585-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
586-
@overload
587504
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
588505
# Incompatible with Sequence.__contains__
589506
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
590507
def __eq__(self, value: object, /) -> bool: ...
591508
def __ge__(self, value: str, /) -> bool: ...
592-
@overload
593-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
594-
@overload
595-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
509+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
596510
def __gt__(self, value: str, /) -> bool: ...
597511
def __hash__(self) -> int: ...
598-
@overload
599-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
600-
@overload
601512
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
602513
def __le__(self, value: str, /) -> bool: ...
603514
def __len__(self) -> int: ...
604515
def __lt__(self, value: str, /) -> bool: ...
605-
@overload
606-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
607-
@overload
608516
def __mod__(self, value: Any, /) -> str: ...
609-
@overload
610-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
611-
@overload
612517
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
613518
def __ne__(self, value: object, /) -> bool: ...
614-
@overload
615-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
616-
@overload
617519
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
618520
def __getnewargs__(self) -> tuple[str]: ...
619521

0 commit comments

Comments
 (0)