mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
urlretrieve can accept filename: pathlib.Path for Python>=3.6 (#2194)
This commit is contained in:
committed by
Jelle Zijlstra
parent
eef0b1d562
commit
48904699ec
@@ -10,7 +10,7 @@ from email.message import Message
|
||||
from urllib.response import addinfourl
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
import os
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_UrlopenRet = Union[HTTPResponse, addinfourl]
|
||||
@@ -187,10 +187,14 @@ class HTTPErrorProcessor(BaseHandler):
|
||||
def http_response(self) -> _UrlopenRet: ...
|
||||
def https_response(self) -> _UrlopenRet: ...
|
||||
|
||||
|
||||
def urlretrieve(url: str, filename: Optional[str] = ...,
|
||||
reporthook: Optional[Callable[[int, int, int], None]] = ...,
|
||||
data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def urlretrieve(url: str, filename: Optional[Union[str, os.PathLike]] = ...,
|
||||
reporthook: Optional[Callable[[int, int, int], None]] = ...,
|
||||
data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ...
|
||||
else:
|
||||
def urlretrieve(url: str, filename: Optional[str] = ...,
|
||||
reporthook: Optional[Callable[[int, int, int], None]] = ...,
|
||||
data: Optional[bytes] = ...) -> Tuple[str, HTTPMessage]: ...
|
||||
def urlcleanup() -> None: ...
|
||||
|
||||
class URLopener:
|
||||
|
||||
Reference in New Issue
Block a user