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