Fix collections.Userstring.encode() (#4787)

* Revert Python 2 part of ba223399, the stub was correct

* Describe UserString.encode() return type correctly for Python <3.8
This commit is contained in:
Lourens Veen
2020-11-25 02:27:29 +01:00
committed by GitHub
parent 62546ed827
commit ee69dd4de7
2 changed files with 5 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ class UserString(Sequence[UserString]):
def center(self: _UST, width: int, *args: Any) -> _UST: ...
def count(self, sub: int, start: int = ..., end: int = ...) -> int: ...
def decode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> str: ...
def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ...
def endswith(self, suffix: Text, start: int = ..., end: int = ...) -> bool: ...
def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ...
def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ...

View File

@@ -137,7 +137,10 @@ class UserString(Sequence[str]):
def casefold(self: _UserStringT) -> _UserStringT: ...
def center(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ...
def count(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ...
if sys.version_info >= (3, 8):
def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ...
else:
def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UserStringT: ...
def endswith(self, suffix: Union[str, Tuple[str, ...]], start: int = ..., end: int = ...) -> bool: ...
def expandtabs(self: _UserStringT, tabsize: int = ...) -> _UserStringT: ...
def find(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...