Skip to content

Commit 2cb2d92

Browse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (python#13743)
1 parent 5fb4461 commit 2cb2d92

1 file changed

Lines changed: 0 additions & 95 deletions

File tree

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ from typing import ( # noqa: Y022
6161
from typing_extensions import ( # noqa: Y023
6262
Concatenate,
6363
Literal,
64-
LiteralString,
6564
ParamSpec,
6665
Self,
6766
TypeAlias,
@@ -435,31 +434,16 @@ class str(Sequence[str]):
435434
def __new__(cls, object: object = ...) -> Self: ...
436435
@overload
437436
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
438-
@overload
439-
def capitalize(self: LiteralString) -> LiteralString: ...
440-
@overload
441437
def capitalize(self) -> str: ... # type: ignore[misc]
442-
@overload
443-
def casefold(self: LiteralString) -> LiteralString: ...
444-
@overload
445438
def casefold(self) -> str: ... # type: ignore[misc]
446-
@overload
447-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
448-
@overload
449439
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
450440
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
451441
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
452442
def endswith(
453443
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
454444
) -> bool: ...
455-
@overload
456-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
457-
@overload
458445
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
459446
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
460-
@overload
461-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
462-
@overload
463447
def format(self, *args: object, **kwargs: object) -> str: ...
464448
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
465449
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -475,99 +459,35 @@ class str(Sequence[str]):
475459
def isspace(self) -> bool: ...
476460
def istitle(self) -> bool: ...
477461
def isupper(self) -> bool: ...
478-
@overload
479-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
480-
@overload
481462
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
482-
@overload
483-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
484-
@overload
485463
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
486-
@overload
487-
def lower(self: LiteralString) -> LiteralString: ...
488-
@overload
489464
def lower(self) -> str: ... # type: ignore[misc]
490-
@overload
491-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
492-
@overload
493465
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
494-
@overload
495-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
496-
@overload
497466
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
498467
if sys.version_info >= (3, 13):
499-
@overload
500-
def replace(
501-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
502-
) -> LiteralString: ...
503-
@overload
504468
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
505469
else:
506-
@overload
507-
def replace(
508-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
509-
) -> LiteralString: ...
510-
@overload
511470
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
512471
if sys.version_info >= (3, 9):
513-
@overload
514-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
515-
@overload
516472
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
517-
@overload
518-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
519-
@overload
520473
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
521474

522475
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
523476
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
524-
@overload
525-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
526-
@overload
527477
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
528-
@overload
529-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
530-
@overload
531478
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
532-
@overload
533-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
534-
@overload
535479
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
536-
@overload
537-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
538-
@overload
539480
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
540-
@overload
541-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
542-
@overload
543481
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
544-
@overload
545-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
546-
@overload
547482
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
548483
def startswith(
549484
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
550485
) -> bool: ...
551-
@overload
552-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
553-
@overload
554486
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
555-
@overload
556-
def swapcase(self: LiteralString) -> LiteralString: ...
557-
@overload
558487
def swapcase(self) -> str: ... # type: ignore[misc]
559-
@overload
560-
def title(self: LiteralString) -> LiteralString: ...
561-
@overload
562488
def title(self) -> str: ... # type: ignore[misc]
563489
def translate(self, table: _TranslateTable, /) -> str: ...
564-
@overload
565-
def upper(self: LiteralString) -> LiteralString: ...
566-
@overload
567490
def upper(self) -> str: ... # type: ignore[misc]
568-
@overload
569-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
570-
@overload
571491
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
572492
@staticmethod
573493
@overload
@@ -578,9 +498,6 @@ class str(Sequence[str]):
578498
@staticmethod
579499
@overload
580500
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
581-
@overload
582-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
583-
@overload
584501
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
585502
# Incompatible with Sequence.__contains__
586503
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
@@ -589,25 +506,13 @@ class str(Sequence[str]):
589506
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
590507
def __gt__(self, value: str, /) -> bool: ...
591508
def __hash__(self) -> int: ...
592-
@overload
593-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
594-
@overload
595509
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
596510
def __le__(self, value: str, /) -> bool: ...
597511
def __len__(self) -> int: ...
598512
def __lt__(self, value: str, /) -> bool: ...
599-
@overload
600-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
601-
@overload
602513
def __mod__(self, value: Any, /) -> str: ...
603-
@overload
604-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
605-
@overload
606514
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
607515
def __ne__(self, value: object, /) -> bool: ...
608-
@overload
609-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
610-
@overload
611516
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
612517
def __getnewargs__(self) -> tuple[str]: ...
613518

0 commit comments

Comments
 (0)