diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py index f075e581dcce..2f17938feb24 100644 --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -63,6 +63,7 @@ __version__ = "0.2" +__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] import sys import time diff --git a/Lib/Bastion.py b/Lib/Bastion.py index 868b0b6403f2..99990a2d7df6 100644 --- a/Lib/Bastion.py +++ b/Lib/Bastion.py @@ -26,6 +26,7 @@ """ +__all__ = ["BastionClass", "Bastion"] from types import MethodType diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py index ba1e76bb3eb2..e2bef264ad36 100644 --- a/Lib/CGIHTTPServer.py +++ b/Lib/CGIHTTPServer.py @@ -19,6 +19,7 @@ __version__ = "0.4" +__all__ = ["CGIHTTPRequestHandler"] import os import sys diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index f1e77e8d7d19..6d1e6f4b21b0 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -89,6 +89,11 @@ import string import re +__all__ = ["NoSectionError","DuplicateSectionError","NoOptionError", + "InterpolationError","InterpolationDepthError","ParsingError", + "MissingSectionHeaderError","ConfigParser", + "MAX_INTERPOLATION_DEPTH"] + DEFAULTSECT = "DEFAULT" MAX_INTERPOLATION_DEPTH = 10 diff --git a/Lib/Cookie.py b/Lib/Cookie.py index 4ff0cbb066ff..565e6f3fb498 100644 --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -228,6 +228,8 @@ except ImportError: raise ImportError, "Cookie.py requires 're' from Python 1.5 or later" +__all__ = ["CookieError","BaseCookie","SimpleCookie","SerialCookie", + "SmartCookie","Cookie"] # # Define an exception visible to External modules diff --git a/Lib/MimeWriter.py b/Lib/MimeWriter.py index 9f0465614fd2..6aab1cd5f186 100644 --- a/Lib/MimeWriter.py +++ b/Lib/MimeWriter.py @@ -10,6 +10,7 @@ import string import mimetools +__all__ = ["MimeWriter"] class MimeWriter: diff --git a/Lib/Queue.py b/Lib/Queue.py index 0e6bbf055a46..050a9660405c 100644 --- a/Lib/Queue.py +++ b/Lib/Queue.py @@ -1,5 +1,7 @@ """A multi-producer, multi-consumer queue.""" +__all__ = ["Queue","Empty","Full"] + class Empty(Exception): "Exception raised by Queue.get(block=0)/get_nowait()." pass diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py index 37e3b38dfabd..7bb126267323 100644 --- a/Lib/SimpleHTTPServer.py +++ b/Lib/SimpleHTTPServer.py @@ -8,6 +8,7 @@ __version__ = "0.6" +__all__ = ["SimpleHTTPRequestHandler"] import os import string diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index e1967fe20350..ec0159a0457a 100644 --- a/Lib/SocketServer.py +++ b/Lib/SocketServer.py @@ -127,6 +127,13 @@ class will essentially render the service "deaf" while one request is import sys import os +__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer", + "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler", + "StreamRequestHandler","DatagramRequestHandler"] +if hasattr(socket, "AF_UNIX"): + __all__.extend(["UnixStreamServer","UnixDatagramServer", + "ThreadingUnixStreamServer", + "ThreadingUnixDatagramServer"]) class BaseServer: diff --git a/Lib/StringIO.py b/Lib/StringIO.py index 5fac5904e65b..bc5e9e24327a 100644 --- a/Lib/StringIO.py +++ b/Lib/StringIO.py @@ -34,6 +34,8 @@ except ImportError: EINVAL = 22 +__all__ = ["StringIO"] + EMPTYSTRING = '' class StringIO: diff --git a/Lib/UserDict.py b/Lib/UserDict.py index b642db73b57e..38f0d2631bd0 100644 --- a/Lib/UserDict.py +++ b/Lib/UserDict.py @@ -1,5 +1,7 @@ """A more or less complete user-defined wrapper around dictionary objects.""" +__all__ = ["UserDict"] + class UserDict: def __init__(self, dict=None): self.data = {} diff --git a/Lib/UserList.py b/Lib/UserList.py index ee2658939ff1..6867332b70e7 100644 --- a/Lib/UserList.py +++ b/Lib/UserList.py @@ -1,5 +1,7 @@ """A more or less complete user-defined wrapper around list objects.""" +__all__ = ["UserList"] + class UserList: def __init__(self, initlist=None): self.data = [] diff --git a/Lib/UserString.py b/Lib/UserString.py index 2d02b9b7d8db..163faa507bb5 100755 --- a/Lib/UserString.py +++ b/Lib/UserString.py @@ -8,6 +8,8 @@ from types import StringType, UnicodeType import sys +__all__ = ["UserString","MutableString"] + class UserString: def __init__(self, seq): if isinstance(seq, StringType) or isinstance(seq, UnicodeType): diff --git a/Lib/aifc.py b/Lib/aifc.py index 42d5c671a47e..0821cffe6e35 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -137,6 +137,8 @@ import struct import __builtin__ +__all__ = ["Error","open","openfp"] + class Error(Exception): pass diff --git a/Lib/anydbm.py b/Lib/anydbm.py index ba6fa7b54aa0..9352fbff561f 100644 --- a/Lib/anydbm.py +++ b/Lib/anydbm.py @@ -42,6 +42,8 @@ """ +__all__ = ["error","open"] + try: class error(Exception): pass diff --git a/Lib/atexit.py b/Lib/atexit.py index b687cb402372..bcf7e548a033 100644 --- a/Lib/atexit.py +++ b/Lib/atexit.py @@ -5,6 +5,8 @@ One public function, register, is defined. """ +__all__ = ["register"] + _exithandlers = [] def _run_exitfuncs(): """run any registered exit functions diff --git a/Lib/audiodev.py b/Lib/audiodev.py index 5dfd1ab129df..234514597ca0 100644 --- a/Lib/audiodev.py +++ b/Lib/audiodev.py @@ -1,5 +1,7 @@ """Classes for manipulating audio devices (currently only for Sun and SGI)""" +__all__ = ["error","AudioDev"] + class error(Exception): pass diff --git a/Lib/base64.py b/Lib/base64.py index ae67f68eccb3..290fa83a047a 100755 --- a/Lib/base64.py +++ b/Lib/base64.py @@ -6,6 +6,8 @@ import binascii +__all__ = ["encode","decode","encodestring","decodestring"] + MAXLINESIZE = 76 # Excluding the CRLF MAXBINSIZE = (MAXLINESIZE/4)*3 diff --git a/Lib/bdb.py b/Lib/bdb.py index 6bf0ff4682c7..a0bf9b7119e0 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -4,6 +4,8 @@ import os import types +__all__ = ["BdbQuit","Bdb","Breakpoint"] + BdbQuit = 'bdb.BdbQuit' # Exception to give up completely diff --git a/Lib/binhex.py b/Lib/binhex.py index ac2437b9624f..8189563944a7 100644 --- a/Lib/binhex.py +++ b/Lib/binhex.py @@ -27,6 +27,8 @@ import string import binascii +__all__ = ["binhex","hexbin","Error"] + class Error(Exception): pass diff --git a/Lib/bisect.py b/Lib/bisect.py index 343bd5da81b6..f521babc0e47 100644 --- a/Lib/bisect.py +++ b/Lib/bisect.py @@ -1,5 +1,6 @@ """Bisection algorithms.""" +__all__ = ["bisect_right","insort_right","bisect_left","insort_left"] def insort_right(a, x, lo=0, hi=None): """Insert item x in list a, and keep it sorted assuming a is sorted. diff --git a/Lib/calendar.py b/Lib/calendar.py index 1d15081133e2..2efb1c496b42 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -10,6 +10,10 @@ # Import functions and variables from time module from time import localtime, mktime +__all__ = ["error","setfirstweekday","firstweekday","isleap", + "leapdays","weekday","monthrange","monthcalendar", + "prmonth","month","prcal","calendar","timegm"] + # Exception raised for bad input (with string parameter for details) error = ValueError diff --git a/Lib/cgi.py b/Lib/cgi.py index 6d590517351f..0e808a5acb97 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -34,6 +34,8 @@ import UserDict from StringIO import StringIO +__all__ = ["MiniFieldStorage","FieldStorage","FormContentDict", + "SvFormContentDict","InterpFormContentDict","FormContent"] # Logging support # =============== diff --git a/Lib/chunk.py b/Lib/chunk.py index 0a93cd313770..a38691fc1e29 100644 --- a/Lib/chunk.py +++ b/Lib/chunk.py @@ -48,6 +48,8 @@ default is 1, i.e. aligned. """ +__all__ = ["Chunk"] + class Chunk: def __init__(self, file, align = 1, bigendian = 1, inclheader = 0): import struct diff --git a/Lib/cmd.py b/Lib/cmd.py index 767157395325..f2894a94130f 100644 --- a/Lib/cmd.py +++ b/Lib/cmd.py @@ -37,6 +37,8 @@ import string +__all__ = ["Cmd"] + PROMPT = '(Cmd) ' IDENTCHARS = string.letters + string.digits + '_' diff --git a/Lib/code.py b/Lib/code.py index 846cd0464234..f9d8225d1d58 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -10,6 +10,9 @@ import traceback from codeop import compile_command +__all__ = ["InteractiveInterpreter","InteractiveConsole","interact", + "compile_command"] + def softspace(file, newvalue): oldvalue = 0 try: diff --git a/Lib/codecs.py b/Lib/codecs.py index 003aa013e493..21652b6146cb 100644 --- a/Lib/codecs.py +++ b/Lib/codecs.py @@ -17,6 +17,9 @@ raise SystemError,\ 'Failed to load the builtin codecs: %s' % why +__all__ = ["register","lookup","open","EncodedFile","BOM","BOM_BE", + "BOM_LE","BOM32_BE","BOM32_LE","BOM64_BE","BOM64_LE"] + ### Constants # diff --git a/Lib/codeop.py b/Lib/codeop.py index 080e00b87ebc..46926b58c4c2 100644 --- a/Lib/codeop.py +++ b/Lib/codeop.py @@ -4,6 +4,8 @@ import string import traceback +__all__ = ["compile_command"] + def compile_command(source, filename="", symbol="single"): r"""Compile a command and determine whether it is incomplete. diff --git a/Lib/colorsys.py b/Lib/colorsys.py index 4a62f9df987b..c2cdf57c9705 100644 --- a/Lib/colorsys.py +++ b/Lib/colorsys.py @@ -17,6 +17,8 @@ # References: # XXX Where's the literature? +__all__ = ["rgb_to_yiq","yiq_to_rgb","rgb_to_hls","hls_to_rgb", + "rgb_to_hsv","hsv_to_rgb"] # Some floating point constants diff --git a/Lib/commands.py b/Lib/commands.py index a21460dce0ae..cfbb541cfd61 100644 --- a/Lib/commands.py +++ b/Lib/commands.py @@ -19,6 +19,8 @@ [Note: it would be nice to add functions to interpret the exit status.] """ +__all__ = ["getstatusoutput","getoutput","getstatus"] + # Module 'commands' # # Various tools for executing commands and looking at their output and status. diff --git a/Lib/compileall.py b/Lib/compileall.py index e56c8b284e83..93ec7adc73d6 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -17,6 +17,8 @@ import sys import py_compile +__all__ = ["compile_dir","compile_path"] + def compile_dir(dir, maxlevels=10, ddir=None, force=0): """Byte-compile all modules in the given directory tree. diff --git a/Lib/copy.py b/Lib/copy.py index cdd2fdf8d38e..123162cba1ce 100644 --- a/Lib/copy.py +++ b/Lib/copy.py @@ -61,6 +61,8 @@ class Error(Exception): except ImportError: PyStringMap = None +__all__ = ["Error","error","copy","deepcopy"] + def copy(x): """Shallow copy operation on arbitrary Python objects. diff --git a/Lib/copy_reg.py b/Lib/copy_reg.py index 6a8881d0a14a..e4f0b3cfdac0 100644 --- a/Lib/copy_reg.py +++ b/Lib/copy_reg.py @@ -6,6 +6,8 @@ from types import ClassType as _ClassType +__all__ = ["pickle","constructor"] + dispatch_table = {} safe_constructors = {} diff --git a/Lib/dbhash.py b/Lib/dbhash.py index ff51630bb338..4abd4f03f1e9 100644 --- a/Lib/dbhash.py +++ b/Lib/dbhash.py @@ -2,6 +2,8 @@ import bsddb +__all__ = ["error","open"] + error = bsddb.error # Exported for anydbm def open(file, flag, mode=0666): diff --git a/Lib/dircache.py b/Lib/dircache.py index 08b127a1afbc..a999743a8d10 100644 --- a/Lib/dircache.py +++ b/Lib/dircache.py @@ -6,6 +6,8 @@ import os +__all__ = ["listdir","opendir","annotate"] + cache = {} def listdir(path): diff --git a/Lib/dis.py b/Lib/dis.py index 6ecefd34a4e9..f01bf4fe103f 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -4,6 +4,10 @@ import string import types +__all__ = ["dis","disassemble","distb","disco","opname","cmp_op", + "hasconst","hasname","hasjrel","hasjabs","haslocal", + "hascompare"] + def dis(x=None): """Disassemble classes, methods, functions, or code. diff --git a/Lib/robotparser.py b/Lib/robotparser.py index e0ff72bb34cf..782d623b275b 100644 --- a/Lib/robotparser.py +++ b/Lib/robotparser.py @@ -11,6 +11,8 @@ """ import re,string,urlparse,urllib +__all__ = ["RobotFileParser"] + debug = 0 def _debug(msg): diff --git a/Lib/test/output/test___all__ b/Lib/test/output/test___all__ new file mode 100644 index 000000000000..afdff3839fdb --- /dev/null +++ b/Lib/test/output/test___all__ @@ -0,0 +1 @@ +test___all__ diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py new file mode 100644 index 000000000000..f5e363038d8b --- /dev/null +++ b/Lib/test/test___all__.py @@ -0,0 +1,55 @@ + +from test_support import verify, verbose, TestFailed +import sys + +def check_all(_modname): + exec "import %s" % _modname + verify(hasattr(sys.modules[_modname],"__all__"), + "%s has no __all__ attribute" % _modname) + exec "del %s" % _modname + exec "from %s import *" % _modname + + _keys = locals().keys() + _keys.remove("_modname") + _keys.sort() + all = list(sys.modules[_modname].__all__) # in case it's a tuple + all.sort() + verify(_keys==all,"%s != %s" % (_keys,all)) + +check_all("BaseHTTPServer") +check_all("Bastion") +check_all("CGIHTTPServer") +check_all("ConfigParser") +check_all("Cookie") +check_all("MimeWriter") +check_all("Queue") +check_all("SimpleHTTPServer") +check_all("SocketServer") +check_all("StringIO") +check_all("UserDict") +check_all("UserList") +check_all("UserString") +check_all("aifc") +check_all("anydbm") +check_all("atexit") +check_all("audiodev") +check_all("base64") +check_all("bdb") +check_all("binhex") +check_all("bisect") +check_all("calendar") +check_all("cgi") +check_all("chunk") +check_all("cmd") +check_all("code") +check_all("codecs") +check_all("codeop") +check_all("colorsys") +check_all("commands") +check_all("compileall") +check_all("copy") +check_all("copy_reg") +check_all("dbhash") +check_all("dircache") +check_all("dis") +check_all("robotparser")