Add __all__ for modules beginning with 'u', 'x', 'w' and 'z' (#7374)

This commit is contained in:
Alex Waygood
2022-02-23 22:04:21 +00:00
committed by GitHub
parent 7b024f5e9a
commit 58e505eeb2
23 changed files with 292 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ from email.message import Message
from typing import IO
from urllib.response import addinfourl
# Stubs for urllib.error
__all__ = ["URLError", "HTTPError", "ContentTooShortError"]
class URLError(IOError):
reason: str | BaseException

View File

@@ -4,6 +4,30 @@ from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = [
"urlparse",
"urlunparse",
"urljoin",
"urldefrag",
"urlsplit",
"urlunsplit",
"urlencode",
"parse_qs",
"parse_qsl",
"quote",
"quote_plus",
"quote_from_bytes",
"unquote",
"unquote_plus",
"unquote_to_bytes",
"DefragResult",
"ParseResult",
"SplitResult",
"DefragResultBytes",
"ParseResultBytes",
"SplitResultBytes",
]
_Str = Union[bytes, str]
uses_relative: list[str]

View File

@@ -8,6 +8,43 @@ from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, MutableMappin
from urllib.error import HTTPError
from urllib.response import addclosehook, addinfourl
__all__ = [
"Request",
"OpenerDirector",
"BaseHandler",
"HTTPDefaultErrorHandler",
"HTTPRedirectHandler",
"HTTPCookieProcessor",
"ProxyHandler",
"HTTPPasswordMgr",
"HTTPPasswordMgrWithDefaultRealm",
"HTTPPasswordMgrWithPriorAuth",
"AbstractBasicAuthHandler",
"HTTPBasicAuthHandler",
"ProxyBasicAuthHandler",
"AbstractDigestAuthHandler",
"HTTPDigestAuthHandler",
"ProxyDigestAuthHandler",
"HTTPHandler",
"FileHandler",
"FTPHandler",
"CacheFTPHandler",
"DataHandler",
"UnknownHandler",
"HTTPErrorProcessor",
"urlopen",
"install_opener",
"build_opener",
"pathname2url",
"url2pathname",
"getproxies",
"urlretrieve",
"urlcleanup",
"URLopener",
"FancyURLopener",
"HTTPSHandler",
]
_T = TypeVar("_T")
_UrlopenRet = Any
_DataType = bytes | SupportsRead[bytes] | Iterable[bytes] | None

View File

@@ -4,6 +4,8 @@ from email.message import Message
from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable
__all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"]
class addbase(BinaryIO):
fp: IO[bytes]
def __init__(self, fp: IO[bytes]) -> None: ...

View File

@@ -1,7 +1,9 @@
import sys
from typing import Iterable, NamedTuple
class _RequestRate(NamedTuple):
__all__ = ["RobotFileParser"]
class RequestRate(NamedTuple):
requests: int
seconds: int
@@ -14,6 +16,6 @@ class RobotFileParser:
def mtime(self) -> int: ...
def modified(self) -> None: ...
def crawl_delay(self, useragent: str) -> str | None: ...
def request_rate(self, useragent: str) -> _RequestRate | None: ...
def request_rate(self, useragent: str) -> RequestRate | None: ...
if sys.version_info >= (3, 8):
def site_maps(self) -> list[str] | None: ...