Skip to content

Commit 6a02d2d

Browse files
committed
Remove use of LiteralString in builtins (#13743)
1 parent 6e37560 commit 6a02d2d

File tree

1 file changed

+0
-95
lines changed

1 file changed

+0
-95
lines changed

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,
@@ -436,31 +435,16 @@ class str(Sequence[str]):
436435
def __new__(cls, object: object = ...) -> Self: ...
437436
@overload
438437
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
439-
@overload
440-
def capitalize(self: LiteralString) -> LiteralString: ...
441-
@overload
442438
def capitalize(self) -> str: ... # type: ignore[misc]
443-
@overload
444-
def casefold(self: LiteralString) -> LiteralString: ...
445-
@overload
446439
def casefold(self) -> str: ... # type: ignore[misc]
447-
@overload
448-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
449-
@overload
450440
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
451441
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
452442
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
453443
def endswith(
454444
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
455445
) -> bool: ...
456-
@overload
457-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
458-
@overload
459446
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
460447
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
461-
@overload
462-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
463-
@overload
464448
def format(self, *args: object, **kwargs: object) -> str: ...
465449
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
466450
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -476,99 +460,35 @@ class str(Sequence[str]):
476460
def isspace(self) -> bool: ...
477461
def istitle(self) -> bool: ...
478462
def isupper(self) -> bool: ...
479-
@overload
480-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
481-
@overload
482463
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
483-
@overload
484-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
485-
@overload
486464
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
487-
@overload
488-
def lower(self: LiteralString) -> LiteralString: ...
489-
@overload
490465
def lower(self) -> str: ... # type: ignore[misc]
491-
@overload
492-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
493-
@overload
494466
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
495-
@overload
496-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
497-
@overload
498467
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
499468
if sys.version_info >= (3, 13):
500-
@overload
501-
def replace(
502-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
503-
) -> LiteralString: ...
504-
@overload
505469
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
506470
else:
507-
@overload
508-
def replace(
509-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
510-
) -> LiteralString: ...
511-
@overload
512471
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
513472
if sys.version_info >= (3, 9):
514-
@overload
515-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
516-
@overload
517473
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
518-
@overload
519-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
520-
@overload
521474
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
522475

523476
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
524477
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
525-
@overload
526-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
527-
@overload
528478
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
529-
@overload
530-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
531-
@overload
532479
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
533-
@overload
534-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
535-
@overload
536480
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
537-
@overload
538-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
539-
@overload
540481
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
541-
@overload
542-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
543-
@overload
544482
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
545-
@overload
546-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
547-
@overload
548483
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
549484
def startswith(
550485
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
551486
) -> bool: ...
552-
@overload
553-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
554-
@overload
555487
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
556-
@overload
557-
def swapcase(self: LiteralString) -> LiteralString: ...
558-
@overload
559488
def swapcase(self) -> str: ... # type: ignore[misc]
560-
@overload
561-
def title(self: LiteralString) -> LiteralString: ...
562-
@overload
563489
def title(self) -> str: ... # type: ignore[misc]
564490
def translate(self, table: _TranslateTable, /) -> str: ...
565-
@overload
566-
def upper(self: LiteralString) -> LiteralString: ...
567-
@overload
568491
def upper(self) -> str: ... # type: ignore[misc]
569-
@overload
570-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
571-
@overload
572492
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
573493
@staticmethod
574494
@overload
@@ -579,9 +499,6 @@ class str(Sequence[str]):
579499
@staticmethod
580500
@overload
581501
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
582-
@overload
583-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
584-
@overload
585502
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
586503
# Incompatible with Sequence.__contains__
587504
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
@@ -590,25 +507,13 @@ class str(Sequence[str]):
590507
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
591508
def __gt__(self, value: str, /) -> bool: ...
592509
def __hash__(self) -> int: ...
593-
@overload
594-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
595-
@overload
596510
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
597511
def __le__(self, value: str, /) -> bool: ...
598512
def __len__(self) -> int: ...
599513
def __lt__(self, value: str, /) -> bool: ...
600-
@overload
601-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
602-
@overload
603514
def __mod__(self, value: Any, /) -> str: ...
604-
@overload
605-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
606-
@overload
607515
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
608516
def __ne__(self, value: object, /) -> bool: ...
609-
@overload
610-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
611-
@overload
612517
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
613518
def __getnewargs__(self) -> tuple[str]: ...
614519

0 commit comments

Comments
 (0)