six: changed offlineimap/folder/Maildir.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:42:30 +02:00
parent 4b32d62fe9
commit ba11b2d684

View File

@ -21,7 +21,6 @@ import re
import os import os
from sys import exc_info from sys import exc_info
from threading import Lock from threading import Lock
import six
try: try:
from hashlib import md5 from hashlib import md5
@ -319,11 +318,10 @@ class MaildirFolder(BaseFolder):
time.sleep(0.23) time.sleep(0.23)
continue continue
severity = OfflineImapError.ERROR.MESSAGE severity = OfflineImapError.ERROR.MESSAGE
six.reraise(OfflineImapError, raise OfflineImapError(
OfflineImapError( "Unique filename %s already exists." %
"Unique filename %s already exists." % filename, severity,
filename, severity), exc_info()[2])
exc_info()[2])
else: else:
raise raise
@ -442,12 +440,11 @@ class MaildirFolder(BaseFolder):
os.rename(os.path.join(self.getfullname(), oldfilename), os.rename(os.path.join(self.getfullname(), oldfilename),
os.path.join(self.getfullname(), newfilename)) os.path.join(self.getfullname(), newfilename))
except OSError as e: except OSError as e:
six.reraise(OfflineImapError, raise OfflineImapError(
OfflineImapError( "Can't rename file '%s' to '%s': %s" %
"Can't rename file '%s' to '%s': %s" % (oldfilename, newfilename, e[1]),
(oldfilename, newfilename, e[1]), OfflineImapError.ERROR.FOLDER,
OfflineImapError.ERROR.FOLDER), exc_info()[2])
exc_info()[2])
self.messagelist[uid]['flags'] = flags self.messagelist[uid]['flags'] = flags
self.messagelist[uid]['filename'] = newfilename self.messagelist[uid]['filename'] = newfilename
@ -529,12 +526,12 @@ class MaildirFolder(BaseFolder):
try: try:
os.rename(filename, newfilename) os.rename(filename, newfilename)
except OSError as e: except OSError as e:
six.reraise(OfflineImapError, raise OfflineImapError(
OfflineImapError( "Can't rename file '%s' to '%s': %s" %
"Can't rename file '%s' to '%s': %s" % (filename, newfilename, e[1]),
(filename, newfilename, e[1]), OfflineImapError.ERROR.FOLDER,
OfflineImapError.ERROR.FOLDER), exc_info()[2])
exc_info()[2])
elif match.group(1) != self._foldermd5: elif match.group(1) != self._foldermd5:
self.ui.warn(("Inconsistent FMD5 for file `%s':" self.ui.warn(("Inconsistent FMD5 for file `%s':"
" Neither `%s' nor `%s' found") " Neither `%s' nor `%s' found")