Change type for urllib headers from Mapping to email.message.Message (#3345)

Also remove override of 'headers' in HTTPError

Closes #3344
This commit is contained in:
Maarten ter Huurne
2019-10-11 14:56:19 +02:00
committed by Sebastian Rittau
parent bb12f3bdea
commit 6a92ae6295
2 changed files with 3 additions and 3 deletions

View File

@@ -7,6 +7,5 @@ class URLError(IOError):
reason: Union[str, BaseException]
class HTTPError(URLError, addinfourl):
code: int
headers: Dict[str, str]
def __init__(self, url, code, msg, hdrs, fp) -> None: ...
class ContentTooShortError(URLError): ...

View File

@@ -1,6 +1,7 @@
# private module, we only expose what's needed
from typing import BinaryIO, Iterable, List, Mapping, Optional, Type, TypeVar
from email.message import Message
from types import TracebackType
_AIUT = TypeVar("_AIUT", bound=addbase)
@@ -31,8 +32,8 @@ class addbase(BinaryIO):
def writelines(self, lines: Iterable[bytes]) -> None: ...
class addinfo(addbase):
headers: Mapping[str, str]
def info(self) -> Mapping[str, str]: ...
headers: Message
def info(self) -> Message: ...
class addinfourl(addinfo):
url: str