six: changed offlineimap/folder/UIDMaps.py

This patch removes the library six, compatible with python2.

I need change these re-raise calls.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix) 2020-09-03 20:33:30 +02:00
parent dd3e7616cf
commit 75c718c75b

View File

@ -20,7 +20,6 @@ import shutil
from os import fsync, unlink from os import fsync, unlink
from sys import exc_info from sys import exc_info
from threading import Lock from threading import Lock
import six
try: try:
import portalocker import portalocker
@ -89,11 +88,11 @@ class MappedIMAPFolder(IMAPFolder):
try: try:
line = line.strip() line = line.strip()
except ValueError: except ValueError:
six.reraise(Exception, raise Exception(
Exception(
"Corrupt line '%s' in UID mapping file '%s'" % "Corrupt line '%s' in UID mapping file '%s'" %
(line, mapfilename)), (line, mapfilename),
exc_info()[2]) exc_info()[2])
(str1, str2) = line.split(':') (str1, str2) = line.split(':')
loc = int(str1) loc = int(str1)
rem = int(str2) rem = int(str2)
@ -129,13 +128,12 @@ class MappedIMAPFolder(IMAPFolder):
try: try:
return [mapping[x] for x in items] return [mapping[x] for x in items]
except KeyError as e: except KeyError as e:
six.reraise(OfflineImapError, raise OfflineImapError(
OfflineImapError(
"Could not find UID for msg '{0}' (f:'{1}'." "Could not find UID for msg '{0}' (f:'{1}'."
" This is usually a bad thing and should be " " This is usually a bad thing and should be "
"reported on the mailing list.".format( "reported on the mailing list.".format(
e.args[0], self), e.args[0], self),
OfflineImapError.ERROR.MESSAGE), OfflineImapError.ERROR.MESSAGE,
exc_info()[2]) exc_info()[2])
# Interface from BaseFolder # Interface from BaseFolder