Skip to content

Commit 58e505e

Browse files
authored
Add __all__ for modules beginning with 'u', 'x', 'w' and 'z' (#7374)
1 parent 7b024f5 commit 58e505e

23 files changed

Lines changed: 292 additions & 3 deletions

stdlib/unittest/__init__.pyi

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,55 @@ if sys.version_info >= (3, 8):
3232

3333
from .case import addModuleCleanup as addModuleCleanup
3434

35+
__all__ = [
36+
"TestResult",
37+
"TestCase",
38+
"IsolatedAsyncioTestCase",
39+
"TestSuite",
40+
"TextTestRunner",
41+
"TestLoader",
42+
"FunctionTestCase",
43+
"main",
44+
"defaultTestLoader",
45+
"SkipTest",
46+
"skip",
47+
"skipIf",
48+
"skipUnless",
49+
"expectedFailure",
50+
"TextTestResult",
51+
"installHandler",
52+
"registerResult",
53+
"removeResult",
54+
"removeHandler",
55+
"addModuleCleanup",
56+
"getTestCaseNames",
57+
"makeSuite",
58+
"findTestCases",
59+
]
60+
61+
else:
62+
__all__ = [
63+
"TestResult",
64+
"TestCase",
65+
"TestSuite",
66+
"TextTestRunner",
67+
"TestLoader",
68+
"FunctionTestCase",
69+
"main",
70+
"defaultTestLoader",
71+
"SkipTest",
72+
"skip",
73+
"skipIf",
74+
"skipUnless",
75+
"expectedFailure",
76+
"TextTestResult",
77+
"installHandler",
78+
"registerResult",
79+
"removeResult",
80+
"removeHandler",
81+
"getTestCaseNames",
82+
"makeSuite",
83+
"findTestCases",
84+
]
85+
3586
def load_tests(loader: TestLoader, tests: TestSuite, pattern: str | None) -> TestSuite: ...

stdlib/urllib/error.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from email.message import Message
22
from typing import IO
33
from urllib.response import addinfourl
44

5-
# Stubs for urllib.error
5+
__all__ = ["URLError", "HTTPError", "ContentTooShortError"]
66

77
class URLError(IOError):
88
reason: str | BaseException

stdlib/urllib/parse.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence
44
if sys.version_info >= (3, 9):
55
from types import GenericAlias
66

7+
__all__ = [
8+
"urlparse",
9+
"urlunparse",
10+
"urljoin",
11+
"urldefrag",
12+
"urlsplit",
13+
"urlunsplit",
14+
"urlencode",
15+
"parse_qs",
16+
"parse_qsl",
17+
"quote",
18+
"quote_plus",
19+
"quote_from_bytes",
20+
"unquote",
21+
"unquote_plus",
22+
"unquote_to_bytes",
23+
"DefragResult",
24+
"ParseResult",
25+
"SplitResult",
26+
"DefragResultBytes",
27+
"ParseResultBytes",
28+
"SplitResultBytes",
29+
]
30+
731
_Str = Union[bytes, str]
832

933
uses_relative: list[str]

stdlib/urllib/request.pyi

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,43 @@ from typing import IO, Any, Callable, ClassVar, Iterable, Mapping, MutableMappin
88
from urllib.error import HTTPError
99
from urllib.response import addclosehook, addinfourl
1010

11+
__all__ = [
12+
"Request",
13+
"OpenerDirector",
14+
"BaseHandler",
15+
"HTTPDefaultErrorHandler",
16+
"HTTPRedirectHandler",
17+
"HTTPCookieProcessor",
18+
"ProxyHandler",
19+
"HTTPPasswordMgr",
20+
"HTTPPasswordMgrWithDefaultRealm",
21+
"HTTPPasswordMgrWithPriorAuth",
22+
"AbstractBasicAuthHandler",
23+
"HTTPBasicAuthHandler",
24+
"ProxyBasicAuthHandler",
25+
"AbstractDigestAuthHandler",
26+
"HTTPDigestAuthHandler",
27+
"ProxyDigestAuthHandler",
28+
"HTTPHandler",
29+
"FileHandler",
30+
"FTPHandler",
31+
"CacheFTPHandler",
32+
"DataHandler",
33+
"UnknownHandler",
34+
"HTTPErrorProcessor",
35+
"urlopen",
36+
"install_opener",
37+
"build_opener",
38+
"pathname2url",
39+
"url2pathname",
40+
"getproxies",
41+
"urlretrieve",
42+
"urlcleanup",
43+
"URLopener",
44+
"FancyURLopener",
45+
"HTTPSHandler",
46+
]
47+
1148
_T = TypeVar("_T")
1249
_UrlopenRet = Any
1350
_DataType = bytes | SupportsRead[bytes] | Iterable[bytes] | None

stdlib/urllib/response.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ from email.message import Message
44
from types import TracebackType
55
from typing import IO, Any, BinaryIO, Callable, Iterable
66

7+
__all__ = ["addbase", "addclosehook", "addinfo", "addinfourl"]
8+
79
class addbase(BinaryIO):
810
fp: IO[bytes]
911
def __init__(self, fp: IO[bytes]) -> None: ...

stdlib/urllib/robotparser.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import sys
22
from typing import Iterable, NamedTuple
33

4-
class _RequestRate(NamedTuple):
4+
__all__ = ["RobotFileParser"]
5+
6+
class RequestRate(NamedTuple):
57
requests: int
68
seconds: int
79

@@ -14,6 +16,6 @@ class RobotFileParser:
1416
def mtime(self) -> int: ...
1517
def modified(self) -> None: ...
1618
def crawl_delay(self, useragent: str) -> str | None: ...
17-
def request_rate(self, useragent: str) -> _RequestRate | None: ...
19+
def request_rate(self, useragent: str) -> RequestRate | None: ...
1820
if sys.version_info >= (3, 8):
1921
def site_maps(self) -> list[str] | None: ...

stdlib/uu.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import sys
22
from typing import BinaryIO, Union
33

4+
__all__ = ["Error", "encode", "decode"]
5+
46
_File = Union[str, BinaryIO]
57

68
class Error(Exception): ...

stdlib/warnings.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ from types import ModuleType, TracebackType
33
from typing import Any, Sequence, TextIO, overload
44
from typing_extensions import Literal
55

6+
__all__ = [
7+
"warn",
8+
"warn_explicit",
9+
"showwarning",
10+
"formatwarning",
11+
"filterwarnings",
12+
"simplefilter",
13+
"resetwarnings",
14+
"catch_warnings",
15+
]
16+
617
_ActionKind = Literal["default", "error", "ignore", "always", "module", "once"]
718

819
filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate

stdlib/wave.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ from _typeshed import ReadableBuffer, Self
33
from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, Union, overload
44
from typing_extensions import Literal
55

6+
if sys.version_info >= (3, 9):
7+
__all__ = ["open", "Error", "Wave_read", "Wave_write"]
8+
else:
9+
__all__ = ["open", "openfp", "Error", "Wave_read", "Wave_write"]
10+
611
_File = Union[str, IO[bytes]]
712

813
class Error(Exception): ...

stdlib/weakref.pyi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ from _weakref import (
1414
ref as ref,
1515
)
1616

17+
__all__ = [
18+
"ref",
19+
"proxy",
20+
"getweakrefcount",
21+
"getweakrefs",
22+
"WeakKeyDictionary",
23+
"ReferenceType",
24+
"ProxyType",
25+
"CallableProxyType",
26+
"ProxyTypes",
27+
"WeakValueDictionary",
28+
"WeakSet",
29+
"WeakMethod",
30+
"finalize",
31+
]
32+
1733
_T = TypeVar("_T")
1834
_T1 = TypeVar("_T1")
1935
_T2 = TypeVar("_T2")

0 commit comments

Comments
 (0)