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 3bc2e45

Browse filesBrowse files
hauntsaninjacdce8p
authored andcommitted
Remove use of LiteralString in builtins (python#13743)
1 parent fbdf997 commit 3bc2e45
Copy full SHA for 3bc2e45

File tree

1 file changed

+1
-99
lines changed
Filter options

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
@@ -64,7 +64,6 @@ from typing import ( # noqa: Y022
6464
from typing_extensions import ( # noqa: Y023
6565
Concatenate,
6666
Literal,
67-
LiteralString,
6867
ParamSpec,
6968
Self,
7069
TypeAlias,
@@ -442,31 +441,16 @@ class str(Sequence[str]):
442441
def __new__(cls, object: object = ...) -> Self: ...
443442
@overload
444443
def __new__(cls, object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
445-
@overload
446-
def capitalize(self: LiteralString) -> LiteralString: ...
447-
@overload
448444
def capitalize(self) -> str: ... # type: ignore[misc]
449-
@overload
450-
def casefold(self: LiteralString) -> LiteralString: ...
451-
@overload
452445
def casefold(self) -> str: ... # type: ignore[misc]
453-
@overload
454-
def center(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
455-
@overload
456446
def center(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
457447
def count(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
458448
def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
459449
def endswith(
460450
self, suffix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
461451
) -> bool: ...
462-
@overload
463-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = 8) -> LiteralString: ...
464-
@overload
465452
def expandtabs(self, tabsize: SupportsIndex = 8) -> str: ... # type: ignore[misc]
466453
def find(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
467-
@overload
468-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
469-
@overload
470454
def format(self, *args: object, **kwargs: object) -> str: ...
471455
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
472456
def index(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
@@ -482,99 +466,35 @@ class str(Sequence[str]):
482466
def isspace(self) -> bool: ...
483467
def istitle(self) -> bool: ...
484468
def isupper(self) -> bool: ...
485-
@overload
486-
def join(self: LiteralString, iterable: Iterable[LiteralString], /) -> LiteralString: ...
487-
@overload
488469
def join(self, iterable: Iterable[str], /) -> str: ... # type: ignore[misc]
489-
@overload
490-
def ljust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
491-
@overload
492470
def ljust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
493-
@overload
494-
def lower(self: LiteralString) -> LiteralString: ...
495-
@overload
496471
def lower(self) -> str: ... # type: ignore[misc]
497-
@overload
498-
def lstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
499-
@overload
500472
def lstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
501-
@overload
502-
def partition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
503-
@overload
504473
def partition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
505474
if sys.version_info >= (3, 13):
506-
@overload
507-
def replace(
508-
self: LiteralString, old: LiteralString, new: LiteralString, /, count: SupportsIndex = -1
509-
) -> LiteralString: ...
510-
@overload
511475
def replace(self, old: str, new: str, /, count: SupportsIndex = -1) -> str: ... # type: ignore[misc]
512476
else:
513-
@overload
514-
def replace(
515-
self: LiteralString, old: LiteralString, new: LiteralString, count: SupportsIndex = -1, /
516-
) -> LiteralString: ...
517-
@overload
518477
def replace(self, old: str, new: str, count: SupportsIndex = -1, /) -> str: ... # type: ignore[misc]
519478
if sys.version_info >= (3, 9):
520-
@overload
521-
def removeprefix(self: LiteralString, prefix: LiteralString, /) -> LiteralString: ...
522-
@overload
523479
def removeprefix(self, prefix: str, /) -> str: ... # type: ignore[misc]
524-
@overload
525-
def removesuffix(self: LiteralString, suffix: LiteralString, /) -> LiteralString: ...
526-
@overload
527480
def removesuffix(self, suffix: str, /) -> str: ... # type: ignore[misc]
528481

529482
def rfind(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
530483
def rindex(self, sub: str, start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /) -> int: ...
531-
@overload
532-
def rjust(self: LiteralString, width: SupportsIndex, fillchar: LiteralString = " ", /) -> LiteralString: ...
533-
@overload
534484
def rjust(self, width: SupportsIndex, fillchar: str = " ", /) -> str: ... # type: ignore[misc]
535-
@overload
536-
def rpartition(self: LiteralString, sep: LiteralString, /) -> tuple[LiteralString, LiteralString, LiteralString]: ...
537-
@overload
538485
def rpartition(self, sep: str, /) -> tuple[str, str, str]: ... # type: ignore[misc]
539-
@overload
540-
def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
541-
@overload
542486
def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
543-
@overload
544-
def rstrip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
545-
@overload
546487
def rstrip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
547-
@overload
548-
def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ...
549-
@overload
550488
def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc]
551-
@overload
552-
def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ...
553-
@overload
554489
def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc]
555490
def startswith(
556491
self, prefix: str | tuple[str, ...], start: SupportsIndex | None = ..., end: SupportsIndex | None = ..., /
557492
) -> bool: ...
558-
@overload
559-
def strip(self: LiteralString, chars: LiteralString | None = None, /) -> LiteralString: ...
560-
@overload
561493
def strip(self, chars: str | None = None, /) -> str: ... # type: ignore[misc]
562-
@overload
563-
def swapcase(self: LiteralString) -> LiteralString: ...
564-
@overload
565494
def swapcase(self) -> str: ... # type: ignore[misc]
566-
@overload
567-
def title(self: LiteralString) -> LiteralString: ...
568-
@overload
569495
def title(self) -> str: ... # type: ignore[misc]
570496
def translate(self, table: _TranslateTable, /) -> str: ...
571-
@overload
572-
def upper(self: LiteralString) -> LiteralString: ...
573-
@overload
574497
def upper(self) -> str: ... # type: ignore[misc]
575-
@overload
576-
def zfill(self: LiteralString, width: SupportsIndex, /) -> LiteralString: ...
577-
@overload
578498
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
579499
@staticmethod
580500
@overload
@@ -585,39 +505,21 @@ class str(Sequence[str]):
585505
@staticmethod
586506
@overload
587507
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
588-
@overload
589-
def __add__(self: LiteralString, value: LiteralString, /) -> LiteralString: ...
590-
@overload
591508
def __add__(self, value: str, /) -> str: ... # type: ignore[misc]
592509
# Incompatible with Sequence.__contains__
593510
def __contains__(self, key: str, /) -> bool: ... # type: ignore[override]
594511
def __eq__(self, value: object, /) -> bool: ...
595512
def __ge__(self, value: str, /) -> bool: ...
596-
@overload
597-
def __getitem__(self: LiteralString, key: SupportsIndex | slice, /) -> LiteralString: ...
598-
@overload
599-
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ... # type: ignore[misc]
513+
def __getitem__(self, key: SupportsIndex | slice, /) -> str: ...
600514
def __gt__(self, value: str, /) -> bool: ...
601515
def __hash__(self) -> int: ...
602-
@overload
603-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
604-
@overload
605516
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
606517
def __le__(self, value: str, /) -> bool: ...
607518
def __len__(self) -> int: ...
608519
def __lt__(self, value: str, /) -> bool: ...
609-
@overload
610-
def __mod__(self: LiteralString, value: LiteralString | tuple[LiteralString, ...], /) -> LiteralString: ...
611-
@overload
612520
def __mod__(self, value: Any, /) -> str: ...
613-
@overload
614-
def __mul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
615-
@overload
616521
def __mul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
617522
def __ne__(self, value: object, /) -> bool: ...
618-
@overload
619-
def __rmul__(self: LiteralString, value: SupportsIndex, /) -> LiteralString: ...
620-
@overload
621523
def __rmul__(self, value: SupportsIndex, /) -> str: ... # type: ignore[misc]
622524
def __getnewargs__(self) -> tuple[str]: ...
623525

0 commit comments

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