summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFlorian Weimer <fw@deneb.enyo.de>2010-05-07 21:23:22 +0000
committerFlorian Weimer <fw@deneb.enyo.de>2010-05-07 21:23:22 +0000
commit8394f263e5353b2c858c563ba4f4487044a401ea (patch)
tree53868b2fc5532af7ee2cae708470063488e086a7 /lib
parentd22e9d7b89d92bce9497482ea08b573c0086a981 (diff)
sectracker.xpickle: hide non-exported names
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@14634 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib')
-rw-r--r--lib/python/sectracker/xpickle.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/python/sectracker/xpickle.py b/lib/python/sectracker/xpickle.py
index 8743b3b752..6045780a4d 100644
--- a/lib/python/sectracker/xpickle.py
+++ b/lib/python/sectracker/xpickle.py
@@ -17,10 +17,10 @@
from __future__ import with_statement
-import errno
-import os.path
-import cPickle as pickle
-import tempfile
+import errno as _errno
+import os as _os
+import cPickle as _pickle
+import tempfile as _tempfile
EXTENSION = '.xpck'
@@ -28,9 +28,9 @@ def safeunlink(path):
"""Removes the file.
No exception is thrown if the file does not exist."""
try:
- os.unlink(path)
+ _os.unlink(path)
except OSError, e:
- if e.errno != errno.ENOENT:
+ if e.errno != _errno.ENOENT:
raise e
def replacefile(path, action):
@@ -40,14 +40,14 @@ def replacefile(path, action):
file, and an open file object for that temporary file. On success,
the temporary file is renmaed as the original file, atomically
replacing it. The return value is the value returned by the action."""
- t_fd, t_name = tempfile.mkstemp(suffix='.tmp', dir=os.path.dirname(path))
+ t_fd, t_name = _tempfile.mkstemp(suffix='.tmp', dir=_os.path.dirname(path))
try:
- t = os.fdopen(t_fd, "w")
+ t = _os.fdopen(t_fd, "w")
try:
result = action(t_name, t)
finally:
t.close()
- os.rename(t_name, path)
+ _os.rename(t_name, path)
t_name = None
finally:
if t_name is not None:
@@ -64,8 +64,8 @@ def _wraploader(typ, parser):
def safeload(path):
try:
with file(path + EXTENSION) as f:
- return (pickle.load(f), True)
- except (EOFError, IOError, pickle.PickleError):
+ return (_pickle.load(f), True)
+ except (EOFError, IOError, _pickle.PickleError):
return (None, False)
def check(data, st):
@@ -80,13 +80,13 @@ def _wraploader(typ, parser):
def reparse(path, st):
with file(path) as f:
obj = parser(path, f)
- data = pickle.dumps(
+ data = _pickle.dumps(
((typ, st.st_size, st.st_mtime, st.st_ino), obj), -1)
replacefile(path + EXTENSION, lambda name, f: f.write(data))
return obj
def loader(path):
- st = os.stat(path)
+ st = _os.stat(path)
xpck = path + EXTENSION
data, success = safeload(path)
if success:
@@ -105,7 +105,7 @@ def loader(file_type):
return lambda f: _wraploader(file_type, f)
def _test():
- with tempfile.NamedTemporaryFile() as t:
+ with _tempfile.NamedTemporaryFile() as t:
try:
data = "foo bar baz\n"
t.write(data)

© 2014-2024 Faster IT GmbH | imprint | privacy policy