]> granicus.if.org Git - python/commitdiff
added several more __all__ lists
authorSkip Montanaro <skip@pobox.com>
Tue, 6 Feb 2001 01:07:02 +0000 (01:07 +0000)
committerSkip Montanaro <skip@pobox.com>
Tue, 6 Feb 2001 01:07:02 +0000 (01:07 +0000)
Lib/multifile.py
Lib/mutex.py
Lib/netrc.py
Lib/nntplib.py
Lib/ntpath.py
Lib/nturl2path.py
Lib/os.py
Lib/test/test___all__.py

index 38a5a46069f3fdffb979413db4ce88c4d6852417..e0305d82b2ac112f9dab0bec0967d4937434e30c 100644 (file)
@@ -30,6 +30,8 @@ seekable stream object.
 import sys
 import string
 
+__all__ = ["MultiFile","Error"]
+
 class Error(Exception):
     pass
 
index 2348a2e0041d753dfbfa37f8e4c195c99ddec1f9..33baea14223a45aec1dce0f7cfbc85dc45b0c108 100644 (file)
@@ -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."""
index 6bc0292a223ffb01ff4883ed8dde6388b476d3d3..bf944b7a7ef69914560c8b97264e419c29fb7df8 100644 (file)
@@ -4,6 +4,8 @@
 
 import os, shlex
 
+__all__ = ["netrc"]
+
 class netrc:
     def __init__(self, file=None):
         if not file:
index a8aba4838ab4650c398baeea4f6a6050bf394044..eddd31afe7a53363d53f8ee8e0e533821352bf0b 100644 (file)
@@ -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):
index 571a7d0dd85a6e73e222ee8b25ef7d2a7caffe3a..63860ce714729bd349867a5118d7d4f4f2382ced 100644 (file)
@@ -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
index 2d08eee1b0e26d8fbaf0bfb15171a418dfccd7b6..7e78cb1932f2ccaf07392fdcd179722c45d7f8e7 100644 (file)
@@ -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.
 
index 0ccdad2662a4dcbb1ea6e4c696c83a46b8360841..15833238f16ec2ed46a246fb5e7bc84c070cf8a1 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -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")
index f11a0c706abfdc6ad8d980352202b5d8dd9578ed..853a816edff18b38483a421b7968739bcc33511d 100644 (file)
@@ -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")