[PATCH] Change lambdas with map to list comprehension

Łukasz Żarnowiecki dolohow at outlook.com
Thu Aug 4 22:53:25 BST 2016


It is more readable and returns a list.

This continues work done in 19c4330.

Signed-off-by: Łukasz Żarnowiecki <dolohow at outlook.com>
---
 offlineimap/imapserver.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index 00b19e5..345e2b4 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -426,17 +426,12 @@ class IMAPServer(object):
                 exc_stack.append((m, e))
 
         if len(exc_stack):
-            msg = "\n\t".join(map(
-              lambda x: ": ".join((x[0], str(x[1]))),
-              exc_stack
-            ))
+            msg = "\n\t".join([": ".join((x[0], str(x[1]))) for x in exc_stack])
             raise OfflineImapError("All authentication types "
               "failed:\n\t%s"% msg, OfflineImapError.ERROR.REPO)
 
         if not tried_to_authn:
-            methods = ", ".join(map(
-              lambda x: x[5:], [x for x in imapobj.capabilities if x[0:5] == "AUTH="]
-            ))
+            methods = ", ".join([x[5:] for x in [x for x in imapobj.capabilities if x[0:5] == "AUTH="]])
             raise OfflineImapError(u"Repository %s: no supported "
               "authentication mechanisms found; configured %s, "
               "server advertises %s"% (self.repos,
-- 
2.9.2



More information about the OfflineIMAP-project mailing list