mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Accept anything with __getitem__ in str.translate (#8629)
translate table protocol
This commit is contained in:
@@ -406,6 +406,9 @@ class complex:
|
||||
class _FormatMapMapping(Protocol):
|
||||
def __getitem__(self, __key: str) -> Any: ...
|
||||
|
||||
class _TranslateTable(Protocol):
|
||||
def __getitem__(self, __key: int) -> str | int | None: ...
|
||||
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __new__(cls: type[Self], object: object = ...) -> Self: ...
|
||||
@@ -535,7 +538,7 @@ class str(Sequence[str]):
|
||||
def title(self: LiteralString) -> LiteralString: ...
|
||||
@overload
|
||||
def title(self) -> str: ... # type: ignore[misc]
|
||||
def translate(self, __table: Mapping[int, int | str | None] | Sequence[int | str | None]) -> str: ...
|
||||
def translate(self, __table: _TranslateTable) -> str: ...
|
||||
@overload
|
||||
def upper(self: LiteralString) -> LiteralString: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user