diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/multifile.py | 2 | ||||
-rw-r--r-- | Lib/mutex.py | 2 | ||||
-rw-r--r-- | Lib/netrc.py | 2 | ||||
-rw-r--r-- | Lib/nntplib.py | 5 | ||||
-rw-r--r-- | Lib/ntpath.py | 4 | ||||
-rw-r--r-- | Lib/nturl2path.py | 2 | ||||
-rw-r--r-- | Lib/os.py | 56 | ||||
-rw-r--r-- | Lib/test/test___all__.py | 7 |
8 files changed, 79 insertions, 1 deletions
diff --git a/Lib/multifile.py b/Lib/multifile.py index 38a5a46..e0305d8 100644 --- a/Lib/multifile.py +++ b/Lib/multifile.py @@ -30,6 +30,8 @@ seekable stream object. import sys import string +__all__ = ["MultiFile","Error"] + class Error(Exception): pass diff --git a/Lib/mutex.py b/Lib/mutex.py index 2348a2e..33baea1 100644 --- a/Lib/mutex.py +++ b/Lib/mutex.py @@ -12,6 +12,8 @@ Of course, no multi-threading is implied -- hence the funny interface for lock, where a function is called once the lock is aquired. """ +__all__ = ["mutex"] + class mutex: def __init__(self): """Create a new mutex -- initially unlocked.""" diff --git a/Lib/netrc.py b/Lib/netrc.py index 6bc0292..bf944b7 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -4,6 +4,8 @@ import os, shlex +__all__ = ["netrc"] + class netrc: def __init__(self, file=None): if not file: diff --git a/Lib/nntplib.py b/Lib/nntplib.py index a8aba48..eddd31a 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -33,7 +33,10 @@ import re import socket import string - +__all__ = ["NNTP","NNTPReplyError","NNTPTemporaryError", + "NNTPPermanentError","NNTPProtocolError","NNTPDataError", + "error_reply","error_temp","error_perm","error_proto", + "error_data",] # Exceptions raised when an error or invalid response is received class NNTPError(Exception): diff --git a/Lib/ntpath.py b/Lib/ntpath.py index 571a7d0..63860ce7 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -8,6 +8,10 @@ module as os.path. import os import stat +__all__ = ["normcase","isabs","join","splitdrive","split","splitext", + "basename","dirname","commonprefix","getsize","getmtime", + "getatime","islink","exists","isdir","isfile","ismount", + "walk","expanduser","expandvars","normpath","abspath","splitunc"] # Normalize the case of a pathname and map slashes to backslashes. # Other normalizations (such as optimizing '../' away) are not done diff --git a/Lib/nturl2path.py b/Lib/nturl2path.py index 2d08eee..7e78cb1 100644 --- a/Lib/nturl2path.py +++ b/Lib/nturl2path.py @@ -1,5 +1,7 @@ """Convert a NT pathname to a file URL and vice versa.""" +__all__ = ["url2pathname"] + def url2pathname(url): r"""Convert a URL to a DOS path. @@ -19,12 +19,22 @@ and opendir), and leave all pathname manipulation to os.path (e.g., split and join). """ +#' + import sys _names = sys.builtin_module_names altsep = None +__all__ = [] + +def _get_exports_list(module): + try: + return list(module.__all__) + except AttributeError: + return [n for n in dir(module) if n[0] != '_'] + if 'posix' in _names: name = 'posix' linesep = '\n' @@ -38,6 +48,11 @@ if 'posix' in _names: import posixpath path = posixpath del posixpath + + import posix + __all__.extend(_get_exports_list(posix)) + del posix + elif 'nt' in _names: name = 'nt' linesep = '\r\n' @@ -52,6 +67,11 @@ elif 'nt' in _names: import ntpath path = ntpath del ntpath + + import nt + __all__.extend(_get_exports_list(nt)) + del nt + elif 'dos' in _names: name = 'dos' linesep = '\r\n' @@ -65,6 +85,11 @@ elif 'dos' in _names: import dospath path = dospath del dospath + + import dos + __all__.extend(_get_exports_list(dos)) + del dos + elif 'os2' in _names: name = 'os2' linesep = '\r\n' @@ -78,6 +103,11 @@ elif 'os2' in _names: import ntpath path = ntpath del ntpath + + import os2 + __all__.extend(_get_exports_list(os2)) + del os2 + elif 'mac' in _names: name = 'mac' linesep = '\r' @@ -91,6 +121,11 @@ elif 'mac' in _names: import macpath path = macpath del macpath + + import mac + __all__.extend(_get_exports_list(mac)) + del mac + elif 'ce' in _names: name = 'ce' linesep = '\r\n' @@ -106,13 +141,22 @@ elif 'ce' in _names: import ntpath path = ntpath del ntpath + + import ce + __all__.extend(_get_exports_list(ce)) + del ce + else: raise ImportError, 'no os specific module found' +__all__.append("path") + del _names sys.modules['os.path'] = path +#' + # Super directory utilities. # (Inspired by Eric Raymond; the doc strings are mostly his) @@ -180,6 +224,8 @@ def renames(old, new): except error: pass +__all__.extend(["makedirs", "removedirs", "renames"]) + # Make sure os.environ exists, at least try: environ @@ -234,6 +280,8 @@ def execvpe(file, args, env): args may be a list or tuple of strings. """ _execvpe(file, args, env) +__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) + _notfound = None def _execvpe(file, args, env=None): if env is not None: @@ -319,6 +367,7 @@ def getenv(key, default=None): The optional second argument can specify an alternate default.""" return environ.get(key, default) +__all__.append("getenv") def _exists(name): try: @@ -454,6 +503,10 @@ otherwise return -SIG, where SIG is the signal that killed it. """ return spawnvpe(mode, file, args[:-1], env) + __all__.extend(["spawnlp","spawnlpe","spawnv", "spawnve","spawnvp", + "spawnvpe","spawnl","spawnle",]) + + # Supply popen2 etc. (for Unix) if _exists("fork"): if not _exists("popen2"): @@ -461,15 +514,18 @@ if _exists("fork"): import popen2 stdout, stdin = popen2.popen2(cmd, bufsize) return stdin, stdout + __all__.append("popen2") if not _exists("popen3"): def popen3(cmd, mode="t", bufsize=-1): import popen2 stdout, stdin, stderr = popen2.popen3(cmd, bufsize) return stdin, stdout, stderr + __all__.append("popen3") if not _exists("popen4"): def popen4(cmd, mode="t", bufsize=-1): import popen2 stdout, stdin = popen2.popen4(cmd, bufsize) return stdin, stdout + __all__.append("popen4") diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index f11a0c7..853a816 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -87,4 +87,11 @@ check_all("mhlib") check_all("mimetools") check_all("mimetypes") check_all("mimify") +check_all("multifile") +check_all("mutex") +check_all("netrc") +check_all("nntplib") +check_all("ntpath") +check_all("nturl2path") +check_all("os") check_all("robotparser") |