mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 04:11:28 +08:00
Expand Python 2's urllib.addbase definition. (#2601)
Give it enough information to determine that addinfourl is iterable and that iteration and read methods return bytes. Modeled after what is in stdlib/3/urllib/response.pyi after confirming by looking at Python 2.7 stdlib code.
This commit is contained in:
committed by
Sebastian Rittau
parent
cd4572e43c
commit
5d85326ad8
@@ -1,4 +1,4 @@
|
||||
from typing import Any, AnyStr, IO, Mapping, Sequence, Text, Tuple, Union
|
||||
from typing import Any, AnyStr, IO, List, Mapping, Sequence, Text, Tuple, TypeVar, Union
|
||||
|
||||
def url2pathname(pathname: str) -> str: ...
|
||||
def pathname2url(pathname: str) -> str: ...
|
||||
@@ -77,16 +77,18 @@ class ftpwrapper:
|
||||
def file_close(self): ...
|
||||
def real_close(self): ...
|
||||
|
||||
_AIUT = TypeVar("_AIUT", bound=addbase)
|
||||
|
||||
class addbase:
|
||||
fp = ... # type: Any
|
||||
read = ... # type: Any
|
||||
readline = ... # type: Any
|
||||
readlines = ... # type: Any
|
||||
fileno = ... # type: Any
|
||||
__iter__ = ... # type: Any
|
||||
next = ... # type: Any
|
||||
def read(self, n: int = ...) -> bytes: ...
|
||||
def readline(self, limit: int = ...) -> bytes: ...
|
||||
def readlines(self, hint: int = ...) -> List[bytes]: ...
|
||||
def fileno(self) -> int: ... # Optional[int], but that is rare
|
||||
def __iter__(self: _AIUT) -> _AIUT: ...
|
||||
def next(self) -> bytes: ...
|
||||
def __init__(self, fp) -> None: ...
|
||||
def close(self): ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class addclosehook(addbase):
|
||||
closehook = ... # type: Any
|
||||
|
||||
Reference in New Issue
Block a user