Skip to content

Commit d25e4a9

Browse files
hauntsaninjaJelleZijlstra
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent 9bb102a commit d25e4a9

File tree

1 file changed

+0
-90
lines changed

1 file changed

+0
-90
lines changed

mypy/typeshed/stdlib/builtins.pyi

-90
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, x: 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, map: _FormatMapMapping) -> str: ...
465449
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@@ -475,91 +459,32 @@ 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]
498-
@overload
499-
def replace(
500-
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = -1
501-
) -> LiteralString: ...
502-
@overload
503467
def replace(self, __old: str, __new: str, __count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
504468
if sys.version_info >= (3, 9):
505-
@overload
506-
def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ...
507-
@overload
508469
def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc]
509-
@overload
510-
def removesuffix(self: LiteralString, __suffix: LiteralString) -> LiteralString: ...
511-
@overload
512470
def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc]
513471

514472
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
515473
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
516-
@overload
517-
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
518-
@overload
519474
def rjust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
520-
@overload
521-
def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
522-
@overload
523475
def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
524-
@overload
525-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
526-
@overload
527476
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
528-
@overload
529-
def rstrip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
530-
@overload
531477
def rstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
532-
@overload
533-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
534-
@overload
535478
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
536-
@overload
537-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
538-
@overload
539479
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
540480
def startswith(
541481
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
542482
) -> bool: ...
543-
@overload
544-
def strip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
545-
@overload
546483
def strip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
547-
@overload
548-
def swapcase(self: LiteralString) -> LiteralString: ...
549-
@overload
550484
def swapcase(self) -> str: ... # type: ignore[misc]
551-
@overload
552-
def title(self: LiteralString) -> LiteralString: ...
553-
@overload
554485
def title(self) -> str: ... # type: ignore[misc]
555486
def translate(self, __table: _TranslateTable) -> str: ...
556-
@overload
557-
def upper(self: LiteralString) -> LiteralString: ...
558-
@overload
559487
def upper(self) -> str: ... # type: ignore[misc]
560-
@overload
561-
def zfill(self: LiteralString, __width: SupportsIndex) -> LiteralString: ...
562-
@overload
563488
def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc]
564489
@staticmethod
565490
@overload
@@ -570,9 +495,6 @@ class str(Sequence[str]):
570495
@staticmethod
571496
@overload
572497
def maketrans(__x: str, __y: str, __z: str) -> dict[int, int | None]: ...
573-
@overload
574-
def __add__(self: LiteralString, __value: LiteralString) -> LiteralString: ...
575-
@overload
576498
def __add__(self, __value: str) -> str: ... # type: ignore[misc]
577499
# Incompatible with Sequence.__contains__
578500
def __contains__(self, __key: str) -> bool: ... # type: ignore[override]
@@ -581,25 +503,13 @@ class str(Sequence[str]):
581503
def __getitem__(self, __key: SupportsIndex | slice) -> str: ...
582504
def __gt__(self, __value: str) -> bool: ...
583505
def __hash__(self) -> int: ...
584-
@overload
585-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
586-
@overload
587506
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
588507
def __le__(self, __value: str) -> bool: ...
589508
def __len__(self) -> int: ...
590509
def __lt__(self, __value: str) -> bool: ...
591-
@overload
592-
def __mod__(self: LiteralString, __value: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
593-
@overload
594510
def __mod__(self, __value: Any) -> str: ...
595-
@overload
596-
def __mul__(self: LiteralString, __value: SupportsIndex) -> LiteralString: ...
597-
@overload
598511
def __mul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
599512
def __ne__(self, __value: object) -> bool: ...
600-
@overload
601-
def __rmul__(self: LiteralString, __value: SupportsIndex) -> LiteralString: ...
602-
@overload
603513
def __rmul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
604514
def __getnewargs__(self) -> tuple[str]: ...
605515

0 commit comments

Comments
 (0)