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

+292
-3
lines changed

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")

stdlib/webbrowser.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ from abc import abstractmethod
33
from typing import Callable, Sequence
44
from typing_extensions import Literal
55

6+
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
7+
68
class Error(Exception): ...
79

810
if sys.version_info >= (3, 7):

stdlib/wsgiref/handlers.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ from .headers import Headers
66
from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment
77
from .util import FileWrapper
88

9+
__all__ = ["BaseHandler", "SimpleHandler", "BaseCGIHandler", "CGIHandler", "IISCGIHandler", "read_environ"]
10+
911
_exc_info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]]
1012

1113
def format_date_time(timestamp: float | None) -> str: ... # undocumented

stdlib/wsgiref/simple_server.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ from typing import TypeVar, overload
44
from .handlers import SimpleHandler
55
from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment
66

7+
__all__ = ["WSGIServer", "WSGIRequestHandler", "demo_app", "make_server"]
8+
79
server_version: str # undocumented
810
sys_version: str # undocumented
911
software_version: str # undocumented

stdlib/wsgiref/util.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ from typing import IO, Any, Callable
33

44
from .types import WSGIEnvironment
55

6+
__all__ = ["FileWrapper", "guess_scheme", "application_uri", "request_uri", "shift_path_info", "setup_testing_defaults"]
7+
68
class FileWrapper:
79
filelike: IO[bytes]
810
blksize: int

stdlib/wsgiref/validate.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication
22
from typing import Any, Callable, Iterable, Iterator, NoReturn
33

4+
__all__ = ["validator"]
5+
46
class WSGIWarning(Warning): ...
57

68
def validator(application: WSGIApplication) -> WSGIApplication: ...

stdlib/xdrlib.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import Callable, Sequence, TypeVar
22

3+
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
4+
35
_T = TypeVar("_T")
46

57
class Error(Exception):

stdlib/xml/dom/minicompat.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import Any, Iterable, TypeVar
22

3+
__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"]
4+
35
_T = TypeVar("_T")
46

57
StringTypes: tuple[type[str]]

stdlib/xml/dom/xmlbuilder.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ from urllib.request import OpenerDirector
44
from xml.dom.expatbuilder import ExpatBuilder, ExpatBuilderNS
55
from xml.dom.minidom import Node
66

7+
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
8+
79
# UNKNOWN TYPES:
810
# - `Options.errorHandler`.
911
# The same as `_DOMBuilderErrorHandlerType`?

stdlib/xml/etree/ElementTree.pyi

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,90 @@ from typing import (
1717
)
1818
from typing_extensions import Literal, SupportsIndex, TypeGuard
1919

20+
if sys.version_info >= (3, 9):
21+
__all__ = [
22+
"Comment",
23+
"dump",
24+
"Element",
25+
"ElementTree",
26+
"fromstring",
27+
"fromstringlist",
28+
"indent",
29+
"iselement",
30+
"iterparse",
31+
"parse",
32+
"ParseError",
33+
"PI",
34+
"ProcessingInstruction",
35+
"QName",
36+
"SubElement",
37+
"tostring",
38+
"tostringlist",
39+
"TreeBuilder",
40+
"VERSION",
41+
"XML",
42+
"XMLID",
43+
"XMLParser",
44+
"XMLPullParser",
45+
"register_namespace",
46+
"canonicalize",
47+
"C14NWriterTarget",
48+
]
49+
elif sys.version_info >= (3, 8):
50+
__all__ = [
51+
"Comment",
52+
"dump",
53+
"Element",
54+
"ElementTree",
55+
"fromstring",
56+
"fromstringlist",
57+
"iselement",
58+
"iterparse",
59+
"parse",
60+
"ParseError",
61+
"PI",
62+
"ProcessingInstruction",
63+
"QName",
64+
"SubElement",
65+
"tostring",
66+
"tostringlist",
67+
"TreeBuilder",
68+
"VERSION",
69+
"XML",
70+
"XMLID",
71+
"XMLParser",
72+
"XMLPullParser",
73+
"register_namespace",
74+
"canonicalize",
75+
"C14NWriterTarget",
76+
]
77+
else:
78+
__all__ = [
79+
"Comment",
80+
"dump",
81+
"Element",
82+
"ElementTree",
83+
"fromstring",
84+
"fromstringlist",
85+
"iselement",
86+
"iterparse",
87+
"parse",
88+
"ParseError",
89+
"PI",
90+
"ProcessingInstruction",
91+
"QName",
92+
"SubElement",
93+
"tostring",
94+
"tostringlist",
95+
"TreeBuilder",
96+
"VERSION",
97+
"XML",
98+
"XMLID",
99+
"XMLParser",
100+
"XMLPullParser",
101+
"register_namespace",
102+
]
103+
20104
_T = TypeVar("_T")
21105
_FileRead = Union[StrOrBytesPath, FileDescriptor, SupportsRead[bytes], SupportsRead[str]]
22106
_FileWriteC14N = Union[StrOrBytesPath, FileDescriptor, SupportsWrite[bytes]]

stdlib/zipapp.pyi

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

5+
__all__ = ["ZipAppError", "create_archive", "get_interpreter"]
6+
57
_Path = Union[str, Path, BinaryIO]
68

79
class ZipAppError(ValueError): ...

0 commit comments

Comments
 (0)