diff options
author | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:30:33 -0300 |
---|---|---|
committer | Bruno Wagner <bwgpro@gmail.com> | 2015-07-21 19:30:33 -0300 |
commit | 16378bf2aeab4cb8da61299d34a8413902d614ae (patch) | |
tree | 1ed163dd7b6811c30ab4ac84e83ab84bb6efe296 /mail | |
parent | 0590982867187fca1f6c6f04a6e60a05ca2138b0 (diff) |
Updated pep8 and fixed import and line break warnings
Diffstat (limited to 'mail')
-rw-r--r-- | mail/src/leap/mail/_version.py | 13 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/service/imap.py | 6 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/tests/__init__.py | 14 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/tests/walktree.py | 2 | ||||
-rw-r--r-- | mail/src/leap/mail/incoming/service.py | 12 | ||||
-rw-r--r-- | mail/src/leap/mail/smtp/__init__.py | 4 |
6 files changed, 24 insertions, 27 deletions
diff --git a/mail/src/leap/mail/_version.py b/mail/src/leap/mail/_version.py index d80ec476..b77d552c 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 92d05ccb..c3ae59ac 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 32daceec..5cf60ed2 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 4544856a..f259a556 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 3daf86b2..2bc67515 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 3ef016b7..2ff14d7b 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): |