Reformat offlineimap/folder/GmailMaildir.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:42:20 +02:00
parent af18230a2a
commit 2f97dda6d9

View File

@ -25,6 +25,7 @@ import offlineimap.accounts
from offlineimap import OfflineImapError
from offlineimap import imaputil
class GmailMaildirFolder(MaildirFolder):
"""Folder implementation to support adding labels to messages in a Maildir."""
@ -66,13 +67,11 @@ class GmailMaildirFolder(MaildirFolder):
return True
return False # Nope, nothing changed.
# Interface from BaseFolder
def msglist_item_initializer(self, uid):
return {'flags': set(), 'labels': set(), 'labels_cached': False,
'filename': '/no-dir/no-such-file/', 'mtime': 0}
def cachemessagelist(self, min_date=None, min_uid=None):
if self.ismessagelistempty():
self.messagelist = self._scanfolder(min_date=min_date,
@ -84,7 +83,6 @@ class GmailMaildirFolder(MaildirFolder):
filepath = os.path.join(self.getfullname(), msg['filename'])
msg['mtime'] = int(os.stat(filepath).st_mtime)
def getmessagelabels(self, uid):
# Labels are not cached in cachemessagelist because it is too slow.
if not self.messagelist[uid]['labels_cached']:
@ -106,7 +104,6 @@ class GmailMaildirFolder(MaildirFolder):
return self.messagelist[uid]['labels']
def getmessagemtime(self, uid):
if not 'mtime' in self.messagelist[uid]:
return 0
@ -185,7 +182,7 @@ class GmailMaildirFolder(MaildirFolder):
os.rename(tmppath, filepath)
except OSError as e:
six.reraise(OfflineImapError,
OfflineImapError("Can't rename file '%s' to '%s': %s"%
OfflineImapError("Can't rename file '%s' to '%s': %s" %
(tmppath, filepath, e[1]),
OfflineImapError.ERROR.FOLDER),
exc_info()[2])
@ -274,7 +271,6 @@ class GmailMaildirFolder(MaildirFolder):
if selfmtime > statusmtime:
uidlist.append(uid)
self.ui.collectingdata(uidlist, self)
# This can be slow if there is a lot of modified files.
for uid in uidlist: