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 dd754cd

Browse filesBrowse files
hauntsaninjamypybot
authored and
mypybot
committed
Remove use of LiteralString in builtins (#13743)
1 parent 6a5eb4b commit dd754cd
Copy full SHA for dd754cd

File tree

1 file changed

+1
-93
lines changed
Filter options

1 file changed

+1
-93
lines changed

‎mypy/typeshed/stdlib/builtins.pyi

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/builtins.pyi
+1-93Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ from typing import ( # noqa: Y027
5454
overload,
5555
type_check_only,
5656
)
57-
from typing_extensions import Literal, LiteralString, SupportsIndex, TypeAlias, TypeGuard, final
57+
from typing_extensions import Literal, SupportsIndex, TypeAlias, TypeGuard, final
5858

5959
if sys.version_info >= (3, 9):
6060
from types import GenericAlias
@@ -413,38 +413,20 @@ class str(Sequence[str]):
413413
def __new__(cls: type[Self], object: object = ...) -> Self: ...
414414
@overload
415415
def __new__(cls: type[Self], object: ReadableBuffer, encoding: str = ..., errors: str = ...) -> Self: ...
416-
@overload
417-
def capitalize(self: LiteralString) -> LiteralString: ...
418-
@overload
419416
def capitalize(self) -> str: ... # type: ignore[misc]
420-
@overload
421-
def casefold(self: LiteralString) -> LiteralString: ...
422-
@overload
423417
def casefold(self) -> str: ... # type: ignore[misc]
424-
@overload
425-
def center(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
426-
@overload
427418
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
428419
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
429420
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
430421
def endswith(
431422
self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
432423
) -> bool: ...
433424
if sys.version_info >= (3, 8):
434-
@overload
435-
def expandtabs(self: LiteralString, tabsize: SupportsIndex = ...) -> LiteralString: ...
436-
@overload
437425
def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ... # type: ignore[misc]
438426
else:
439-
@overload
440-
def expandtabs(self: LiteralString, tabsize: int = ...) -> LiteralString: ...
441-
@overload
442427
def expandtabs(self, tabsize: int = ...) -> str: ... # type: ignore[misc]
443428

444429
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
445-
@overload
446-
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
447-
@overload
448430
def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore[misc]
449431
def format_map(self, map: _FormatMapMapping) -> str: ...
450432
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
@@ -460,127 +442,53 @@ class str(Sequence[str]):
460442
def isspace(self) -> bool: ...
461443
def istitle(self) -> bool: ...
462444
def isupper(self) -> bool: ...
463-
@overload
464-
def join(self: LiteralString, __iterable: Iterable[LiteralString]) -> LiteralString: ...
465-
@overload
466445
def join(self, __iterable: Iterable[str]) -> str: ... # type: ignore[misc]
467-
@overload
468-
def ljust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
469-
@overload
470446
def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
471-
@overload
472-
def lower(self: LiteralString) -> LiteralString: ...
473-
@overload
474447
def lower(self) -> str: ... # type: ignore[misc]
475-
@overload
476-
def lstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
477-
@overload
478448
def lstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
479-
@overload
480-
def partition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
481-
@overload
482449
def partition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
483-
@overload
484-
def replace(
485-
self: LiteralString, __old: LiteralString, __new: LiteralString, __count: SupportsIndex = ...
486-
) -> LiteralString: ...
487-
@overload
488450
def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ... # type: ignore[misc]
489451
if sys.version_info >= (3, 9):
490-
@overload
491-
def removeprefix(self: LiteralString, __prefix: LiteralString) -> LiteralString: ...
492-
@overload
493452
def removeprefix(self, __prefix: str) -> str: ... # type: ignore[misc]
494-
@overload
495-
def removesuffix(self: LiteralString, __suffix: LiteralString) -> LiteralString: ...
496-
@overload
497453
def removesuffix(self, __suffix: str) -> str: ... # type: ignore[misc]
498454

499455
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
500456
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
501-
@overload
502-
def rjust(self: LiteralString, __width: SupportsIndex, __fillchar: LiteralString = ...) -> LiteralString: ...
503-
@overload
504457
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc]
505-
@overload
506-
def rpartition(self: LiteralString, __sep: LiteralString) -> tuple[LiteralString, LiteralString, LiteralString]: ...
507-
@overload
508458
def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc]
509-
@overload
510-
def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
511-
@overload
512459
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
513-
@overload
514-
def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
515-
@overload
516460
def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
517-
@overload
518-
def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ...
519-
@overload
520461
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc]
521-
@overload
522-
def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ...
523-
@overload
524462
def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc]
525463
def startswith(
526464
self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
527465
) -> bool: ...
528-
@overload
529-
def strip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ...
530-
@overload
531466
def strip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc]
532-
@overload
533-
def swapcase(self: LiteralString) -> LiteralString: ...
534-
@overload
535467
def swapcase(self) -> str: ... # type: ignore[misc]
536-
@overload
537-
def title(self: LiteralString) -> LiteralString: ...
538-
@overload
539468
def title(self) -> str: ... # type: ignore[misc]
540469
def translate(self, __table: _TranslateTable) -> str: ...
541-
@overload
542-
def upper(self: LiteralString) -> LiteralString: ...
543-
@overload
544470
def upper(self) -> str: ... # type: ignore[misc]
545-
@overload
546-
def zfill(self: LiteralString, __width: SupportsIndex) -> LiteralString: ...
547-
@overload
548471
def zfill(self, __width: SupportsIndex) -> str: ... # type: ignore[misc]
549472
@staticmethod
550473
@overload
551474
def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
552475
@staticmethod
553476
@overload
554477
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
555-
@overload
556-
def __add__(self: LiteralString, __s: LiteralString) -> LiteralString: ...
557-
@overload
558478
def __add__(self, __s: str) -> str: ... # type: ignore[misc]
559479
# Incompatible with Sequence.__contains__
560480
def __contains__(self, __o: str) -> bool: ... # type: ignore[override]
561481
def __eq__(self, __x: object) -> bool: ...
562482
def __ge__(self, __x: str) -> bool: ...
563483
def __getitem__(self, __i: SupportsIndex | slice) -> str: ...
564484
def __gt__(self, __x: str) -> bool: ...
565-
@overload
566-
def __iter__(self: LiteralString) -> Iterator[LiteralString]: ...
567-
@overload
568485
def __iter__(self) -> Iterator[str]: ... # type: ignore[misc]
569486
def __le__(self, __x: str) -> bool: ...
570487
def __len__(self) -> int: ...
571488
def __lt__(self, __x: str) -> bool: ...
572-
@overload
573-
def __mod__(self: LiteralString, __x: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
574-
@overload
575489
def __mod__(self, __x: Any) -> str: ... # type: ignore[misc]
576-
@overload
577-
def __mul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ...
578-
@overload
579490
def __mul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc]
580491
def __ne__(self, __x: object) -> bool: ...
581-
@overload
582-
def __rmul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ...
583-
@overload
584492
def __rmul__(self, __n: SupportsIndex) -> str: ... # type: ignore[misc]
585493
def __getnewargs__(self) -> tuple[str]: ...
586494

0 commit comments

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