diff --git a/stdlib/2/urllib.pyi b/stdlib/2/urllib.pyi index fde604f29..12836231c 100644 --- a/stdlib/2/urllib.pyi +++ b/stdlib/2/urllib.pyi @@ -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