Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9a743ac

Browse filesBrowse files
hauntsaninjamypybot
authored and
mypybot
committed
Remove use of LiteralString in builtins (#13743)
1 parent 43e83d0 commit 9a743ac
Copy full SHA for 9a743ac

File tree

Expand file treeCollapse file tree

1 file changed

+1
-99
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-99
lines changed

‎mypy/typeshed/stdlib/builtins.pyi

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/builtins.pyi
+1-99Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ from typing import ( # noqa: Y022
6363
from typing_extensions import ( # noqa: Y023
6464
Concatenate,
6565
Literal,
66-
LiteralString,
6766
ParamSpec,
6867
Self,
6968
TypeAlias,
@@ -446,31 +445,16 @@ class str(Sequence[str]):
446445
def __new__(cls, object: object = ...) -> Self: ...
447446
@overload
448447
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
449-
@overload
450-
def capitalize(self: LiteralString) -> LiteralString: ...
451-
@overload
452448
def capitalize(self) -> str: ... # type: ignore[misc]
453-
@overload
454-
def casefold(self: LiteralString) -> LiteralString: ...
455-
@overload
456449
def casefold(self) -> str: ... # type: ignore[misc]
457-
@overload
458-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
459-
@overload
460450
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
461451
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
462452
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
463453
def endswith(
464454
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
465455
) -> bool: ...
466-
@overload
467-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
468-
@overload
469456
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
470457
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
471-
@overload
472-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
473-
@overload
474458
def format(self, *args: object, **kwargs: object) -> str: ...
475459
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
476460
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -486,99 +470,35 @@ class str(Sequence[str]):
486470
def isspace(self) -> bool: ...
487471
def istitle(self) -> bool: ...
488472
def isupper(self) -> bool: ...
489-
@overload
490-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
491-
@overload
492473
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
493-
@overload
494-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
495-
@overload
496474
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
497-
@overload
498-
def lower(self: LiteralString) -> LiteralString: ...
499-
@overload
500475
def lower(self) -> str: ... # type: ignore[misc]
501-
@overload
502-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
503-
@overload
504476
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
505-
@overload
506-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
507-
@overload
508477
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
509478
if sys.version_info >= (3, 13):
510-
@overload
511-
def replace(
512-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
513-
) -> LiteralString: ...
514-
@overload
515479
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
516480
else:
517-
@overload
518-
def replace(
519-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
520-
) -> LiteralString: ...
521-
@overload
522481
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
523482
if sys.version_info >= (3, 9):
524-
@overload
525-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
526-
@overload
527483
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
528-
@overload
529-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
530-
@overload
531484
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
532485

533486
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
534487
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
535-
@overload
536-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
537-
@overload
538488
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
539-
@overload
540-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
541-
@overload
542489
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
543-
@overload
544-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
545-
@overload
546490
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
547-
@overload
548-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
549-
@overload
550491
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
551-
@overload
552-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
553-
@overload
554492
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
555-
@overload
556-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
557-
@overload
558493
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
559494
def startswith(
560495
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
561496
) -> bool: ...
562-
@overload
563-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
564-
@overload
565497
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
566-
@overload
567-
def swapcase(self: LiteralString) -> LiteralString: ...
568-
@overload
569498
def swapcase(self) -> str: ... # type: ignore[misc]
570-
@overload
571-
def title(self: LiteralString) -> LiteralString: ...
572-
@overload
573499
def title(self) -> str: ... # type: ignore[misc]
574500
def translate(self, table: _TranslateTable, /) -> str: ...
575-
@overload
576-
def upper(self: LiteralString) -> LiteralString: ...
577-
@overload
578501
def upper(self) -> str: ... # type: ignore[misc]
579-
@overload
580-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
581-
@overload
582502
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
583503
@staticmethod
584504
@overload
@@ -589,39 +509,21 @@ class str(Sequence[str]):
589509
@staticmethod
590510
@overload
591511
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
592-
@overload
593-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
594-
@overload
595512
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
596513
# Incompatible with Sequence.__contains__
597514
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
598515
def __eq__(self, value: object, /) -> bool: ...
599516
def __ge__(self, value: str, /) -> bool: ...
600-
@overload
601-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
602-
@overload
603-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
517+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
604518
def __gt__(self, value: str, /) -> bool: ...
605519
def __hash__(self) -> int: ...
606-
@overload
607-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
608-
@overload
609520
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
610521
def __le__(self, value: str, /) -> bool: ...
611522
def __len__(self) -> int: ...
612523
def __lt__(self, value: str, /) -> bool: ...
613-
@overload
614-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
615-
@overload
616524
def __mod__(self, value: Any, /) -> str: ...
617-
@overload
618-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
619-
@overload
620525
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
621526
def __ne__(self, value: object, /) -> bool: ...
622-
@overload
623-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
624-
@overload
625527
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
626528
def __getnewargs__(self) -> tuple[str]: ...
627529

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.