Kaydet (Commit) 0de65807 authored tarafından Skip Montanaro's avatar Skip Montanaro

bunch more __all__ lists

also modified check_all function to suppress all warnings since they aren't
relevant to what this test is doing (allows quiet checking of regsub, for
instance)
üst 04f1d374
...@@ -87,7 +87,9 @@ This module also defines an exception 'error'. ...@@ -87,7 +87,9 @@ This module also defines an exception 'error'.
import sys import sys
from pcre import * from pcre import *
__all__ = ["match","search","sub","subn","split","findall","escape","compile"] __all__ = ["match","search","sub","subn","split","findall","escape","compile",
"I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL",
"VERBOSE","error"]
# #
# First, the public part of the interface: # First, the public part of the interface:
......
...@@ -76,6 +76,12 @@ used to "move backward in time": ...@@ -76,6 +76,12 @@ used to "move backward in time":
from math import log as _log, exp as _exp, pi as _pi, e as _e from math import log as _log, exp as _exp, pi as _pi, e as _e
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
__all__ = ["Random","seed","random","uniform","randint","choice",
"randrange","shuffle","normalvariate","lognormvariate",
"cunifvariate","expovariate","vonmisesvariate","gammavariate",
"stdgamma","gauss","betavariate","paretovariate","weibullvariate",
"getstate","setstate","jumpahead","whseed"]
def _verify(name, expected): def _verify(name, expected):
computed = eval(name) computed = eval(name)
if abs(computed - expected) > 1e-7: if abs(computed - expected) > 1e-7:
......
...@@ -26,7 +26,9 @@ engine = "sre" ...@@ -26,7 +26,9 @@ engine = "sre"
if engine == "sre": if engine == "sre":
# New unicode-aware engine # New unicode-aware engine
from sre import * from sre import *
from sre import __all__
else: else:
# Old 1.5.2 engine. This one supports 8-bit strings only, # Old 1.5.2 engine. This one supports 8-bit strings only,
# and will be removed in 2.0 final. # and will be removed in 2.0 final.
from pre import * from pre import *
from pre import __all__
...@@ -63,6 +63,8 @@ XXX To be done... ...@@ -63,6 +63,8 @@ XXX To be done...
import regex import regex
from regex_syntax import * # RE_* from regex_syntax import * # RE_*
__all__ = ["convert","quote"]
# Default translation table # Default translation table
mastertable = { mastertable = {
r'\<': r'\b', r'\<': r'\b',
......
...@@ -51,3 +51,9 @@ RE_SYNTAX_GREP = (RE_BK_PLUS_QM | RE_NEWLINE_OR) ...@@ -51,3 +51,9 @@ RE_SYNTAX_GREP = (RE_BK_PLUS_QM | RE_NEWLINE_OR)
RE_SYNTAX_EMACS = 0 RE_SYNTAX_EMACS = 0
# (Python's obsolete "regexp" module used a syntax similar to awk.) # (Python's obsolete "regexp" module used a syntax similar to awk.)
__all__ = locals().keys()
for _i in range(len(__all__)-1,-1,-1):
if __all__[_i][0] == "_":
del __all__[_i]
del _i
...@@ -19,6 +19,7 @@ warnings.filterwarnings("ignore", "", DeprecationWarning, __name__) ...@@ -19,6 +19,7 @@ warnings.filterwarnings("ignore", "", DeprecationWarning, __name__)
import regex import regex
__all__ = ["sub","gsub","split","splitx","capwords"]
# Replace first occurrence of pattern pat in string str by replacement # Replace first occurrence of pattern pat in string str by replacement
# repl. If the pattern isn't found, the string is returned unchanged. # repl. If the pattern isn't found, the string is returned unchanged.
......
"""Redo the `...` (representation) but with limits on most sizes.""" """Redo the `...` (representation) but with limits on most sizes."""
__all__ = ["Repr","repr"]
class Repr: class Repr:
def __init__(self): def __init__(self):
self.maxlevel = 6 self.maxlevel = 6
......
...@@ -23,6 +23,7 @@ import __builtin__ ...@@ -23,6 +23,7 @@ import __builtin__
import os import os
import ihooks import ihooks
__all__ = ["RExec"]
class FileBase: class FileBase:
......
...@@ -59,6 +59,7 @@ There are also some utility functions here. ...@@ -59,6 +59,7 @@ There are also some utility functions here.
import time import time
__all__ = ["Message","AddressList","parsedate","parsedate_tz","mktime_tz"]
_blanklines = ('\r\n', '\n') # Optimization for islast() _blanklines = ('\r\n', '\n') # Optimization for islast()
......
...@@ -43,6 +43,8 @@ import readline ...@@ -43,6 +43,8 @@ import readline
import __builtin__ import __builtin__
import __main__ import __main__
__all__ = ["Completer"]
class Completer: class Completer:
def complete(self, text, state): def complete(self, text, state):
......
...@@ -30,6 +30,8 @@ Parameterless functions or methods cannot be used, however. ...@@ -30,6 +30,8 @@ Parameterless functions or methods cannot be used, however.
import bisect import bisect
__all__ = ["scheduler"]
class scheduler: class scheduler:
def __init__(self, timefunc, delayfunc): def __init__(self, timefunc, delayfunc):
"""Initialize a new instance, passing the time and delay """Initialize a new instance, passing the time and delay
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
import re import re
import string import string
__all__ = ["SGMLParser"]
# Regular expressions used for parsing # Regular expressions used for parsing
......
...@@ -40,6 +40,7 @@ try: ...@@ -40,6 +40,7 @@ try:
except ImportError: except ImportError:
from StringIO import StringIO from StringIO import StringIO
__all__ = ["Shelf","BsdDbShelf","DbfilenameShelf","open"]
class Shelf: class Shelf:
"""Base class for shelf implementations. """Base class for shelf implementations.
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
import os.path import os.path
import sys import sys
__all__ = ["shlex"]
class shlex: class shlex:
"A lexical analyzer class for simple shell-like syntaxes." "A lexical analyzer class for simple shell-like syntaxes."
def __init__(self, instream=None, infile=None): def __init__(self, instream=None, infile=None):
......
...@@ -8,6 +8,8 @@ import os ...@@ -8,6 +8,8 @@ import os
import sys import sys
import stat import stat
__all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
"copytree","rmtree"]
def copyfileobj(fsrc, fdst, length=16*1024): def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst""" """copy data from file-like object fsrc to file-like object fdst"""
......
...@@ -75,6 +75,7 @@ import socket ...@@ -75,6 +75,7 @@ import socket
import asyncore import asyncore
import asynchat import asynchat
__all__ = ["SMTPServer","DebuggingServer","PureProxy","MailmanProxy"]
program = sys.argv[0] program = sys.argv[0]
__version__ = 'Python SMTP proxy version 0.2' __version__ = 'Python SMTP proxy version 0.2'
......
...@@ -44,6 +44,11 @@ import re ...@@ -44,6 +44,11 @@ import re
import rfc822 import rfc822
import types import types
__all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException",
"SMTPSenderRefused","SMTPRecipientsRefused","SMTPDataError",
"SMTPConnectError","SMTPHeloError","quoteaddr","quotedata",
"SMTP"]
SMTP_PORT = 25 SMTP_PORT = 25
CRLF="\r\n" CRLF="\r\n"
......
...@@ -30,6 +30,7 @@ explicitly given directories. ...@@ -30,6 +30,7 @@ explicitly given directories.
# The file structure is top-down except that the test program and its # The file structure is top-down except that the test program and its
# subroutine come last. # subroutine come last.
__all__ = ["what","whathdr"]
def what(filename): def what(filename):
"""Guess the type of a sound file""" """Guess the type of a sound file"""
......
...@@ -42,6 +42,11 @@ from _socket import * ...@@ -42,6 +42,11 @@ from _socket import *
import os, sys import os, sys
__all__ = ["getfqdn"]
import _socket
__all__.extend(os._get_exports_list(_socket))
del _socket
if (sys.platform.lower().startswith("win") if (sys.platform.lower().startswith("win")
or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")): or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")):
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
import sre_compile import sre_compile
import sre_parse import sre_parse
__all__ = ["match","search","sub","subn","split","findall","compile",
"purge","template","escape","I","L","M","S","X","U","IGNORECASE",
"LOCALE","MULTILINE","DOTALL","VERBOSE","UNICODE","error"]
# flags # flags
I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale
......
...@@ -12,6 +12,8 @@ import _sre ...@@ -12,6 +12,8 @@ import _sre
from sre_constants import * from sre_constants import *
__all__ = ["compile"]
assert _sre.MAGIC == MAGIC, "SRE module mismatch" assert _sre.MAGIC == MAGIC, "SRE module mismatch"
MAXCODE = 65535 MAXCODE = 65535
......
...@@ -194,6 +194,12 @@ SRE_INFO_PREFIX = 1 # has prefix ...@@ -194,6 +194,12 @@ SRE_INFO_PREFIX = 1 # has prefix
SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix) SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
SRE_INFO_CHARSET = 4 # pattern starts with character from given set SRE_INFO_CHARSET = 4 # pattern starts with character from given set
__all__ = locals().keys()
for _i in range(len(__all__)-1,-1,-1):
if __all__[_i][0] == "_":
del __all__[_i]
del _i
if __name__ == "__main__": if __name__ == "__main__":
def dump(f, d, prefix): def dump(f, d, prefix):
items = d.items() items = d.items()
......
...@@ -14,6 +14,9 @@ import sys ...@@ -14,6 +14,9 @@ import sys
from sre_constants import * from sre_constants import *
__all__ = ["Pattern","SubPattern","Tokenizer","parse","parse_template",
"expand_template"]
SPECIAL_CHARS = ".\\[{()*+?^$|" SPECIAL_CHARS = ".\\[{()*+?^$|"
REPEAT_CHARS = "*+?{" REPEAT_CHARS = "*+?{"
......
...@@ -84,3 +84,9 @@ S_IRWXO = 00007 ...@@ -84,3 +84,9 @@ S_IRWXO = 00007
S_IROTH = 00004 S_IROTH = 00004
S_IWOTH = 00002 S_IWOTH = 00002
S_IXOTH = 00001 S_IXOTH = 00001
__all__ = locals().keys()
for _i in range(len(__all__)-1,-1,-1):
if __all__[_i][0] == "_":
del __all__[_i]
del _i
...@@ -6,6 +6,9 @@ There are functions to reset the cache or to selectively remove items. ...@@ -6,6 +6,9 @@ There are functions to reset the cache or to selectively remove items.
import os as _os import os as _os
from stat import * from stat import *
__all__ = ["stat","reset","forget","forget_prefix","forget_dir",
"forget_except_prefix","isdir"]
# The cache. Keys are pathnames, values are os.stat outcomes. # The cache. Keys are pathnames, values are os.stat outcomes.
# Remember that multiple threads may be calling this! So, e.g., that # Remember that multiple threads may be calling this! So, e.g., that
# cache.has_key(path) returns 1 doesn't mean the cache will still contain # cache.has_key(path) returns 1 doesn't mean the cache will still contain
......
...@@ -13,3 +13,9 @@ F_FFREE = 6 # Total number of free file nodes ...@@ -13,3 +13,9 @@ F_FFREE = 6 # Total number of free file nodes
F_FAVAIL = 7 # Free nodes available to non-superuser F_FAVAIL = 7 # Free nodes available to non-superuser
F_FLAG = 8 # Flags (see your local statvfs man page) F_FLAG = 8 # Flags (see your local statvfs man page)
F_NAMEMAX = 9 # Maximum file name length F_NAMEMAX = 9 # Maximum file name length
__all__ = locals().keys()
for _i in range(len(__all__)-1,-1,-1):
if __all__[_i][0] == "_":
del __all__[_i]
del _i
...@@ -379,3 +379,9 @@ try: ...@@ -379,3 +379,9 @@ try:
letters = lowercase + uppercase letters = lowercase + uppercase
except ImportError: except ImportError:
pass # Use the original versions pass # Use the original versions
__all__ = locals().keys()
for _i in range(len(__all__)-1,-1,-1):
if __all__[_i][0] == "_":
del __all__[_i]
del _i
...@@ -2,6 +2,9 @@ from test_support import verify, verbose ...@@ -2,6 +2,9 @@ from test_support import verify, verbose
import sys import sys
def check_all(modname): def check_all(modname):
import warnings
warnings.filterwarnings("ignore", "", DeprecationWarning, modname)
names = {} names = {}
try: try:
exec "import %s" % modname in names exec "import %s" % modname in names
...@@ -124,4 +127,30 @@ check_all("pty") ...@@ -124,4 +127,30 @@ check_all("pty")
check_all("py_compile") check_all("py_compile")
check_all("pyclbr") check_all("pyclbr")
check_all("quopri") check_all("quopri")
check_all("random")
check_all("re")
check_all("reconvert")
check_all("regex_syntax")
check_all("regsub")
check_all("repr")
check_all("rexec")
check_all("rfc822")
check_all("rlcompleter")
check_all("robotparser") check_all("robotparser")
check_all("sched")
check_all("sgmllib")
check_all("shelve")
check_all("shlex")
check_all("shutil")
check_all("smtpd")
check_all("smtplib")
check_all("sndhdr")
check_all("socket")
check_all("sre")
check_all("sre_compile")
check_all("sre_constants")
check_all("sre_parse")
check_all("stat")
check_all("stat_cache")
check_all("statvfs")
check_all("string")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment