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.
This commit is contained in:
Skip Montanaro
2001-01-20 19:54:20 +00:00
parent c955f89225
commit e99d5ea25b
39 changed files with 138 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ XXX To do:
__version__ = "0.2"
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
import sys
import time

View File

@@ -26,6 +26,7 @@ bastion is created.
"""
__all__ = ["BastionClass", "Bastion"]
from types import MethodType

View File

@@ -19,6 +19,7 @@ SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL
__version__ = "0.4"
__all__ = ["CGIHTTPRequestHandler"]
import os
import sys

View File

@@ -89,6 +89,11 @@ import sys
import string
import re
__all__ = ["NoSectionError","DuplicateSectionError","NoOptionError",
"InterpolationError","InterpolationDepthError","ParsingError",
"MissingSectionHeaderError","ConfigParser",
"MAX_INTERPOLATION_DEPTH"]
DEFAULTSECT = "DEFAULT"
MAX_INTERPOLATION_DEPTH = 10

View File

@@ -228,6 +228,8 @@ try:
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

View File

@@ -10,6 +10,7 @@ MimeWriter - the only thing here.
import string
import mimetools
__all__ = ["MimeWriter"]
class MimeWriter:

View File

@@ -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

View File

@@ -8,6 +8,7 @@ and HEAD requests in a fairly straightforward manner.
__version__ = "0.6"
__all__ = ["SimpleHTTPRequestHandler"]
import os
import string

View File

@@ -127,6 +127,13 @@ import socket
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:

View File

@@ -34,6 +34,8 @@ try:
except ImportError:
EINVAL = 22
__all__ = ["StringIO"]
EMPTYSTRING = ''
class StringIO:

View File

@@ -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 = {}

View File

@@ -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 = []

View File

@@ -8,6 +8,8 @@ This module requires Python 1.6 or later.
from types import StringType, UnicodeType
import sys
__all__ = ["UserString","MutableString"]
class UserString:
def __init__(self, seq):
if isinstance(seq, StringType) or isinstance(seq, UnicodeType):

View File

@@ -137,6 +137,8 @@ writeframesraw.
import struct
import __builtin__
__all__ = ["Error","open","openfp"]
class Error(Exception):
pass

View File

@@ -42,6 +42,8 @@ only if it doesn't exist; and 'n' always creates a new database.
"""
__all__ = ["error","open"]
try:
class error(Exception):
pass

View File

@@ -5,6 +5,8 @@ upon normal program termination.
One public function, register, is defined.
"""
__all__ = ["register"]
_exithandlers = []
def _run_exitfuncs():
"""run any registered exit functions

View File

@@ -1,5 +1,7 @@
"""Classes for manipulating audio devices (currently only for Sun and SGI)"""
__all__ = ["error","AudioDev"]
class error(Exception):
pass

View File

@@ -6,6 +6,8 @@
import binascii
__all__ = ["encode","decode","encodestring","decodestring"]
MAXLINESIZE = 76 # Excluding the CRLF
MAXBINSIZE = (MAXLINESIZE/4)*3

View File

@@ -4,6 +4,8 @@ import sys
import os
import types
__all__ = ["BdbQuit","Bdb","Breakpoint"]
BdbQuit = 'bdb.BdbQuit' # Exception to give up completely

View File

@@ -27,6 +27,8 @@ import struct
import string
import binascii
__all__ = ["binhex","hexbin","Error"]
class Error(Exception):
pass

Some files were not shown because too many files have changed in this diff Show More