diff options
author | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:16:53 -0300 |
---|---|---|
committer | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:17:46 -0300 |
commit | 6ab67b4c69be4d3f3fb34dd3f76cd36822e7e1ca (patch) | |
tree | 5e84bf46c4eef5d8d9f6c0724904e8e8aa9e4b5f | |
parent | a36a3bd419bdf33d66ed77277089db537e8b7b36 (diff) |
Fixed all the pep8 warnings in the code
-rw-r--r-- | src/leap/mail/imap/mailbox.py | 6 | ||||
-rw-r--r-- | src/leap/mail/imap/server.py | 16 | ||||
-rw-r--r-- | src/leap/mail/imap/tests/__init__.py | 6 | ||||
-rw-r--r-- | src/leap/mail/imap/tests/test_imap.py | 2 | ||||
-rw-r--r-- | src/leap/mail/imap/tests/test_imap_store_fetch.py | 12 | ||||
-rw-r--r-- | src/leap/mail/imap/tests/walktree.py | 2 | ||||
-rw-r--r-- | src/leap/mail/mail.py | 4 | ||||
-rw-r--r-- | src/leap/mail/utils.py | 7 | ||||
-rw-r--r-- | src/leap/mail/walk.py | 2 |
9 files changed, 31 insertions, 26 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py index 4339bd2..c52a2e3 100644 --- a/src/leap/mail/imap/mailbox.py +++ b/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/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py index 2b670c1..050521a 100644 --- a/src/leap/mail/imap/server.py +++ b/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/src/leap/mail/imap/tests/__init__.py b/src/leap/mail/imap/tests/__init__.py index f3d5ca6..32dacee 100644 --- a/src/leap/mail/imap/tests/__init__.py +++ b/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/src/leap/mail/imap/tests/test_imap.py b/src/leap/mail/imap/tests/test_imap.py index af1bd69..ffe59c3 100644 --- a/src/leap/mail/imap/tests/test_imap.py +++ b/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/src/leap/mail/imap/tests/test_imap_store_fetch.py b/src/leap/mail/imap/tests/test_imap_store_fetch.py index 6da8581..81f88fe 100644 --- a/src/leap/mail/imap/tests/test_imap_store_fetch.py +++ b/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/src/leap/mail/imap/tests/walktree.py b/src/leap/mail/imap/tests/walktree.py index 695f487..4544856 100644 --- a/src/leap/mail/imap/tests/walktree.py +++ b/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/src/leap/mail/mail.py b/src/leap/mail/mail.py index 6a7c558..540a493 100644 --- a/src/leap/mail/mail.py +++ b/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/src/leap/mail/utils.py b/src/leap/mail/utils.py index 029e9f5..64fca98 100644 --- a/src/leap/mail/utils.py +++ b/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/src/leap/mail/walk.py b/src/leap/mail/walk.py index 9f5098d..6d79b83 100644 --- a/src/leap/mail/walk.py +++ b/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] |