Reformat offlineimap/mbnames.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 20:22:14 +02:00
parent 9c865afbf0
commit 973e3324ff

View File

@ -21,12 +21,12 @@ import json
from threading import Lock
from os import listdir, makedirs, path, unlink
from sys import exc_info
try:
from configparser import NoSectionError
except ImportError: # Py3.
from configparser import NoSectionError
_mbLock = Lock()
_mbnames = None
@ -93,7 +93,7 @@ class _IntermediateMbnames(object):
self._accountname = accountname
self._folder_root = folder_root
self._folderfilter = folderfilter
self._path = path.join(mbnamesdir, "%s.json"% accountname)
self._path = path.join(mbnamesdir, "%s.json" % accountname)
self._dryrun = dry_run
def add(self, foldername):
@ -117,7 +117,7 @@ class _IntermediateMbnames(object):
})
if self._dryrun:
self.ui.info("mbnames would write %s"% self._path)
self.ui.info("mbnames would write %s" % self._path)
else:
with open(
self._path, "w", encoding='utf-8') as intermediateFD:
@ -183,10 +183,10 @@ class _Mbnames(object):
def _removeIntermediateFile(self, path):
if self._dryrun:
self.ui.info("mbnames would remove %s"% path)
self.ui.info("mbnames would remove %s" % path)
else:
unlink(path)
self.ui.info("removed %s"% path)
self.ui.info("removed %s" % path)
def addAccountFolder(self, accountname, folder_root, foldername):
"""Add foldername entry for an account."""
@ -240,12 +240,12 @@ class _Mbnames(object):
itemlist.append(item)
except (OSError, IOError) as e:
self.ui.error("could not read intermediate mbnames file '%s':"
"%s"% (intermediateFile, str(e)))
"%s" % (intermediateFile, str(e)))
except Exception as e:
self.ui.error(
e,
exc_info()[2],
("intermediate mbnames file %s not properly read"%
("intermediate mbnames file %s not properly read" %
intermediateFile)
)
@ -253,7 +253,7 @@ class _Mbnames(object):
itemlist = [self._peritem % d for d in itemlist]
if self._dryrun:
self.ui.info("mbnames would write %s"% self._path)
self.ui.info("mbnames would write %s" % self._path)
else:
try:
with open(
@ -265,7 +265,7 @@ class _Mbnames(object):
self.ui.error(
e,
exc_info()[2],
"mbnames file %s not properly written"% self._path
"mbnames file %s not properly written" % self._path
)
def writeIntermediateFile(self, accountname):
@ -275,5 +275,5 @@ class _Mbnames(object):
self.ui.error(
e,
exc_info()[2],
"intermediate mbnames file %s not properly written"% self._path
"intermediate mbnames file %s not properly written" % self._path
)