Maildir.py renamed variable names

This patch renames some variables to avoid these warnings:

Variable name "e" doesn't conform to snake_case naming style (invalid-name)
This commit is contained in:
Rodolfo García Peñas (kix) 2020-11-01 09:26:42 +01:00
parent 5c6e95103e
commit 646cb4354b

View File

@ -46,19 +46,19 @@ class MaildirRepository(BaseRepository):
# Create the keyword->char mapping # Create the keyword->char mapping
self.keyword2char = dict() self.keyword2char = dict()
for c in 'abcdefghijklmnopqrstuvwxyz': for char in 'abcdefghijklmnopqrstuvwxyz':
confkey = 'customflag_' + c confkey = 'customflag_' + char
keyword = self.getconf(confkey, None) keyword = self.getconf(confkey, None)
if keyword is not None: if keyword is not None:
self.keyword2char[keyword] = c self.keyword2char[keyword] = char
def _append_folder_atimes(self, foldername): def _append_folder_atimes(self, foldername):
"""Store the atimes of a folder's new|cur in self.folder_atimes""" """Store the atimes of a folder's new|cur in self.folder_atimes"""
p = os.path.join(self.root, foldername) path = os.path.join(self.root, foldername)
new = os.path.join(p, 'new') new = os.path.join(path, 'new')
cur = os.path.join(p, 'cur') cur = os.path.join(path, 'cur')
atimes = (p, os.path.getatime(new), os.path.getatime(cur)) atimes = (path, os.path.getatime(new), os.path.getatime(cur))
self.folder_atimes.append(atimes) self.folder_atimes.append(atimes)
def restore_atime(self): def restore_atime(self):
@ -129,16 +129,16 @@ class MaildirRepository(BaseRepository):
self.debug("makefolder: calling makedirs '%s'" % full_path) self.debug("makefolder: calling makedirs '%s'" % full_path)
try: try:
os.makedirs(full_path, 0o700) os.makedirs(full_path, 0o700)
except OSError as e: except OSError as exc:
if e.errno == 17 and os.path.isdir(full_path): if exc.errno == 17 and os.path.isdir(full_path):
self.debug("makefolder: '%s' already a directory" % foldername) self.debug("makefolder: '%s' already a directory" % foldername)
else: else:
raise raise
for subdir in ['cur', 'new', 'tmp']: for subdir in ['cur', 'new', 'tmp']:
try: try:
os.mkdir(os.path.join(full_path, subdir), 0o700) os.mkdir(os.path.join(full_path, subdir), 0o700)
except OSError as e: except OSError as exc:
if e.errno == 17 and os.path.isdir(full_path): if exc.errno == 17 and os.path.isdir(full_path):
self.debug("makefolder: '%s' already has subdir %s" % self.debug("makefolder: '%s' already has subdir %s" %
(foldername, subdir)) (foldername, subdir))
else: else:
@ -156,9 +156,9 @@ class MaildirRepository(BaseRepository):
# getfolders() will scan and cache the values *if* necessary # getfolders() will scan and cache the values *if* necessary
folders = self.getfolders() folders = self.getfolders()
for f in folders: for foldr in folders:
if foldername == f.name: if foldername == foldr.name:
return f return foldr
raise OfflineImapError("getfolder() asked for a nonexisting " raise OfflineImapError("getfolder() asked for a nonexisting "
"folder '%s'." % foldername, OfflineImapError.ERROR.FOLDER) "folder '%s'." % foldername, OfflineImapError.ERROR.FOLDER)
@ -207,9 +207,9 @@ class MaildirRepository(BaseRepository):
self.debug(" This is maildir folder '%s'." % foldername) self.debug(" This is maildir folder '%s'." % foldername)
if self.getconfboolean('restoreatime', False): if self.getconfboolean('restoreatime', False):
self._append_folder_atimes(foldername) self._append_folder_atimes(foldername)
fd = self.getfoldertype()(self.root, foldername, file_desc = self.getfoldertype()(self.root, foldername,
self.getsep(), self) self.getsep(), self)
retval.append(fd) retval.append(file_desc)
if self.getsep() == '/' and dirname != '': if self.getsep() == '/' and dirname != '':
# Recursively check sub-directories for folders too. # Recursively check sub-directories for folders too.