Reformat offlineimap/folder/LocalStatus.py
Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
parent
da1788db53
commit
cb95bc87b0
@ -30,7 +30,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT %d"
|
magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT %d"
|
||||||
|
|
||||||
def __init__(self, name, repository):
|
def __init__(self, name, repository):
|
||||||
self.sep = '.' #needs to be set before super.__init__()
|
self.sep = '.' # needs to be set before super.__init__()
|
||||||
super(LocalStatusFolder, self).__init__(name, repository)
|
super(LocalStatusFolder, self).__init__(name, repository)
|
||||||
self.root = repository.root
|
self.root = repository.root
|
||||||
self.filename = os.path.join(self.getroot(), self.getfolderbasename())
|
self.filename = os.path.join(self.getroot(), self.getfolderbasename())
|
||||||
@ -68,7 +68,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
uid = int(uid)
|
uid = int(uid)
|
||||||
flags = set(flags)
|
flags = set(flags)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
errstr = ("Corrupt line '%s' in cache file '%s'"%
|
errstr = ("Corrupt line '%s' in cache file '%s'" %
|
||||||
(line, self.filename))
|
(line, self.filename))
|
||||||
self.ui.warn(errstr)
|
self.ui.warn(errstr)
|
||||||
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
|
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
|
||||||
@ -91,7 +91,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
mtime = int(mtime)
|
mtime = int(mtime)
|
||||||
labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0])
|
labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0])
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
errstr = "Corrupt line '%s' in cache file '%s'"% \
|
errstr = "Corrupt line '%s' in cache file '%s'" % \
|
||||||
(line, self.filename)
|
(line, self.filename)
|
||||||
self.ui.warn(errstr)
|
self.ui.warn(errstr)
|
||||||
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
|
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
|
||||||
@ -100,7 +100,6 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
self.messagelist[uid]['mtime'] = mtime
|
self.messagelist[uid]['mtime'] = mtime
|
||||||
self.messagelist[uid]['labels'] = labels
|
self.messagelist[uid]['labels'] = labels
|
||||||
|
|
||||||
|
|
||||||
# Interface from BaseFolder
|
# Interface from BaseFolder
|
||||||
def cachemessagelist(self):
|
def cachemessagelist(self):
|
||||||
if self.isnewfolder():
|
if self.isnewfolder():
|
||||||
@ -120,7 +119,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
# Convert from format v1.
|
# Convert from format v1.
|
||||||
elif line == (self.magicline % 1):
|
elif line == (self.magicline % 1):
|
||||||
self.ui._msg('Upgrading LocalStatus cache from version 1 '
|
self.ui._msg('Upgrading LocalStatus cache from version 1 '
|
||||||
'to version 2 for %s:%s'% (self.repository, self))
|
'to version 2 for %s:%s' % (self.repository, self))
|
||||||
self.readstatus_v1(cachefd)
|
self.readstatus_v1(cachefd)
|
||||||
cachefd.close()
|
cachefd.close()
|
||||||
self.save()
|
self.save()
|
||||||
@ -142,12 +141,12 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
if not line:
|
if not line:
|
||||||
# The status file is empty - should not have happened,
|
# The status file is empty - should not have happened,
|
||||||
# but somehow did.
|
# but somehow did.
|
||||||
errstr = "Cache file '%s' is empty."% self.filename
|
errstr = "Cache file '%s' is empty." % self.filename
|
||||||
self.ui.warn(errstr)
|
self.ui.warn(errstr)
|
||||||
cachefd.close()
|
cachefd.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
assert(line == (self.magicline % self.cur_version))
|
assert (line == (self.magicline % self.cur_version))
|
||||||
self.readstatus(cachefd)
|
self.readstatus(cachefd)
|
||||||
cachefd.close()
|
cachefd.close()
|
||||||
|
|
||||||
@ -163,7 +162,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
try:
|
try:
|
||||||
os.unlink(self.filename)
|
os.unlink(self.filename)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
self.ui.debug('', "could not remove file %s: %s"%
|
self.ui.debug('', "could not remove file %s: %s" %
|
||||||
(self.filename, e))
|
(self.filename, e))
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
@ -276,5 +275,5 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for uid in uidlist:
|
for uid in uidlist:
|
||||||
del(self.messagelist[uid])
|
del (self.messagelist[uid])
|
||||||
self.save()
|
self.save()
|
||||||
|
Loading…
Reference in New Issue
Block a user