diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index c9255c3..e4e5444 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -438,8 +438,7 @@ def syncfolder(account, remotefolder, quick): # sync to messages with UIDs >= min_uid from this list. # # local messagelist might contain new messages (with uid's < 0). - positive_uids = filter( - lambda uid: uid > 0, localfolder.getmessageuidlist()) + positive_uids = [uid for uid in localfolder.getmessageuidlist() if uid > 0] if len(positive_uids) > 0: remotefolder.cachemessagelist(min_uid=min(positive_uids)) else: @@ -482,8 +481,7 @@ def syncfolder(account, remotefolder, quick): # messagelist.keys() instead of getuidmessagelist() because in # the UID mapped case we want the actual local UIDs, not their # remote counterparts - positive_uids = filter( - lambda uid: uid > 0, partial.messagelist.keys()) + positive_uids = [uid for uid in list(partial.messagelist.keys()) if uid > 0] if len(positive_uids) > 0: min_uid = min(positive_uids) else: diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 06cf451..71ad3f8 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -858,8 +858,7 @@ class BaseFolder(object): threads = [] - copylist = filter(lambda uid: not statusfolder.uidexists(uid), - self.getmessageuidlist()) + copylist = [uid for uid in self.getmessageuidlist() if not statusfolder.uidexists(uid)] num_to_copy = len(copylist) if num_to_copy and self.repository.account.dryrun: self.ui.info("[DRYRUN] Copy {0} messages from {1}[{2}] to {3}".format( @@ -909,10 +908,10 @@ class BaseFolder(object): # The list of messages to delete. If sync of deletions is disabled we # still remove stale entries from statusfolder (neither in local nor # remote). - deletelist = filter( - lambda uid: uid >= 0 and not self.uidexists(uid) - and (self._sync_deletes or not dstfolder.uidexists(uid)), - statusfolder.getmessageuidlist()) + deletelist = [uid for uid in statusfolder.getmessageuidlist() + if uid >= 0 and + not self.uidexists(uid) and + (self._sync_deletes or not dstfolder.uidexists(uid))] if len(deletelist): # Delete in statusfolder first to play safe. In case of abort, we @@ -921,7 +920,7 @@ class BaseFolder(object): # user, or not being tracked (e.g. because of maxage). statusfolder.deletemessages(deletelist) # Filter out untracked messages - deletelist = filter(lambda uid: dstfolder.uidexists(uid), deletelist) + deletelist = [uid for uid in deletelist if dstfolder.uidexists(uid)] if len(deletelist): self.ui.deletingmessages(deletelist, [dstfolder]) if self.repository.account.dryrun: diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index 94b2d08..c3ede3c 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -204,7 +204,7 @@ class MaildirFolder(BaseFolder): retval[uid]['filename'] = filepath if min_date != None: # Re-include messages with high enough uid's. - positive_uids = filter(lambda uid: uid > 0, retval) + positive_uids = [uid for uid in retval if uid > 0] if positive_uids: min_uid = min(positive_uids) for uid in date_excludees.keys(): diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 7e4ed85..9d30544 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -433,8 +433,7 @@ class IMAPServer: if not tried_to_authn: methods = ", ".join(map( - lambda x: x[5:], filter(lambda x: x[0:5] == "AUTH=", - imapobj.capabilities) + lambda x: x[5:], [x for x in imapobj.capabilities if x[0:5] == "AUTH="] )) raise OfflineImapError(u"Repository %s: no supported " "authentication mechanisms found; configured %s, " diff --git a/test/OLItest/TestRunner.py b/test/OLItest/TestRunner.py index e5fc030..88dade2 100644 --- a/test/OLItest/TestRunner.py +++ b/test/OLItest/TestRunner.py @@ -131,9 +131,7 @@ class OLITestLib(): else: sections = [r for r in config.sections() \ if r.startswith('Repository')] - sections = filter(lambda s: \ - config.get(s, 'Type').lower() == 'imap', - sections) + sections = [s for s in sections if config.get(s, 'Type').lower() == 'imap'] for sec in sections: # Connect to each IMAP repo and delete all folders # matching the folderfilter setting. We only allow basic