Add missing definitions for urllib/response.pyi (#4118)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Teddy Sudol
2020-05-28 04:48:27 -07:00
committed by GitHub
parent 0cffa59e57
commit 313a835bea
2 changed files with 10 additions and 3 deletions

View File

@@ -1,12 +1,14 @@
# private module, we only expose what's needed
from typing import BinaryIO, Iterable, List, Mapping, Optional, Type, TypeVar
from typing import Any, BinaryIO, Callable, IO, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar
from email.message import Message
from types import TracebackType
_AIUT = TypeVar("_AIUT", bound=addbase)
class addbase(BinaryIO):
fp: IO[bytes]
def __init__(self, fp: IO[bytes]) -> None: ...
def __enter__(self: _AIUT) -> _AIUT: ...
def __exit__(self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> None: ...
def __iter__(self: _AIUT) -> _AIUT: ...
@@ -31,12 +33,19 @@ class addbase(BinaryIO):
def write(self, s: bytes) -> int: ...
def writelines(self, lines: Iterable[bytes]) -> None: ...
class addclosehook(addbase):
closehook: Callable[..., object]
hookargs: Tuple[Any, ...]
def __init__(self, fp: IO[bytes], closehook: Callable[..., object], *hookargs: Any) -> None: ...
class addinfo(addbase):
headers: Message
def __init__(self, fp: IO[bytes], headers: Message) -> None: ...
def info(self) -> Message: ...
class addinfourl(addinfo):
url: str
code: int
def __init__(self, fp: IO[bytes], headers: Message, url: str, code: Optional[int] = ...) -> None: ...
def geturl(self) -> str: ...
def getcode(self) -> int: ...

View File

@@ -493,8 +493,6 @@ urllib.error.URLError.__init__
urllib.parse._DefragResultBase.__new__
urllib.request.BaseHandler.http_error_nnn
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__
urllib.response.addinfo.__init__
urllib.response.addinfourl.__init__
urllib.robotparser.RobotFileParser.can_fetch
warnings.catch_warnings.__init__
weakref.CallableProxyType.__getattr__