mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Oops, closed is reserved, apparently.
This commit is contained in:
parent
f349f08111
commit
0fcb77243e
@ -163,10 +163,7 @@ def timeElapsed(elapsed, leadingZeroes=False, years=True, weeks=True,
|
|||||||
ret.append(nItems('second', secs))
|
ret.append(nItems('second', secs))
|
||||||
if len(ret) == 0:
|
if len(ret) == 0:
|
||||||
raise ValueError, 'Time difference not great enough to be noted.'
|
raise ValueError, 'Time difference not great enough to be noted.'
|
||||||
if len(ret) == 1:
|
return commaAndify(ret)
|
||||||
return ret[0]
|
|
||||||
else:
|
|
||||||
return commaAndify(ret)
|
|
||||||
|
|
||||||
def distance(s, t):
|
def distance(s, t):
|
||||||
"""Returns the levenshtein edit distance between two strings."""
|
"""Returns the levenshtein edit distance between two strings."""
|
||||||
@ -681,7 +678,6 @@ class AtomicFile(file):
|
|||||||
Opens the file in 'w' mode."""
|
Opens the file in 'w' mode."""
|
||||||
def __init__(self, filename, allowEmptyOverwrite=False):
|
def __init__(self, filename, allowEmptyOverwrite=False):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.closed = False
|
|
||||||
self.rolledback = False
|
self.rolledback = False
|
||||||
self.allowEmptyOverwrite = allowEmptyOverwrite
|
self.allowEmptyOverwrite = allowEmptyOverwrite
|
||||||
self.tempFilename = '%s.%s' % (filename, mktemp())
|
self.tempFilename = '%s.%s' % (filename, mktemp())
|
||||||
@ -692,7 +688,7 @@ class AtomicFile(file):
|
|||||||
if not self.closed:
|
if not self.closed:
|
||||||
super(AtomicFile, self).close()
|
super(AtomicFile, self).close()
|
||||||
if os.path.exists(self.tempFilename):
|
if os.path.exists(self.tempFilename):
|
||||||
print 'AtomicFile: Removing %s.' % self.tempFilename
|
#print 'AtomicFile: Removing %s.' % self.tempFilename
|
||||||
os.remove(self.tempFilename)
|
os.remove(self.tempFilename)
|
||||||
self.rolledback = True
|
self.rolledback = True
|
||||||
|
|
||||||
@ -700,7 +696,6 @@ class AtomicFile(file):
|
|||||||
#print 'AtomicFile.close'
|
#print 'AtomicFile.close'
|
||||||
if not self.rolledback:
|
if not self.rolledback:
|
||||||
#print 'AtomicFile.close: actually closing.'
|
#print 'AtomicFile.close: actually closing.'
|
||||||
self.closed = True
|
|
||||||
super(AtomicFile, self).close()
|
super(AtomicFile, self).close()
|
||||||
size = os.stat(self.tempFilename).st_size
|
size = os.stat(self.tempFilename).st_size
|
||||||
if size or self.allowEmptyOverwrite:
|
if size or self.allowEmptyOverwrite:
|
||||||
|
Loading…
Reference in New Issue
Block a user