8000 Correct `str.maketrans` and `collections.UserString.maketrans` by AlexWaygood · Pull Request #9611 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Correct str.maketrans and collections.UserString.maketrans #9611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000 Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,10 @@ class str(Sequence[str]):
def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
@staticmethod
@overload
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
def maketrans(__x: str, __y: str) -> dict[int, int]: ...
@staticmethod
@overload
def maketrans(__x: str, __y: str, __z: str) -> dict[int, int | None]: ...
@overload
def __add__(self: LiteralString, __s: LiteralString) -> LiteralString: ...
@overload
Expand Down
7 changes: 1 addition & 6 deletions stdlib/collections/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,7 @@ class UserString(Sequence[UserString]):
def ljust(self: Self, width: int, *args: Any) -> Self: ...
def lower(self: Self) -> Self: ...
def lstrip(self: Self, chars: str | None = None) -> Self: ...
@staticmethod
@overload
def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
@staticmethod
@overload
def maketrans(x: str, y: str, z: str = ...) -> dict[int, int | None]: ...
maketrans = str.maketrans
def partition(self, sep: str) -> tuple[str, str, str]: ...
if sys.version_info >= (3, 9):
def removeprefix(self: Self, __prefix: str | UserString) -> Self: ...
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ collections.AsyncGenerator.ag_frame
collections.AsyncGenerator.ag_running
collections.Callable
collections.Mapping.__reversed__ # Set to None at runtime for a better error message
collections.UserString.maketrans
contextvars.ContextVar.get
distutils.command.bdist_wininst # see #6523
dummy_threading.Condition.acquire
Expand Down
0