From 0590982867187fca1f6c6f04a6e60a05ca2138b0 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:16:53 -0300 Subject: Fixed all the pep8 warnings in the code --- mail/src/leap/mail/imap/mailbox.py | 6 +++--- mail/src/leap/mail/imap/server.py | 16 ++++++++-------- mail/src/leap/mail/imap/tests/__init__.py | 6 +++--- mail/src/leap/mail/imap/tests/test_imap.py | 2 +- mail/src/leap/mail/imap/tests/test_imap_store_fetch.py | 12 ++++++++---- mail/src/leap/mail/imap/tests/walktree.py | 2 +- mail/src/leap/mail/mail.py | 4 ++-- mail/src/leap/mail/utils.py | 7 ++++--- mail/src/leap/mail/walk.py | 2 +- 9 files changed, 31 insertions(+), 26 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py index 4339bd2..c52a2e3 100644 --- a/mail/src/leap/mail/imap/mailbox.py +++ b/mail/src/leap/mail/imap/mailbox.py @@ -878,9 +878,9 @@ class IMAPMailbox(object): # A better place for this would be the COPY/APPEND dispatcher # in server.py, but qtreactor hangs when I do that, so this seems # to work fine for now. - #d.addCallback(lambda r: self.reactor.callLater(0, self.notify_new)) - #deferLater(self.reactor, 0, self._do_copy, message, d) - #return d + # d.addCallback(lambda r: self.reactor.callLater(0, self.notify_new)) + # deferLater(self.reactor, 0, self._do_copy, message, d) + # return d d = self.collection.copy_msg(message.message, self.collection.mbox_uuid) diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index 2b670c1..050521a 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -122,9 +122,9 @@ class LEAPIMAPServer(imap4.IMAP4Server): elif part.text: _w(str(part) + ' ') _f() - return imap4.FileProducer(msg.getBodyFile() - ).beginProducing(self.transport - ) + return imap4.FileProducer( + msg.getBodyFile() + ).beginProducing(self.transport) elif part.mime: hdrs = imap4._formatHeaders(msg.getHeaders(True)) @@ -151,10 +151,10 @@ class LEAPIMAPServer(imap4.IMAP4Server): _fd.seek(0) else: _fd = fd - return imap4.FileProducer(_fd - # END PATCHED #########################3 - ).beginProducing(self.transport - ) + return imap4.FileProducer( + _fd + # END PATCHED #########################3 + ).beginProducing(self.transport) else: mf = imap4.IMessageFile(msg, None) if mf is not None: @@ -459,7 +459,7 @@ class LEAPIMAPServer(imap4.IMAP4Server): mailboxes.addCallback(self._cbSubscribed) mailboxes.addCallback( self._cbListWork, tag, sub, cmdName, - ).addErrback(self._ebListWork, tag) + ).addErrback(self._ebListWork, tag) def _cbSubscribed(self, mailboxes): subscribed = [ diff --git a/mail/src/leap/mail/imap/tests/__init__.py b/mail/src/leap/mail/imap/tests/__init__.py index f3d5ca6..32dacee 100644 --- a/mail/src/leap/mail/imap/tests/__init__.py +++ b/mail/src/leap/mail/imap/tests/__init__.py @@ -1,4 +1,4 @@ -#-*- encoding: utf-8 -*- +# -*- encoding: utf-8 -*- """ leap/email/imap/tests/__init__.py ---------------------------------- @@ -26,10 +26,10 @@ from leap.soledad.client import Soledad from leap.soledad.common.document import SoledadDocument -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- # Some tests inherit from BaseSoledadTest in order to have a working Soledad # instance in each test. -#----------------------------------------------------------------------------- +# ----------------------------------------------------------------------------- class BaseSoledadIMAPTest(BaseLeapTest): """ diff --git a/mail/src/leap/mail/imap/tests/test_imap.py b/mail/src/leap/mail/imap/tests/test_imap.py index af1bd69..ffe59c3 100644 --- a/mail/src/leap/mail/imap/tests/test_imap.py +++ b/mail/src/leap/mail/imap/tests/test_imap.py @@ -439,7 +439,7 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): d1 = self.connected.addCallback(strip(add_mailbox)) d1.addCallback(strip(login)) d1.addCallback(strip(select)) - #d1.addErrback(self._ebGeneral) + # d1.addErrback(self._ebGeneral) d2 = self.loopback() diff --git a/mail/src/leap/mail/imap/tests/test_imap_store_fetch.py b/mail/src/leap/mail/imap/tests/test_imap_store_fetch.py index 6da8581..81f88fe 100644 --- a/mail/src/leap/mail/imap/tests/test_imap_store_fetch.py +++ b/mail/src/leap/mail/imap/tests/test_imap_store_fetch.py @@ -43,10 +43,14 @@ class StoreAndFetchTestCase(IMAP4HelperMixin): self.connected.addCallback( self._addSignedMessage).addCallback( - lambda uid: self.function( - uids, uid=uid) # do NOT use seq numbers! - ).addCallback(result).addCallback( - self._cbStopClient).addErrback(self._ebGeneral) + lambda uid: self.function( + uids, uid=uid + ) # do NOT use seq numbers! + ).addCallback( + result + ).addCallback( + self._cbStopClient + ).addErrback(self._ebGeneral) d = loopback.loopbackTCP(self.server, self.client, noisy=False) d.addCallback(lambda x: self.assertEqual(self.result, self.expected)) diff --git a/mail/src/leap/mail/imap/tests/walktree.py b/mail/src/leap/mail/imap/tests/walktree.py index 695f487..4544856 100644 --- a/mail/src/leap/mail/imap/tests/walktree.py +++ b/mail/src/leap/mail/imap/tests/walktree.py @@ -1,4 +1,4 @@ -#t -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- # walktree.py # Copyright (C) 2013 LEAP # diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py index 6a7c558..540a493 100644 --- a/mail/src/leap/mail/mail.py +++ b/mail/src/leap/mail/mail.py @@ -85,7 +85,7 @@ def _encode_payload(payload, ctype=""): # soledad when it's creating the documents. # if not charset: # charset = get_email_charset(payload) - #------------------------------------------------------ + # ----------------------------------------------------- if not charset: charset = "utf-8" @@ -113,7 +113,7 @@ def _unpack_headers(headers_dict): inner = zip( itertools.cycle([k]), map(lambda l: l.rstrip('\n'), splitted)) - headers_l = headers_l[:i] + inner + headers_l[i+1:] + headers_l = headers_l[:i] + inner + headers_l[i + 1:] return headers_l diff --git a/mail/src/leap/mail/utils.py b/mail/src/leap/mail/utils.py index 029e9f5..64fca98 100644 --- a/mail/src/leap/mail/utils.py +++ b/mail/src/leap/mail/utils.py @@ -254,6 +254,7 @@ def validate_address(address): # String manipulation # + class CustomJsonScanner(object): """ This class is a context manager definition used to monkey patch the default @@ -299,13 +300,13 @@ class CustomJsonScanner(object): end = s.find("\"", idx) while not found: try: - if s[end-1] != "\\": + if s[end - 1] != "\\": found = True else: - end = s.find("\"", end+1) + end = s.find("\"", end + 1) except Exception: found = True - return s[idx:end].decode("string-escape"), end+1 + return s[idx:end].decode("string-escape"), end + 1 def __enter__(self): """ diff --git a/mail/src/leap/mail/walk.py b/mail/src/leap/mail/walk.py index 9f5098d..6d79b83 100644 --- a/mail/src/leap/mail/walk.py +++ b/mail/src/leap/mail/walk.py @@ -187,7 +187,7 @@ def walk_msg_tree(parts, body_phash=None): last_part = max(main_pmap.keys()) main_pmap[last_part][PART_MAP] = {} for partind in range(len(pv) - 1): - print partind+1, len(parts) + print partind + 1, len(parts) main_pmap[last_part][PART_MAP][partind] = parts[partind + 1] outer = parts[0] -- cgit v1.2.3 From 16378bf2aeab4cb8da61299d34a8413902d614ae Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:30:33 -0300 Subject: Updated pep8 and fixed import and line break warnings --- mail/src/leap/mail/_version.py | 13 ++++--------- mail/src/leap/mail/imap/service/imap.py | 6 +++--- mail/src/leap/mail/imap/tests/__init__.py | 14 +++++++------- mail/src/leap/mail/imap/tests/walktree.py | 2 +- mail/src/leap/mail/incoming/service.py | 12 +++++++----- mail/src/leap/mail/smtp/__init__.py | 4 ++-- 6 files changed, 24 insertions(+), 27 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/_version.py b/mail/src/leap/mail/_version.py index d80ec47..b77d552 100644 --- a/mail/src/leap/mail/_version.py +++ b/mail/src/leap/mail/_version.py @@ -1,3 +1,7 @@ +import subprocess +import sys +import re +import os.path IN_LONG_VERSION_PY = True # This file helps to compute a version number in source trees obtained from @@ -14,10 +18,6 @@ git_refnames = "$Format:%d$" git_full = "$Format:%H$" -import subprocess -import sys - - def run_command(args, cwd=None, verbose=False): try: # remember shell=False, so use git.cmd on windows, not just git @@ -38,11 +38,6 @@ def run_command(args, cwd=None, verbose=False): return stdout -import sys -import re -import os.path - - def get_expanded_variables(versionfile_source): # the code embedded in _version.py can just fetch the value of these # variables. When used from setup.py, we don't want to import diff --git a/mail/src/leap/mail/imap/service/imap.py b/mail/src/leap/mail/imap/service/imap.py index 92d05cc..c3ae59a 100644 --- a/mail/src/leap/mail/imap/service/imap.py +++ b/mail/src/leap/mail/imap/service/imap.py @@ -17,7 +17,6 @@ """ IMAP service initialization """ -# TODO: leave only an implementor of IService in here import logging import os @@ -29,13 +28,14 @@ from twisted.internet.protocol import ServerFactory from twisted.mail import imap4 from twisted.python import log -logger = logging.getLogger(__name__) - from leap.common.events import emit, catalog from leap.common.check import leap_check from leap.mail.imap.account import IMAPAccount from leap.mail.imap.server import LEAPIMAPServer +# TODO: leave only an implementor of IService in here + +logger = logging.getLogger(__name__) DO_MANHOLE = os.environ.get("LEAP_MAIL_MANHOLE", None) if DO_MANHOLE: diff --git a/mail/src/leap/mail/imap/tests/__init__.py b/mail/src/leap/mail/imap/tests/__init__.py index 32dacee..5cf60ed 100644 --- a/mail/src/leap/mail/imap/tests/__init__.py +++ b/mail/src/leap/mail/imap/tests/__init__.py @@ -10,13 +10,6 @@ code, using twisted.trial, for testing leap_mx. @copyright: © 2013 Kali Kaneko, see COPYLEFT file """ -__all__ = ['test_imap'] - - -def run(): - """xxx fill me in""" - pass - import os import u1db @@ -25,12 +18,19 @@ from leap.common.testing.basetest import BaseLeapTest from leap.soledad.client import Soledad from leap.soledad.common.document import SoledadDocument +__all__ = ['test_imap'] + + +def run(): + """xxx fill me in""" + pass # ----------------------------------------------------------------------------- # Some tests inherit from BaseSoledadTest in order to have a working Soledad # instance in each test. # ----------------------------------------------------------------------------- + class BaseSoledadIMAPTest(BaseLeapTest): """ Instantiates GPG and Soledad for usage in LeapIMAPServer tests. diff --git a/mail/src/leap/mail/imap/tests/walktree.py b/mail/src/leap/mail/imap/tests/walktree.py index 4544856..f259a55 100644 --- a/mail/src/leap/mail/imap/tests/walktree.py +++ b/mail/src/leap/mail/imap/tests/walktree.py @@ -19,6 +19,7 @@ Tests for the walktree module. """ import os import sys +import pprint from email import parser from leap.mail import walk as W @@ -118,7 +119,6 @@ if DEBUG and DO_CHECK: print "Structure: OK" -import pprint print print "RAW DOCS" pprint.pprint(raw_docs) diff --git a/mail/src/leap/mail/incoming/service.py b/mail/src/leap/mail/incoming/service.py index 3daf86b..2bc6751 100644 --- a/mail/src/leap/mail/incoming/service.py +++ b/mail/src/leap/mail/incoming/service.py @@ -429,9 +429,9 @@ class IncomingMail(Service): fromHeader = msg.get('from', None) senderAddress = None - if (fromHeader is not None - and (msg.get_content_type() == MULTIPART_ENCRYPTED - or msg.get_content_type() == MULTIPART_SIGNED)): + if (fromHeader is not None and + (msg.get_content_type() == MULTIPART_ENCRYPTED or + msg.get_content_type() == MULTIPART_SIGNED)): senderAddress = parseaddr(fromHeader)[1] def add_leap_header(ret): @@ -635,8 +635,10 @@ class IncomingMail(Service): url = shlex.split(fields['url'])[0] # remove quotations urlparts = urlparse(url) addressHostname = address.split('@')[1] - if (urlparts.scheme == 'https' - and urlparts.hostname == addressHostname): + if ( + urlparts.scheme == 'https' and + urlparts.hostname == addressHostname + ): def fetch_error(failure): if failure.check(keymanager_errors.KeyNotFound): logger.warning("Url from OpenPGP header %s failed" diff --git a/mail/src/leap/mail/smtp/__init__.py b/mail/src/leap/mail/smtp/__init__.py index 3ef016b..2ff14d7 100644 --- a/mail/src/leap/mail/smtp/__init__.py +++ b/mail/src/leap/mail/smtp/__init__.py @@ -24,11 +24,11 @@ from twisted.internet import reactor from twisted.internet.error import CannotListenError from leap.mail.outgoing.service import OutgoingMail -logger = logging.getLogger(__name__) - from leap.common.events import emit, catalog from leap.mail.smtp.gateway import SMTPFactory +logger = logging.getLogger(__name__) + def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port, smtp_cert, smtp_key, encrypted_only): -- cgit v1.2.3 From ac6502194114a0e20c17c1801204b318731fece8 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:44:47 -0300 Subject: Pep8 warns about lambdas being assigned to a variable, changed walk and sync_hooks to lambdas to real functions --- mail/src/leap/mail/sync_hooks.py | 5 ++- mail/src/leap/mail/walk.py | 84 +++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 33 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/sync_hooks.py b/mail/src/leap/mail/sync_hooks.py index bd8d88d..8efbb7c 100644 --- a/mail/src/leap/mail/sync_hooks.py +++ b/mail/src/leap/mail/sync_hooks.py @@ -32,10 +32,11 @@ from twisted.python import log from leap.soledad.client.interfaces import ISoledadPostSyncPlugin from leap.mail import constants - logger = logging.getLogger(__name__) -_get_doc_type_preffix = lambda s: s[:2] + +def _get_doc_type_preffix(s): + return s[:2] class MailProcessingPostSyncHook(object): diff --git a/mail/src/leap/mail/walk.py b/mail/src/leap/mail/walk.py index 6d79b83..f613309 100644 --- a/mail/src/leap/mail/walk.py +++ b/mail/src/leap/mail/walk.py @@ -26,35 +26,49 @@ from leap.mail.utils import first DEBUG = os.environ.get("BITMASK_MAIL_DEBUG") if DEBUG: - get_hash = lambda s: sha256.SHA256(s).hexdigest()[:10] + def get_hash(s): + return sha256.SHA256(s).hexdigest()[:10] else: - get_hash = lambda s: sha256.SHA256(s).hexdigest() + def get_hash(s): + return sha256.SHA256(s).hexdigest() """ Get interesting message parts """ -get_parts = lambda msg: [ - {'multi': part.is_multipart(), - 'ctype': part.get_content_type(), - 'size': len(part.as_string()), - 'parts': len(part.get_payload()) - if isinstance(part.get_payload(), list) - else 1, - 'headers': part.items(), - 'phash': get_hash(part.get_payload()) - if not part.is_multipart() else None} - for part in msg.walk()] + + +def get_parts(msg): + return [ + { + 'multi': part.is_multipart(), + 'ctype': part.get_content_type(), + 'size': len(part.as_string()), + 'parts': + len(part.get_payload()) + if isinstance(part.get_payload(), list) + else 1, + 'headers': part.items(), + 'phash': + get_hash(part.get_payload()) + if not part.is_multipart() + else None + } for part in msg.walk()] """ Utility lambda functions for getting the parts vector and the payloads from the original message. """ -get_parts_vector = lambda parts: (x.get('parts', 1) for x in parts) -get_payloads = lambda msg: ((x.get_payload(), - dict(((str.lower(k), v) for k, v in (x.items())))) - for x in msg.walk()) + +def get_parts_vector(parts): + return (x.get('parts', 1) for x in parts) + + +def get_payloads(msg): + return ((x.get_payload(), + dict(((str.lower(k), v) for k, v in (x.items())))) + for x in msg.walk()) def get_body_phash(msg): @@ -73,18 +87,22 @@ index the content. Here we remove any mutable part, as the the filename in the content disposition. """ -get_raw_docs = lambda msg, parts: ( - {"type": "cnt", # type content they'll be - "raw": payload if not DEBUG else payload[:100], - "phash": get_hash(payload), - "content-disposition": first(headers.get( - 'content-disposition', '').split(';')), - "content-type": headers.get( - 'content-type', ''), - "content-transfer-encoding": headers.get( - 'content-transfer-type', '')} - for payload, headers in get_payloads(msg) - if not isinstance(payload, list)) + +def get_raw_docs(msg, parts): + return ( + { + "type": "cnt", # type content they'll be + "raw": payload if not DEBUG else payload[:100], + "phash": get_hash(payload), + "content-disposition": first(headers.get( + 'content-disposition', '').split(';')), + "content-type": headers.get( + 'content-type', ''), + "content-transfer-encoding": headers.get( + 'content-transfer-type', '') + } for payload, headers in get_payloads(msg) + if not isinstance(payload, list)) + """ Groucho Marx: Now pay particular attention to this first clause, because it's @@ -155,8 +173,12 @@ def walk_msg_tree(parts, body_phash=None): print # wrappers vector - getwv = lambda pv: [True if pv[i] != 1 and pv[i + 1] == 1 else False - for i in range(len(pv) - 1)] + def getwv(pv): + return [ + True if pv[i] != 1 and pv[i + 1] == 1 + else False + for i in range(len(pv) - 1) + ] wv = getwv(pv) # do until no wrapper document is left -- cgit v1.2.3 From 939a618de67ab685deb30d7f21ad796b3276059d Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 19:56:43 -0300 Subject: Transformed assigned lambdas to functions in models and test_models because of pep8 --- mail/src/leap/mail/adaptors/models.py | 6 ++---- mail/src/leap/mail/adaptors/tests/test_models.py | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/adaptors/models.py b/mail/src/leap/mail/adaptors/models.py index 88e0e4e..c5b838a 100644 --- a/mail/src/leap/mail/adaptors/models.py +++ b/mail/src/leap/mail/adaptors/models.py @@ -115,10 +115,8 @@ class DocumentWrapper(object): def _normalize_dict(_dict): items = _dict.items() - not_callable = lambda (k, v): not callable(v) - not_private = lambda(k, v): not k.startswith('_') - for cond in not_callable, not_private: - items = filter(cond, items) + items = filter(lambda k, v: not callable(v), items) + items = filter(lambda k, v: not k.startswith('_')) items = [(k, v) if not k.endswith('_') else (k[:-1], v) for (k, v) in items] items = [(k.replace('-', '_'), v) for (k, v) in items] diff --git a/mail/src/leap/mail/adaptors/tests/test_models.py b/mail/src/leap/mail/adaptors/tests/test_models.py index efe0bf2..b82cfad 100644 --- a/mail/src/leap/mail/adaptors/tests/test_models.py +++ b/mail/src/leap/mail/adaptors/tests/test_models.py @@ -39,7 +39,8 @@ class SerializableModelsTestCase(unittest.TestCase): class IgnoreMe(object): pass - killmeplease = lambda x: x + def killmeplease(x): + return x serialized = M.serialize() expected = {'foo': 42, 'bar': 33, 'baaz': None} @@ -88,7 +89,9 @@ class DocumentWrapperTestCase(unittest.TestCase): class Wrapper(models.DocumentWrapper): class model(models.SerializableModel): foo = 42 - getwrapper = lambda: Wrapper(bar=1) + + def getwrapper(): + return Wrapper(bar=1) self.assertRaises(RuntimeError, getwrapper) def test_no_model_wrapper(self): -- cgit v1.2.3 From c07fa6959abda3cbf185186a41e9bca51c14031b Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 21 Jul 2015 20:11:29 -0300 Subject: Changed imap tests and messages assigned lambdas to functions because of pep8 --- mail/src/leap/mail/imap/messages.py | 7 +++++-- mail/src/leap/mail/imap/tests/test_imap.py | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/imap/messages.py b/mail/src/leap/mail/imap/messages.py index 9af4c99..d1c7b93 100644 --- a/mail/src/leap/mail/imap/messages.py +++ b/mail/src/leap/mail/imap/messages.py @@ -217,10 +217,13 @@ def _format_headers(headers, negate, *names): return {str('content-type'): str('')} names = map(lambda s: s.upper(), names) + if negate: - cond = lambda key: key.upper() not in names + def cond(key): + return key.upper() not in names else: - cond = lambda key: key.upper() in names + def cond(key): + return key.upper() in names if isinstance(headers, list): headers = dict(headers) diff --git a/mail/src/leap/mail/imap/tests/test_imap.py b/mail/src/leap/mail/imap/tests/test_imap.py index ffe59c3..62c3c41 100644 --- a/mail/src/leap/mail/imap/tests/test_imap.py +++ b/mail/src/leap/mail/imap/tests/test_imap.py @@ -387,8 +387,11 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): acc.addMailbox('this/mbox'), acc.addMailbox('that/mbox')]) - dc1 = lambda: acc.subscribe('this/mbox') - dc2 = lambda: acc.subscribe('that/mbox') + def dc1(): + return acc.subscribe('this/mbox') + + def dc2(): + return acc.subscribe('that/mbox') def login(): return self.client.login(TEST_USER, TEST_PASSWD) @@ -668,9 +671,14 @@ class LEAPIMAP4ServerTestCase(IMAP4HelperMixin): acc = self.server.theAccount - dc1 = lambda: acc.addMailbox('root_subthing', creation_ts=42) - dc2 = lambda: acc.addMailbox('root_another_thing', creation_ts=42) - dc3 = lambda: acc.addMailbox('non_root_subthing', creation_ts=42) + def dc1(): + return acc.addMailbox('root_subthing', creation_ts=42) + + def dc2(): + return acc.addMailbox('root_another_thing', creation_ts=42) + + def dc3(): + return acc.addMailbox('non_root_subthing', creation_ts=42) def login(): return self.client.login(TEST_USER, TEST_PASSWD) -- cgit v1.2.3 From 229ab30fc0226b277b040e6398936856e3f66dcf Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Wed, 29 Jul 2015 16:11:33 +0200 Subject: [bug] fixed syntax error in models.py The lambdas take two args, so it needs to be a tuple. Furthermore filter needs a collection. --- mail/src/leap/mail/adaptors/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/adaptors/models.py b/mail/src/leap/mail/adaptors/models.py index c5b838a..2bf9e60 100644 --- a/mail/src/leap/mail/adaptors/models.py +++ b/mail/src/leap/mail/adaptors/models.py @@ -115,8 +115,8 @@ class DocumentWrapper(object): def _normalize_dict(_dict): items = _dict.items() - items = filter(lambda k, v: not callable(v), items) - items = filter(lambda k, v: not k.startswith('_')) + items = filter(lambda (k, v): not callable(v), items) + items = filter(lambda (k, v): not k.startswith('_'), items) items = [(k, v) if not k.endswith('_') else (k[:-1], v) for (k, v) in items] items = [(k.replace('-', '_'), v) for (k, v) in items] -- cgit v1.2.3