Reformat offlineimap/folder/LocalStatus.py

Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-29 19:43:52 +02:00
parent da1788db53
commit cb95bc87b0

View File

@ -30,7 +30,7 @@ class LocalStatusFolder(BaseFolder):
magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT %d"
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)
self.root = repository.root
self.filename = os.path.join(self.getroot(), self.getfolderbasename())
@ -68,7 +68,7 @@ class LocalStatusFolder(BaseFolder):
uid = int(uid)
flags = set(flags)
except ValueError as e:
errstr = ("Corrupt line '%s' in cache file '%s'"%
errstr = ("Corrupt line '%s' in cache file '%s'" %
(line, self.filename))
self.ui.warn(errstr)
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
@ -91,7 +91,7 @@ class LocalStatusFolder(BaseFolder):
mtime = int(mtime)
labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0])
except ValueError as e:
errstr = "Corrupt line '%s' in cache file '%s'"% \
errstr = "Corrupt line '%s' in cache file '%s'" % \
(line, self.filename)
self.ui.warn(errstr)
six.reraise(ValueError, ValueError(errstr), exc_info()[2])
@ -100,7 +100,6 @@ class LocalStatusFolder(BaseFolder):
self.messagelist[uid]['mtime'] = mtime
self.messagelist[uid]['labels'] = labels
# Interface from BaseFolder
def cachemessagelist(self):
if self.isnewfolder():
@ -120,7 +119,7 @@ class LocalStatusFolder(BaseFolder):
# Convert from format v1.
elif line == (self.magicline % 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)
cachefd.close()
self.save()
@ -142,12 +141,12 @@ class LocalStatusFolder(BaseFolder):
if not line:
# The status file is empty - should not have happened,
# but somehow did.
errstr = "Cache file '%s' is empty."% self.filename
errstr = "Cache file '%s' is empty." % self.filename
self.ui.warn(errstr)
cachefd.close()
return
assert(line == (self.magicline % self.cur_version))
assert (line == (self.magicline % self.cur_version))
self.readstatus(cachefd)
cachefd.close()
@ -163,7 +162,7 @@ class LocalStatusFolder(BaseFolder):
try:
os.unlink(self.filename)
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))
def save(self):
@ -276,5 +275,5 @@ class LocalStatusFolder(BaseFolder):
return
for uid in uidlist:
del(self.messagelist[uid])
del (self.messagelist[uid])
self.save()