Skip to content

Commit 5c00e36

Browse files
hauntsaninjaJelleZijlstra
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent cf221bd commit 5c00e36

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

mypy/typeshed/stdlib/builtins.pyi

Lines changed: 0 additions & 88 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,
@@ -434,31 +433,16 @@ class str(Sequence[str]):
434433
def __new__(cls, object: object = ...) -> Self: ...
435434
@overload
436435
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
437-
@overload
438-
def capitalize(self: LiteralString) -> LiteralString: ...
439-
@overload
440436
def capitalize(self) -> str: ... # type: ignore[misc]
441-
@overload
442-
def casefold(self: LiteralString) -> LiteralString: ...
443-
@overload
444437
def casefold(self) -> str: ... # type: ignore[misc]
445-
@overload
446-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
447-
@overload
448438
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
449439
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
450440
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
451441
def endswith(
452442
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
453443
) -> bool: ...
454-
@overload
455-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
456-
@overload
457444
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
458445
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
459-
@overload
460-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
461-
@overload
462446
def format(self, *args: object, **kwargs: object) -> str: ...
463447
def format_map(self, map: _FormatMapMapping) -> str: ...
464448
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -474,89 +458,32 @@ class str(Sequence[str]):
474458
def isspace(self) -> bool: ...
475459
def istitle(self) -> bool: ...
476460
def isupper(self) -> bool: ...
477-
@overload
478-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
479-
@overload
480461
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
481-
@overload
482-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
483-
@overload
484462
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
485-
@overload
486-
def lower(self: LiteralString) -> LiteralString: ...
487-
@overload
488463
def lower(self) -> str: ... # type: ignore[misc]
489-
@overload
490-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
491-
@overload
492464
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
493-
@overload
494-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
495-
@overload
496465
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
497-
@overload
498-
def replace(self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /) -> LiteralString: ...
499-
@overload
500466
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
501467
if sys.version_info >= (3, 9):
502-
@overload
503-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
504-
@overload
505468
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
506-
@overload
507-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
508-
@overload
509469
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
510470

511471
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
512472
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
513-
@overload
514-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
515-
@overload
516473
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
517-
@overload
518-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
519-
@overload
520474
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
521-
@overload
522-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
523-
@overload
524475
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
525-
@overload
526-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
527-
@overload
528476
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
529-
@overload
530-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
531-
@overload
532477
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
533-
@overload
534-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
535-
@overload
536478
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
537479
def startswith(
538480
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
539481
) -> bool: ...
540-
@overload
541-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
542-
@overload
543482
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
544-
@overload
545-
def swapcase(self: LiteralString) -> LiteralString: ...
546-
@overload
547483
def swapcase(self) -> str: ... # type: ignore[misc]
548-
@overload
549-
def title(self: LiteralString) -> LiteralString: ...
550-
@overload
551484
def title(self) -> str: ... # type: ignore[misc]
552485
def translate(self, table: _TranslateTable, /) -> str: ...
553-
@overload
554-
def upper(self: LiteralString) -> LiteralString: ...
555-
@overload
556486
def upper(self) -> str: ... # type: ignore[misc]
557-
@overload
558-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
559-
@overload
560487
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
561488
@staticmethod
562489
@overload
@@ -567,9 +494,6 @@ class str(Sequence[str]):
567494
@staticmethod
568495
@overload
569496
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
570-
@overload
571-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
572-
@overload
573497
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
574498
# Incompatible with Sequence.__contains__
575499
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
@@ -578,25 +502,13 @@ class str(Sequence[str]):
578502
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
579503
def __gt__(self, value: str, /) -> bool: ...
580504
def __hash__(self) -> int: ...
581-
@overload
582-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
583-
@overload
584505
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
585506
def __le__(self, value: str, /) -> bool: ...
586507
def __len__(self) -> int: ...
587508
def __lt__(self, value: str, /) -> bool: ...
588-
@overload
589-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
590-
@overload
591509
def __mod__(self, value: Any, /) -> str: ...
592-
@overload
593-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
594-
@overload
595510
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
596511
def __ne__(self, value: object, /) -> bool: ...
597-
@overload
598-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
599-
@overload
600512
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
601513
def __getnewargs__(self) -> tuple[str]: ...
602514

0 commit comments

Comments
 (0)