Skip to content

Commit 6f913a1

Browse files
hauntsaninjaJelleZijlstra
authored andcommitted
Remove use of LiteralString in builtins (#13743)
1 parent 59a6c5e commit 6f913a1

File tree

1 file changed

+0
-93
lines changed

1 file changed

+0
-93
lines changed

Diff for: mypy/typeshed/stdlib/builtins.pyi

-93
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ from typing import ( # noqa: Y022
5656
from typing_extensions import ( # type: ignore
5757
Concatenate,
5858
Literal,
59-
LiteralString,
6059
ParamSpec,
6160
Self,
6261
SupportsIndex,
@@ -433,38 +432,20 @@ class str(Sequence[str]):
433432
def __new__(cls, object: object = ...) -> Self: ...
434433
@overload
435434
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
436-
@overload
437-
def capitalize(self: LiteralString) -> LiteralString: ...
438-
@overload
439435
def capitalize(self) -> str: ... # type: ignore[misc]
440-
@overload
441-
def casefold(self: LiteralString) -> LiteralString: ...
442-
@overload
443436
def casefold(self) -> str: ... # type: ignore[misc]
444-
@overload
445-
def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
446-
@overload
447437
def center(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
448438
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
449439
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
450440
def endswith(
451441
self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
452442
) -> bool: ...
453443
if sys.version_info >= (3, 8):
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
else:
459-
@overload
460-
def expandtabs(self: LiteralString, tabsize: int = 8) -> LiteralString: ...
461-
@overload
462446
def expandtabs(self, tabsize: int = 8) -> str: ... # type: ignore[misc]
463447

464448
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
465-
@overload
466-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
467-
@overload
468449
def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore
469450
def format_map(self, map: _FormatMapMapping) -> str: ...
470451
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@@ -480,91 +461,32 @@ class str(Sequence[str]):
480461
def isspace(self) -> bool: ...
481462
def istitle(self) -> bool: ...
482463
def isupper(self) -> bool: ...
483-
@overload
484-
def join(self: LiteralString, __iterable: Iterable[LiteralString]) -> LiteralString: ...
485-
@overload
486464
def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc]
487-
@overload
488-
def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
489-
@overload
490465
def ljust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
491-
@overload
492-
def lower(self: LiteralString) -> LiteralString: ...
493-
@overload
494466
def lower(self) -> str: ... # type: ignore[misc]
495-
@overload
496-
def lstrip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
497-
@overload
498467
def lstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
499-
@overload
500-
def partition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
501-
@overload
502468
def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
503-
@overload
504-
def replace(
505-
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = -1
506-
) -> LiteralString: ...
507-
@overload
508469
def replace(self, __old: str, __new: str, __count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
509470
if sys.version_info >= (3, 9):
510-
@overload
511-
def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ...
512-
@overload
513471
def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc]
514-
@overload
515-
def removesuffix(self: LiteralString, __suffix: LiteralString) -> LiteralString: ...
516-
@overload
517472
def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc]
518473

519474
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
520475
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
521-
@overload
522-
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = " ") -> LiteralString: ...
523-
@overload
524476
def rjust(self, __width: SupportsIndex, __fillchar: str = " ") -> str: ... # type: ignore[misc]
525-
@overload
526-
def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
527-
@overload
528477
def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
529-
@overload
530-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
531-
@overload
532478
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
533-
@overload
534-
def rstrip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
535-
@overload
536479
def rstrip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
537-
@overload
538-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
539-
@overload
540480
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
541-
@overload
542-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
543-
@overload
544481
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
545482
def startswith(
546483
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
547484
) -> bool: ...
548-
@overload
549-
def strip(self: LiteralString, __chars: LiteralString | None = None) -> LiteralString: ...
550-
@overload
551485
def strip(self, __chars: str | None = None) -> str: ... # type: ignore[misc]
552-
@overload
553-
def swapcase(self: LiteralString) -> LiteralString: ...
554-
@overload
555486
def swapcase(self) -> str: ... # type: ignore[misc]
556-
@overload
557-
def title(self: LiteralString) -> LiteralString: ...
558-
@overload
559487
def title(self) -> str: ... # type: ignore[misc]
560488
def translate(self, __table: _TranslateTable) -> str: ...
561-
@overload
562-
def upper(self: LiteralString) -> LiteralString: ...
563-
@overload
564489
def upper(self) -> str: ... # type: ignore[misc]
565-
@overload
566-
def zfill(self: LiteralString, __width: SupportsIndex) -> LiteralString: ...
567-
@overload
568490
def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc]
569491
@staticmethod
570492
@overload
@@ -575,35 +497,20 @@ class str(Sequence[str]):
575497
@staticmethod
576498
@overload
577499
def maketrans(__x: str, __y: str, __z: str) -> dict[int, int | None]: ...
578-
@overload
579-
def __add__(self: LiteralString, __value: LiteralString) -> LiteralString: ...
580-
@overload
581500
def __add__(self, __value: str) -> str: ... # type: ignore[misc]
582501
# Incompatible with Sequence.__contains__
583502
def __contains__(self, __key: str) -> bool: ... # type: ignore[override]
584503
def __eq__(self, __value: object) -> bool: ...
585504
def __ge__(self, __value: str) -> bool: ...
586505
def __getitem__(self, __key: SupportsIndex | slice) -> str: ...
587506
def __gt__(self, __value: str) -> bool: ...
588-
@overload
589-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
590-
@overload
591507
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
592508
def __le__(self, __value: str) -> bool: ...
593509
def __len__(self) -> int: ...
594510
def __lt__(self, __value: str) -> bool: ...
595-
@overload
596-
def __mod__(self: LiteralString, __value: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
597-
@overload
598511
def __mod__(self, __value: Any) -> str: ... # type: ignore
599-
@overload
600-
def __mul__(self: LiteralString, __value: SupportsIndex) -> LiteralString: ...
601-
@overload
602512
def __mul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
603513
def __ne__(self, __value: object) -> bool: ...
604-
@overload
605-
def __rmul__(self: LiteralString, __value: SupportsIndex) -> LiteralString: ...
606-
@overload
607514
def __rmul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
608515
def __getnewargs__(self) -> tuple[str]: ...
609516

0 commit comments

Comments
 (0)