summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-07-21 19:16:53 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-07-21 19:17:46 -0300
commit0590982867187fca1f6c6f04a6e60a05ca2138b0 (patch)
tree18ef26a6dfea988c5def28b167e2d5925f61ec52
parent1646b018bda0d40b38c747932029a41b8a7c8536 (diff)
Fixed all the pep8 warnings in the code
-rw-r--r--mail/src/leap/mail/imap/mailbox.py6
-rw-r--r--mail/src/leap/mail/imap/server.py16
-rw-r--r--mail/src/leap/mail/imap/tests/__init__.py6
-rw-r--r--mail/src/leap/mail/imap/tests/test_imap.py2
-rw-r--r--mail/src/leap/mail/imap/tests/test_imap_store_fetch.py12
-rw-r--r--mail/src/leap/mail/imap/tests/walktree.py2
-rw-r--r--mail/src/leap/mail/mail.py4
-rw-r--r--mail/src/leap/mail/utils.py7
-rw-r--r--mail/src/leap/mail/walk.py2
9 files changed, 31 insertions, 26 deletions
diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py
index 4339bd25..c52a2e36 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 2b670c11..050521af 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 f3d5ca6f..32daceec 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 af1bd691..ffe59c35 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 6da8581a..81f88fe1 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 695f487c..4544856a 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 6a7c5585..540a4939 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 029e9f57..64fca981 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 9f5098dd..6d79b83c 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]