summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-07-21 19:30:33 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-07-21 19:30:33 -0300
commitbb132dcc1b558cfdfd0bf438779fe2ed07827fd5 (patch)
treee895c6438161a3472aa304a1b307541184fa61ec /src/leap
parent6ab67b4c69be4d3f3fb34dd3f76cd36822e7e1ca (diff)
Updated pep8 and fixed import and line break warnings
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/mail/_version.py13
-rw-r--r--src/leap/mail/imap/service/imap.py6
-rw-r--r--src/leap/mail/imap/tests/__init__.py14
-rw-r--r--src/leap/mail/imap/tests/walktree.py2
-rw-r--r--src/leap/mail/incoming/service.py12
-rw-r--r--src/leap/mail/smtp/__init__.py4
6 files changed, 24 insertions, 27 deletions
diff --git a/src/leap/mail/_version.py b/src/leap/mail/_version.py
index d80ec47..b77d552 100644
--- a/src/leap/mail/_version.py
+++ b/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/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py
index 92d05cc..c3ae59a 100644
--- a/src/leap/mail/imap/service/imap.py
+++ b/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/src/leap/mail/imap/tests/__init__.py b/src/leap/mail/imap/tests/__init__.py
index 32dacee..5cf60ed 100644
--- a/src/leap/mail/imap/tests/__init__.py
+++ b/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/src/leap/mail/imap/tests/walktree.py b/src/leap/mail/imap/tests/walktree.py
index 4544856..f259a55 100644
--- a/src/leap/mail/imap/tests/walktree.py
+++ b/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/src/leap/mail/incoming/service.py b/src/leap/mail/incoming/service.py
index 3daf86b..2bc6751 100644
--- a/src/leap/mail/incoming/service.py
+++ b/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/src/leap/mail/smtp/__init__.py b/src/leap/mail/smtp/__init__.py
index 3ef016b..2ff14d7 100644
--- a/src/leap/mail/smtp/__init__.py
+++ b/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):