folder/UIDMaps.py split the if

This patch splits the if to avoid multiple commands in the same line.
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-30 13:53:57 +02:00
parent c68e70519d
commit 8cbdc65ebf

View File

@ -317,7 +317,9 @@ class MappedIMAPFolder(IMAPFolder):
if ruid not in self.r2l: if ruid not in self.r2l:
raise OfflineImapError("Cannot change unknown Maildir UID %s" % raise OfflineImapError("Cannot change unknown Maildir UID %s" %
ruid, OfflineImapError.ERROR.MESSAGE) ruid, OfflineImapError.ERROR.MESSAGE)
if ruid == new_ruid: return # sanity check shortcut if ruid == new_ruid:
return # sanity check shortcut
with self.maplock: with self.maplock:
luid = self.r2l[ruid] luid = self.r2l[ruid]
self.l2r[luid] = new_ruid self.l2r[luid] = new_ruid
@ -325,9 +327,12 @@ class MappedIMAPFolder(IMAPFolder):
self.r2l[new_ruid] = luid self.r2l[new_ruid] = luid
# TODO: diskl2r|r2l are a pain to sync and should be done away with # TODO: diskl2r|r2l are a pain to sync and should be done away with
# diskl2r only contains positive UIDs, so wrap in ifs. # diskl2r only contains positive UIDs, so wrap in ifs.
if luid > 0: self.diskl2r[luid] = new_ruid if luid > 0:
if ruid > 0: del self.diskr2l[ruid] self.diskl2r[luid] = new_ruid
if new_ruid > 0: self.diskr2l[new_ruid] = luid if ruid > 0:
del self.diskr2l[ruid]
if new_ruid > 0:
self.diskr2l[new_ruid] = luid
self._savemaps() self._savemaps()
def _mapped_delete(self, uidlist): def _mapped_delete(self, uidlist):