Reformat offlineimap/folder/LocalStatusSQLite.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:45:15 +02:00
parent cb95bc87b0
commit 265de25460

View File

@ -216,7 +216,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
# if from_ver <= 2: ... #upgrade from 2 to 3
# if from_ver <= 3: ... #upgrade from 3 to 4
def __create_db(self):
"""Create a new db file.
@ -232,12 +231,10 @@ class LocalStatusSQLiteFolder(BaseFolder):
self.connection.commit()
self._newfolder = True
# Interface from BaseFolder
def msglist_item_initializer(self, uid):
return {'uid': uid, 'flags': set(), 'labels': set(), 'time': 0, 'mtime': 0}
# Interface from BaseFolder
def cachemessagelist(self):
self.dropmessagelistcache()
@ -294,7 +291,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
'(id,flags,mtime,labels) VALUES (?,?,?,?)',
data, executemany=True)
# Following some pure SQLite functions, where we chose to use
# BaseFolder() methods instead. Doing those on the in-memory list is
# quicker anyway. If our db becomes so big that we don't want to
@ -331,7 +327,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
# return flags
# assert False,"getmessageflags() called on non-existing message"
# Interface from BaseFolder
def savemessage(self, uid, content, flags, rtime, mtime=0, labels=set()):
"""Writes a new message, with the specified uid.
@ -362,7 +357,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
exc_info()[2])
return uid
# Interface from BaseFolder
def savemessageflags(self, uid, flags):
assert self.uidexists(uid)
@ -370,11 +364,9 @@ class LocalStatusSQLiteFolder(BaseFolder):
flags = ''.join(sorted(flags))
self.__sql_write('UPDATE status SET flags=? WHERE id=?', (flags, uid))
def getmessageflags(self, uid):
return self.messagelist[uid]['flags']
def savemessagelabels(self, uid, labels, mtime=None):
self.messagelist[uid]['labels'] = labels
if mtime: self.messagelist[uid]['mtime'] = mtime
@ -385,7 +377,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
else:
self.__sql_write('UPDATE status SET labels=? WHERE id=?', (labels, uid))
def savemessageslabelsbulk(self, labels):
"""
Saves labels from a dictionary in a single database operation.
@ -396,7 +387,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
for uid, l in list(labels.items()):
self.messagelist[uid]['labels'] = l
def addmessageslabels(self, uids, labels):
data = []
for uid in uids:
@ -406,7 +396,6 @@ class LocalStatusSQLiteFolder(BaseFolder):
for uid in uids:
self.messagelist[uid]['labels'] = self.messagelist[uid]['labels'] | labels
def deletemessageslabels(self, uids, labels):
data = []
for uid in uids:
@ -416,11 +405,9 @@ class LocalStatusSQLiteFolder(BaseFolder):
for uid in uids:
self.messagelist[uid]['labels'] = self.messagelist[uid]['labels'] - labels
def getmessagelabels(self, uid):
return self.messagelist[uid]['labels']
def savemessagesmtimebulk(self, mtimes):
"""Saves mtimes from the mtimes dictionary in a single database operation."""
@ -429,11 +416,9 @@ class LocalStatusSQLiteFolder(BaseFolder):
for uid, mt in list(mtimes.items()):
self.messagelist[uid]['mtime'] = mt
def getmessagemtime(self, uid):
return self.messagelist[uid]['mtime']
# Interface from BaseFolder
def deletemessage(self, uid):
if not uid in self.messagelist: