Reformat offlineimap/folder/UIDMaps.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:48:04 +02:00
parent eafd9eb51d
commit 3a1b25c204

View File

@ -57,8 +57,8 @@ class MappedIMAPFolder(IMAPFolder):
def _loadmaps(self):
mapfilename = self._getmapfilename()
mapfilenametmp = "%s.tmp"% mapfilename
mapfilenamelock = "%s.lock"% mapfilename
mapfilenametmp = "%s.tmp" % mapfilename
mapfilenamelock = "%s.lock" % mapfilename
with self.maplock and open(mapfilenamelock, 'w') as mapfilelock:
try:
fnctl.lockf(mapfilelock, fnctl.LOCK_EX) # Blocks until acquired.
@ -83,7 +83,7 @@ class MappedIMAPFolder(IMAPFolder):
except ValueError:
six.reraise(Exception,
Exception(
"Corrupt line '%s' in UID mapping file '%s'"%
"Corrupt line '%s' in UID mapping file '%s'" %
(line, mapfilename)),
exc_info()[2])
(str1, str2) = line.split(':')
@ -99,8 +99,8 @@ class MappedIMAPFolder(IMAPFolder):
mapfilename = self._getmapfilename()
# Do not use the map file directly to prevent from leaving it truncated.
mapfilenametmp = "%s.tmp"% mapfilename
mapfilenamelock = "%s.lock"% mapfilename
mapfilenametmp = "%s.tmp" % mapfilename
mapfilenamelock = "%s.lock" % mapfilename
with self.maplock and open(mapfilenamelock, 'w') as mapfilelock:
# The "account" lock already prevents from multiple access by
# different processes. However, we still need to protect for
@ -111,7 +111,7 @@ class MappedIMAPFolder(IMAPFolder):
pass # Windows...
with open(mapfilenametmp, 'wt') as mapfilefd:
for (key, value) in list(self.diskl2r.items()):
mapfilefd.write("%d:%d\n"% (key, value))
mapfilefd.write("%d:%d\n" % (key, value))
if self.dofsync():
fsync(mapfilefd)
# The lock is released when the file descriptor ends.
@ -142,7 +142,7 @@ class MappedIMAPFolder(IMAPFolder):
for luid in list(self.diskl2r.keys()):
if not luid in reallist:
ruid = self.diskl2r[luid]
#XXX: the following KeyError are sightly unexpected. This
# XXX: the following KeyError are sightly unexpected. This
# would require more digging to understand how it's
# possible.
errorMessage = ("unexpected error: key {} was not found "
@ -268,7 +268,7 @@ class MappedIMAPFolder(IMAPFolder):
newluid = self._mb.savemessage(-1, content, flags, rtime)
if newluid < 1:
raise OfflineImapError("server of repository '%s' did not return "
"a valid UID (got '%s') for UID '%s' from '%s'"% (
"a valid UID (got '%s') for UID '%s' from '%s'" % (
self._mb.getname(), newluid, uid, self.getname()
),
OfflineImapError.ERROR.MESSAGE
@ -315,7 +315,7 @@ class MappedIMAPFolder(IMAPFolder):
changing the mappings file."""
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)
if ruid == new_ruid: return # sanity check shortcut
with self.maplock: