use a Protocol for str.format_map() (#4122)

Fixes #3824
This commit is contained in:
Jelle Zijlstra
2020-05-28 04:27:57 -07:00
committed by GitHub
parent ca553cd589
commit 0cffa59e57
2 changed files with 8 additions and 2 deletions

View File

@@ -407,6 +407,9 @@ else:
_str_base = basestring
class _FormatMapMapping(Protocol):
def __getitem__(self, __key: str) -> Any: ...
class str(Sequence[str], _str_base):
if sys.version_info >= (3,):
@overload
@@ -433,7 +436,7 @@ class str(Sequence[str], _str_base):
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
if sys.version_info >= (3,):
def format_map(self, map: Mapping[str, Any]) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...

View File

@@ -407,6 +407,9 @@ else:
_str_base = basestring
class _FormatMapMapping(Protocol):
def __getitem__(self, __key: str) -> Any: ...
class str(Sequence[str], _str_base):
if sys.version_info >= (3,):
@overload
@@ -433,7 +436,7 @@ class str(Sequence[str], _str_base):
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
if sys.version_info >= (3,):
def format_map(self, map: Mapping[str, Any]) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...