Skip to content

Commit dd3aedd

Browse files
authored
Correct str.maketrans and collections.UserString.maketrans (#9611)
1 parent 2ffd867 commit dd3aedd

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

stdlib/builtins.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,10 @@ class str(Sequence[str]):
551551
def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
552552
@staticmethod
553553
@overload
554-
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
554+
def maketrans(__x: str, __y: str) -> dict[int, int]: ...
555+
@staticmethod
556+
@overload
557+
def maketrans(__x: str, __y: str, __z: str) -> dict[int, int | None]: ...
555558
@overload
556559
def __add__(self: LiteralString, __s: LiteralString) -> LiteralString: ...
557560
@overload

stdlib/collections/__init__.pyi

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,7 @@ class UserString(Sequence[UserString]):
191191
def ljust(self: Self, width: int, *args: Any) -> Self: ...
192192
def lower(self: Self) -> Self: ...
193193
def lstrip(self: Self, chars: str | None = None) -> Self: ...
194-
@staticmethod
195-
@overload
196-
def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
197-
@staticmethod
198-
@overload
199-
def maketrans(x: str, y: str, z: str = ...) -> dict[int, int | None]: ...
194+
maketrans = str.maketrans
200195
def partition(self, sep: str) -> tuple[str, str, str]: ...
201196
if sys.version_info >= (3, 9):
202197
def removeprefix(self: Self, __prefix: str | UserString) -> Self: ...

tests/stubtest_allowlists/py37.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ collections.AsyncGenerator.ag_frame
2424
collections.AsyncGenerator.ag_running
2525
collections.Callable
2626
collections.Mapping.__reversed__ # Set to None at runtime for a better error message
27-
collections.UserString.maketrans
2827
contextvars.ContextVar.get
2928
distutils.command.bdist_wininst # see #6523
3029
dummy_threading.Condition.acquire

0 commit comments

Comments
 (0)