mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-21 18:42:07 +08:00
Fix return types in urllib.request (#2389)
* Tighten return types of URL handlers * urlopen() etc. return a modified HTTPResponse * Add missing methods to HTTPResponse
This commit is contained in:
committed by
Rebecca Chen
parent
d70a6cbcc0
commit
9827132d5b
@@ -104,6 +104,9 @@ if sys.version_info >= (3, 5):
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[types.TracebackType]) -> bool: ...
|
||||
def info(self) -> email.message.Message: ...
|
||||
def geturl(self) -> str: ...
|
||||
def getcode(self) -> int: ...
|
||||
else:
|
||||
class HTTPResponse(io.RawIOBase, BinaryIO): # type: ignore
|
||||
msg = ... # type: HTTPMessage
|
||||
@@ -126,6 +129,9 @@ else:
|
||||
def __exit__(self, exc_type: Optional[Type[BaseException]],
|
||||
exc_val: Optional[BaseException],
|
||||
exc_tb: Optional[types.TracebackType]) -> bool: ...
|
||||
def info(self) -> email.message.Message: ...
|
||||
def geturl(self) -> str: ...
|
||||
def getcode(self) -> int: ...
|
||||
|
||||
class HTTPConnection:
|
||||
if sys.version_info >= (3, 7):
|
||||
|
||||
Reference in New Issue
Block a user