Skip to content

Commit a3bb5af

Browse files
authored
Add __all__ to most modules beginning with 'q', 'r' and 's' (#7364)
1 parent 240628c commit a3bb5af

19 files changed

+364
-0
lines changed

stdlib/queue.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ from typing import Any, Generic, TypeVar
55
if sys.version_info >= (3, 9):
66
from types import GenericAlias
77

8+
if sys.version_info >= (3, 7):
9+
__all__ = ["Empty", "Full", "Queue", "PriorityQueue", "LifoQueue", "SimpleQueue"]
10+
else:
11+
__all__ = ["Empty", "Full", "Queue", "PriorityQueue", "LifoQueue"]
12+
813
_T = TypeVar("_T")
914

1015
class Empty(Exception): ...

stdlib/quopri.pyi

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

3+
__all__ = ["encode", "decode", "encodestring", "decodestring"]
4+
35
def encode(input: BinaryIO, output: BinaryIO, quotetabs: int, header: int = ...) -> None: ...
46
def encodestring(s: bytes, quotetabs: int = ..., header: int = ...) -> bytes: ...
57
def decode(input: BinaryIO, output: BinaryIO, header: int = ...) -> None: ...

stdlib/random.pyi

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,62 @@ from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set a
55
from fractions import Fraction
66
from typing import Any, ClassVar, NoReturn, TypeVar
77

8+
if sys.version_info >= (3, 9):
9+
__all__ = [
10+
"Random",
11+
"SystemRandom",
12+
"betavariate",
13+
"choice",
14+
"choices",
15+
"expovariate",
16+
"gammavariate",
17+
"gauss",
18+
"getrandbits",
19+
"getstate",
20+
"lognormvariate",
21+
"normalvariate",
22+
"paretovariate",
23+
"randbytes",
24+
"randint",
25+
"random",
26+
"randrange",
27+
"sample",
28+
"seed",
29+
"setstate",
30+
"shuffle",
31+
"triangular",
32+
"uniform",
33+
"vonmisesvariate",
34+
"weibullvariate",
35+
]
36+
else:
37+
__all__ = [
38+
"Random",
39+
"seed",
40+
"random",
41+
"uniform",
42+
"randint",
43+
"choice",
44+
"sample",
45+
"randrange",
46+
"shuffle",
47+
"normalvariate",
48+
"lognormvariate",
49+
"expovariate",
50+
"vonmisesvariate",
51+
"gammavariate",
52+
"triangular",
53+
"gauss",
54+
"betavariate",
55+
"paretovariate",
56+
"weibullvariate",
57+
"getstate",
58+
"setstate",
59+
"getrandbits",
60+
"choices",
61+
"SystemRandom",
62+
]
63+
864
_T = TypeVar("_T")
965

1066
class Random(_random.Random):

stdlib/re.pyi

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,103 @@ if sys.version_info >= (3, 7):
99
else:
1010
from typing import Match, Pattern
1111

12+
if sys.version_info >= (3, 11):
13+
__all__ = [
14+
"match",
15+
"fullmatch",
16+
"search",
17+
"sub",
18+
"subn",
19+
"split",
20+
"findall",
21+
"finditer",
22+
"compile",
23+
"purge",
24+
"template",
25+
"escape",
26+
"error",
27+
"Pattern",
28+
"Match",
29+
"A",
30+
"I",
31+
"L",
32+
"M",
33+
"S",
34+
"X",
35+
"U",
36+
"ASCII",
37+
"IGNORECASE",
38+
"LOCALE",
39+
"MULTILINE",
40+
"DOTALL",
41+
"VERBOSE",
42+
"UNICODE",
43+
"RegexFlag",
44+
"NOFLAG",
45+
]
46+
elif sys.version_info >= (3, 8):
47+
__all__ = [
48+
"match",
49+
"fullmatch",
50+
"search",
51+
"sub",
52+
"subn",
53+
"split",
54+
"findall",
55+
"finditer",
56+
"compile",
57+
"purge",
58+
"template",
59+
"escape",
60+
"error",
61+
"Pattern",
62+
"Match",
63+
"A",
64+
"I",
65+
"L",
66+
"M",
67+
"S",
68+
"X",
69+
"U",
70+
"ASCII",
71+
"IGNORECASE",
72+
"LOCALE",
73+
"MULTILINE",
74+
"DOTALL",
75+
"VERBOSE",
76+
"UNICODE",
77+
]
78+
else:
79+
__all__ = [
80+
"match",
81+
"fullmatch",
82+
"search",
83+
"sub",
84+
"subn",
85+
"split",
86+
"findall",
87+
"finditer",
88+
"compile",
89+
"purge",
90+
"template",
91+
"escape",
92+
"error",
93+
"A",
94+
"I",
95+
"L",
96+
"M",
97+
"S",
98+
"X",
99+
"U",
100+
"ASCII",
101+
"IGNORECASE",
102+
"LOCALE",
103+
"MULTILINE",
104+
"DOTALL",
105+
"VERBOSE",
106+
"UNICODE",
107+
]
108+
12109
class RegexFlag(enum.IntFlag):
13110
A: int
14111
ASCII: int

stdlib/reprlib.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ from array import array
22
from collections import deque
33
from typing import Any, Callable
44

5+
__all__ = ["Repr", "repr", "recursive_repr"]
6+
57
_ReprFunc = Callable[[Any], str]
68

79
def recursive_repr(fillvalue: str = ...) -> Callable[[_ReprFunc], _ReprFunc]: ...

stdlib/rlcompleter.pyi

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

3+
__all__ = ["Completer"]
4+
35
class Completer:
46
def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ...
57
def complete(self, text: str, state: int) -> str | None: ...

stdlib/secrets.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ from hmac import compare_digest as compare_digest
33
from random import SystemRandom as SystemRandom
44
from typing import TypeVar
55

6+
__all__ = ["choice", "randbelow", "randbits", "SystemRandom", "token_bytes", "token_hex", "token_urlsafe", "compare_digest"]
7+
68
_T = TypeVar("_T")
79

810
def randbelow(exclusive_upper_bound: int) -> int: ...

stdlib/shelve.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ from dbm import _TFlags
44
from types import TracebackType
55
from typing import TypeVar, overload
66

7+
__all__ = ["Shelf", "BsdDbShelf", "DbfilenameShelf", "open"]
8+
79
_T = TypeVar("_T")
810
_VT = TypeVar("_VT")
911

stdlib/shlex.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import sys
22
from _typeshed import Self
33
from typing import Iterable, TextIO
44

5+
if sys.version_info >= (3, 8):
6+
__all__ = ["shlex", "split", "quote", "join"]
7+
else:
8+
__all__ = ["shlex", "split", "quote"]
9+
510
def split(s: str, comments: bool = ..., posix: bool = ...) -> list[str]: ...
611

712
if sys.version_info >= (3, 8):

stdlib/shutil.pyi

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,35 @@ import sys
33
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
44
from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, TypeVar, Union, overload
55

6+
__all__ = [
7+
"copyfileobj",
8+
"copyfile",
9+
"copymode",
10+
"copystat",
11+
"copy",
12+
"copy2",
13+
"copytree",
14+
"move",
15+
"rmtree",
16+
"Error",
17+
"SpecialFileError",
18+
"ExecError",
19+
"make_archive",
20+
"get_archive_formats",
21+
"register_archive_format",
22+
"unregister_archive_format",
23+
"get_unpack_formats",
24+
"register_unpack_format",
25+
"unregister_unpack_format",
26+
"unpack_archive",
27+
"ignore_patterns",
28+
"chown",
29+
"which",
30+
"get_terminal_size",
31+
"SameFileError",
32+
"disk_usage",
33+
]
34+
635
_StrOrBytesPathT = TypeVar("_StrOrBytesPathT", bound=StrOrBytesPath)
736
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
837
# Return value of some functions that may either return a path-like object that was passed in or

stdlib/smtpd.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import socket
44
from collections import defaultdict
55
from typing import Any
66

7+
__all__ = ["SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy", "MailmanProxy"]
8+
79
_Address = tuple[str, int] # (host, port)
810

911
class SMTPChannel(asynchat.async_chat):

stdlib/smtplib.pyi

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@ from ssl import SSLContext
66
from types import TracebackType
77
from typing import Any, Pattern, Protocol, Sequence, Union, overload
88

9+
if sys.version_info >= (3, 7):
10+
__all__ = [
11+
"SMTPException",
12+
"SMTPNotSupportedError",
13+
"SMTPServerDisconnected",
14+
"SMTPResponseException",
15+
"SMTPSenderRefused",
16+
"SMTPRecipientsRefused",
17+
"SMTPDataError",
18+
"SMTPConnectError",
19+
"SMTPHeloError",
20+
"SMTPAuthenticationError",
21+
"quoteaddr",
22+
"quotedata",
23+
"SMTP",
24+
"SMTP_SSL",
25+
]
26+
else:
27+
__all__ = [
28+
"SMTPException",
29+
"SMTPServerDisconnected",
30+
"SMTPResponseException",
31+
"SMTPSenderRefused",
32+
"SMTPRecipientsRefused",
33+
"SMTPDataError",
34+
"SMTPConnectError",
35+
"SMTPHeloError",
36+
"SMTPAuthenticationError",
37+
"quoteaddr",
38+
"quotedata",
39+
"SMTP",
40+
"SMTP_SSL",
41+
]
42+
943
_Reply = tuple[int, bytes]
1044
_SendErrs = dict[str, _Reply]
1145
# Should match source_address for socket.create_connection

stdlib/sndhdr.pyi

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

4+
__all__ = ["what", "whathdr"]
5+
46
class SndHeaders(NamedTuple):
57
filetype: str
68
framerate: int

stdlib/socketserver.pyi

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,38 @@ from _typeshed import Self
44
from socket import socket as _socket
55
from typing import Any, BinaryIO, Callable, ClassVar, Union
66

7+
if sys.platform == "win32":
8+
__all__ = [
9+
"BaseServer",
10+
"TCPServer",
11+
"UDPServer",
12+
"ThreadingUDPServer",
13+
"ThreadingTCPServer",
14+
"BaseRequestHandler",
15+
"StreamRequestHandler",
16+
"DatagramRequestHandler",
17+
"ThreadingMixIn",
18+
]
19+
else:
20+
__all__ = [
21+
"BaseServer",
22+
"TCPServer",
23+
"UDPServer",
24+
"ThreadingUDPServer",
25+
"ThreadingTCPServer",
26+
"BaseRequestHandler",
27+
"StreamRequestHandler",
28+
"DatagramRequestHandler",
29+
"ThreadingMixIn",
30+
"ForkingUDPServer",
31+
"ForkingTCPServer",
32+
"ForkingMixIn",
33+
"UnixStreamServer",
34+
"UnixDatagramServer",
35+
"ThreadingUnixStreamServer",
36+
"ThreadingUnixDatagramServer",
37+
]
38+
739
_RequestType = Union[_socket, tuple[bytes, _socket]]
840
_AddressType = Union[tuple[str, int], str]
941

0 commit comments

Comments
 (0)