Skip to content

Commit dfe8c67

Browse files
hauntsaninjamypybot
authored and
mypybot
committed
Remove use of LiteralString in builtins (#13743)
1 parent cdad278 commit dfe8c67

File tree

1 file changed

+1
-93
lines changed

1 file changed

+1
-93
lines changed

mypy/typeshed/stdlib/builtins.pyi

+1-93
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from typing import ( # noqa: Y027
5555
overload,
5656
type_check_only,
5757
)
58-
from typing_extensions import Literal, LiteralString, SupportsIndex, TypeAlias, TypeGuard, final
58+
from typing_extensions import Literal, SupportsIndex, TypeAlias, TypeGuard, final
5959

6060
if sys.version_info >= (3, 9):
6161
from types import GenericAlias
@@ -414,38 +414,20 @@ class str(Sequence[str]):
414414
def __new__(cls: type[Self], object: object = ...) -> Self: ...
415415
@overload
416416
def __new__(cls: type[Self], object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
417-
@overload
418-
def capitalize(self: LiteralString) -> LiteralString: ...
419-
@overload
420417
def capitalize(self) -> str: ... # type: ignore[misc]
421-
@overload
422-
def casefold(self: LiteralString) -> LiteralString: ...
423-
@overload
424418
def casefold(self) -> str: ... # type: ignore[misc]
425-
@overload
426-
def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
427-
@overload
428419
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
429420
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
430421
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
431422
def endswith(
432423
self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
433424
) -> bool: ...
434425
if sys.version_info >= (3, 8):
435-
@overload
436-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = ...) -> LiteralString: ...
437-
@overload
438426
def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ... # type: ignore[misc]
439427
else:
440-
@overload
441-
def expandtabs(self: LiteralString, tabsize: int = ...) -> LiteralString: ...
442-
@overload
443428
def expandtabs(self, tabsize: int = ...) -> str: ... # type: ignore[misc]
444429

445430
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
446-
@overload
447-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
448-
@overload
449431
def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore[misc]
450432
def format_map(self, map: _FormatMapMapping) -> str: ...
451433
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@@ -461,127 +443,53 @@ class str(Sequence[str]):
461443
def isspace(self) -> bool: ...
462444
def istitle(self) -> bool: ...
463445
def isupper(self) -> bool: ...
464-
@overload
465-
def join(self: LiteralString, __iterable: Iterable[LiteralString]) -> LiteralString: ...
466-
@overload
467446
def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc]
468-
@overload
469-
def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
470-
@overload
471447
def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
472-
@overload
473-
def lower(self: LiteralString) -> LiteralString: ...
474-
@overload
475448
def lower(self) -> str: ... # type: ignore[misc]
476-
@overload
477-
def lstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
478-
@overload
479449
def lstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
480-
@overload
481-
def partition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
482-
@overload
483450
def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
484-
@overload
485-
def replace(
486-
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = ...
487-
) -> LiteralString: ...
488-
@overload
489451
def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ... # type: ignore[misc]
490452
if sys.version_info >= (3, 9):
491-
@overload
492-
def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ...
493-
@overload
494453
def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc]
495-
@overload
496-
def removesuffix(self: LiteralString, __suffix: LiteralString) -> LiteralString: ...
497-
@overload
498454
def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc]
499455

500456
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
501457
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
502-
@overload
503-
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
504-
@overload
505458
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
506-
@overload
507-
def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
508-
@overload
509459
def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
510-
@overload
511-
def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
512-
@overload
513460
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
514-
@overload
515-
def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
516-
@overload
517461
def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
518-
@overload
519-
def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
520-
@overload
521462
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
522-
@overload
523-
def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ...
524-
@overload
525463
def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc]
526464
def startswith(
527465
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
528466
) -> bool: ...
529-
@overload
530-
def strip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
531-
@overload
532467
def strip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
533-
@overload
534-
def swapcase(self: LiteralString) -> LiteralString: ...
535-
@overload
536468
def swapcase(self) -> str: ... # type: ignore[misc]
537-
@overload
538-
def title(self: LiteralString) -> LiteralString: ...
539-
@overload
540469
def title(self) -> str: ... # type: ignore[misc]
541470
def translate(self, __table: _TranslateTable) -> str: ...
542-
@overload
543-
def upper(self: LiteralString) -> LiteralString: ...
544-
@overload
545471
def upper(self) -> str: ... # type: ignore[misc]
546-
@overload
547-
def zfill(self: LiteralString, __width: SupportsIndex) -> LiteralString: ...
548-
@overload
549472
def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc]
550473
@staticmethod
551474
@overload
552475
def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
553476
@staticmethod
554477
@overload
555478
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
556-
@overload
557-
def __add__(self: LiteralString, __s: LiteralString) -> LiteralString: ...
558-
@overload
559479
def __add__(self, __s: str) -> str: ... # type: ignore[misc]
560480
# Incompatible with Sequence.__contains__
561481
def __contains__(self, __o: str) -> bool: ... # type: ignore[override]
562482
def __eq__(self, __x: object) -> bool: ...
563483
def __ge__(self, __x: str) -> bool: ...
564484
def __getitem__(self, __i: SupportsIndex | slice) -> str: ...
565485
def __gt__(self, __x: str) -> bool: ...
566-
@overload
567-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
568-
@overload
569486
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
570487
def __le__(self, __x: str) -> bool: ...
571488
def __len__(self) -> int: ...
572489
def __lt__(self, __x: str) -> bool: ...
573-
@overload
574-
def __mod__(self: LiteralString, __x: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
575-
@overload
576490
def __mod__(self, __x: Any) -> str: ... # type: ignore[misc]
577-
@overload
578-
def __mul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ...
579-
@overload
580491
def __mul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc]
581492
def __ne__(self, __x: object) -> bool: ...
582-
@overload
583-
def __rmul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ...
584-
@overload
585493
def __rmul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc]
586494
def __getnewargs__(self) -> tuple[str]: ...
587495

0 commit comments

Comments
 (0)