diff options
author | Guido van Rossum <guido@python.org> | 2000-02-04 15:28:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-02-04 15:28:42 (GMT) |
commit | e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757 (patch) | |
tree | e1dda862f680cf4a1169220af2ecbca3322caf4d /Lib/tempfile.py | |
parent | 54f22ed30bab2e64909ba2d79205cb4b87c69db2 (diff) | |
download | cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.zip cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.tar.gz cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.tar.bz2 |
The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.
A new docstring was added to formatter. The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 68cc896..5b05bdd 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -1,5 +1,5 @@ -# Temporary file name allocation -# +"""Temporary files and filenames.""" + # XXX This tries to be not UNIX specific, but I don't know beans about # how to choose a temp directory or filename on MS-DOS or other # systems so it may have to be changed... @@ -14,9 +14,8 @@ tempdir = None template = None -# Function to calculate the directory to use - def gettempdir(): + """Function to calculate the directory to use.""" global tempdir if tempdir is not None: return tempdir @@ -58,11 +57,10 @@ def gettempdir(): return tempdir -# Function to calculate a prefix of the filename to use - _pid = None def gettempprefix(): + """Function to calculate a prefix of the filename to use.""" global template, _pid if os.name == 'posix' and _pid and _pid != os.getpid(): # Our pid changed; we must have forked -- zap the template @@ -85,9 +83,8 @@ def gettempprefix(): counter = 0 -# User-callable function to return a unique temporary file name - def mktemp(suffix=""): + """User-callable function to return a unique temporary file name.""" global counter dir = gettempdir() pre = gettempprefix() @@ -126,6 +123,7 @@ class TemporaryFileWrapper: def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): + """Create and return a temporary file (opened read-write by default).""" name = mktemp(suffix) if os.name == 'posix': # Unix -- be very careful |