summaryrefslogtreecommitdiffstats
path: root/Lib/tempfile.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-11-09 03:43:58 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-11-09 03:43:58 (GMT)
commit572895b8ebbd694b8b004d6c2649f0ea647c6bf0 (patch)
tree4ed73f7d289c7a206f88c965880d312a5eeb41f9 /Lib/tempfile.py
parente1f849c7d236838b324936f0f5ca249d5d231f80 (diff)
downloadcpython-572895b8ebbd694b8b004d6c2649f0ea647c6bf0.zip
cpython-572895b8ebbd694b8b004d6c2649f0ea647c6bf0.tar.gz
cpython-572895b8ebbd694b8b004d6c2649f0ea647c6bf0.tar.bz2
Simplify code
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r--Lib/tempfile.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 699fd0a..cbaac43 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -108,30 +108,19 @@ class _RandomNameSequence:
_RandomNameSequence is an iterator."""
- characters = ("abcdefghijklmnopqrstuvwxyz" +
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
- "0123456789_")
+ characters = "abcdefghijklmnopqrstuvwxyz0123456789_"
def __init__(self):
- self.mutex = _allocate_lock()
self.rng = _Random()
- self.normcase = _os.path.normcase
def __iter__(self):
return self
def __next__(self):
- m = self.mutex
c = self.characters
choose = self.rng.choice
-
- m.acquire()
- try:
- letters = [choose(c) for dummy in "123456"]
- finally:
- m.release()
-
- return self.normcase(''.join(letters))
+ letters = [choose(c) for dummy in "123456"]
+ return ''.join(letters)
def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which