X Tutup
Skip to content

Commit e99d5ea

Browse files
author
Skip Montanaro
committed
added __all__ lists to a number of Python modules
added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
1 parent c955f89 commit e99d5ea

39 files changed

+138
-0
lines changed

Lib/BaseHTTPServer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
__version__ = "0.2"
6565

66+
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
6667

6768
import sys
6869
import time

Lib/Bastion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
2727
"""
2828

29+
__all__ = ["BastionClass", "Bastion"]
2930

3031
from types import MethodType
3132

Lib/CGIHTTPServer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
__version__ = "0.4"
2121

22+
__all__ = ["CGIHTTPRequestHandler"]
2223

2324
import os
2425
import sys

Lib/ConfigParser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
import string
9090
import re
9191

92+
__all__ = ["NoSectionError","DuplicateSectionError","NoOptionError",
93+
"InterpolationError","InterpolationDepthError","ParsingError",
94+
"MissingSectionHeaderError","ConfigParser",
95+
"MAX_INTERPOLATION_DEPTH"]
96+
9297
DEFAULTSECT = "DEFAULT"
9398

9499
MAX_INTERPOLATION_DEPTH = 10

Lib/Cookie.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@
228228
except ImportError:
229229
raise ImportError, "Cookie.py requires 're' from Python 1.5 or later"
230230

231+
__all__ = ["CookieError","BaseCookie","SimpleCookie","SerialCookie",
232+
"SmartCookie","Cookie"]
231233

232234
#
233235
# Define an exception visible to External modules

Lib/MimeWriter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import string
1111
import mimetools
1212

13+
__all__ = ["MimeWriter"]
1314

1415
class MimeWriter:
1516

Lib/Queue.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""A multi-producer, multi-consumer queue."""
22

3+
__all__ = ["Queue","Empty","Full"]
4+
35
class Empty(Exception):
46
"Exception raised by Queue.get(block=0)/get_nowait()."
57
pass

Lib/SimpleHTTPServer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
__version__ = "0.6"
1010

11+
__all__ = ["SimpleHTTPRequestHandler"]
1112

1213
import os
1314
import string

Lib/SocketServer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ class will essentially render the service "deaf" while one request is
127127
import sys
128128
import os
129129

130+
__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
131+
"ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
132+
"StreamRequestHandler","DatagramRequestHandler"]
133+
if hasattr(socket, "AF_UNIX"):
134+
__all__.extend(["UnixStreamServer","UnixDatagramServer",
135+
"ThreadingUnixStreamServer",
136+
"ThreadingUnixDatagramServer"])
130137

131138
class BaseServer:
132139

Lib/StringIO.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
except ImportError:
3535
EINVAL = 22
3636

37+
__all__ = ["StringIO"]
38+
3739
EMPTYSTRING = ''
3840

3941
class StringIO:

0 commit comments

Comments
 (0)
X Tutup