Skip to content

Commit

Permalink
Whitespace normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-one committed Aug 9, 2002
1 parent 4030714 commit a0d55de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions Lib/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ def acquire(self):
release = acquire

_text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
if hasattr(_os, 'O_NOINHERIT'): _text_openflags |= _os.O_NOINHERIT
if hasattr(_os, 'O_NOFOLLOW'): _text_openflags |= _os.O_NOFOLLOW
if hasattr(_os, 'O_NOINHERIT'):
_text_openflags |= _os.O_NOINHERIT
if hasattr(_os, 'O_NOFOLLOW'):
_text_openflags |= _os.O_NOFOLLOW

_bin_openflags = _text_openflags
if hasattr(_os, 'O_BINARY'): _bin_openflags |= _os.O_BINARY
if hasattr(_os, 'O_BINARY'):
_bin_openflags |= _os.O_BINARY

if hasattr(_os, 'TMP_MAX'):
TMP_MAX = _os.TMP_MAX
Expand Down Expand Up @@ -177,7 +180,7 @@ def _candidate_tempdir_list():
dirlist.append(_os.curdir)

return dirlist

def _get_default_tempdir():
"""Calculate the default directory to use for temporary files.
This routine should be called through '_once' (see above) as we
Expand Down Expand Up @@ -239,7 +242,7 @@ def _mkstemp_inner(dir, pre, suf, flags):
raise

raise IOError, (_errno.EEXIST, "No usable temporary file name found")


# User visible interfaces.

Expand Down Expand Up @@ -302,7 +305,7 @@ def mkdtemp(suffix="", prefix=template, dir=gettempdir()):
"""

names = _get_candidate_names()

for seq in xrange(TMP_MAX):
name = names.next()
file = _os.path.join(dir, prefix + name + suffix)
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def write(self, str):
def __del__(self):
self._close(self.fd)
self._unlink(self.name)

def do_create(self, dir=None, pre="", suf="", bin=1):
if dir is None:
dir = tempfile.gettempdir()
Expand Down Expand Up @@ -485,7 +485,7 @@ def test_basic(self):
os.rmdir(self.do_create(suf="b"))
os.rmdir(self.do_create(pre="a", suf="b"))
os.rmdir(self.do_create(pre="aa", suf=".txt"))

def test_basic_many(self):
"""mkdtemp can create many directories (stochastic)"""
extant = range(1000)
Expand Down

0 comments on commit a0d55de

Please sign in to comment.