six: changed offlineimap/accounts.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:06:15 +02:00
parent df4b9174d7
commit b8137a8028

View File

@ -20,7 +20,6 @@ import os
import time import time
from sys import exc_info from sys import exc_info
import traceback import traceback
import six
from offlineimap import mbnames, CustomConfig, OfflineImapError from offlineimap import mbnames, CustomConfig, OfflineImapError
from offlineimap import globals from offlineimap import globals
@ -245,12 +244,11 @@ class SyncableAccount(Account):
pass # fnctl not available, disable file locking... :( pass # fnctl not available, disable file locking... :(
except IOError: except IOError:
self._lockfd.close() self._lockfd.close()
six.reraise(OfflineImapError, raise OfflineImapError(
OfflineImapError( "Could not lock account %s. Is another "
"Could not lock account %s. Is another " "instance using this account?" % self,
"instance using this account?" % self, OfflineImapError.ERROR.REPO,
OfflineImapError.ERROR.REPO), exc_info()[2])
exc_info()[2])
def _unlock(self): def _unlock(self):
"""Unlock the account, deleting the lock file""" """Unlock the account, deleting the lock file"""
@ -614,12 +612,11 @@ def syncfolder(account, remotefolder, quick):
localstart = localfolder.getstartdate() localstart = localfolder.getstartdate()
remotestart = remotefolder.getstartdate() remotestart = remotefolder.getstartdate()
if (maxage is not None) + (localstart is not None) + (remotestart is not None) > 1: if (maxage is not None) + (localstart is not None) + (remotestart is not None) > 1:
six.reraise(OfflineImapError, raise OfflineImapError("You can set at most one of the "
OfflineImapError("You can set at most one of the " "following: maxage, startdate (for the local "
"following: maxage, startdate (for the local " "folder), startdate (for the remote folder)",
"folder), startdate (for the remote folder)", OfflineImapError.ERROR.REPO,
OfflineImapError.ERROR.REPO), exc_info()[2])
exc_info()[2])
if (maxage is not None or localstart or remotestart) and quick: if (maxage is not None or localstart or remotestart) and quick:
# IMAP quickchanged isn't compatible with options that # IMAP quickchanged isn't compatible with options that
# involve restricting the messagelist, since the "quick" # involve restricting the messagelist, since the "quick"