From 42e4458f3f37d50725a37a7e22835ab677cc24aa Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 7 Apr 2016 11:09:05 -0400 Subject: [style] pep8 --- src/leap/bitmask/__init__.py | 3 ++- src/leap/bitmask/app.py | 20 +++++++++++--------- src/leap/bitmask/config/leapsettings.py | 1 - src/leap/bitmask/util/keyring_helpers.py | 5 +++-- src/leap/bitmask/util/pastebin.py | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py index 6ab55e53..c25ae999 100644 --- a/src/leap/bitmask/__init__.py +++ b/src/leap/bitmask/__init__.py @@ -19,6 +19,8 @@ Init file for leap.bitmask Initializes version and app info. """ +from ._version import get_versions + # HACK: This is a hack so that py2app copies _scrypt.so to the right # place, it can't be technically imported, but that doesn't matter # because the import is never executed @@ -45,7 +47,6 @@ def _is_release_version(version_str): return patch.isdigit() -from ._version import get_versions __version__ = get_versions()['version'] __version_hash__ = get_versions()['full-revisionid'] IS_RELEASE_VERSION = _is_release_version(__version__) diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 0c4c32e2..0ae60e48 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -46,11 +46,7 @@ import os import platform import sys -if platform.system() == "Darwin": - # We need to tune maximum number of files, due to zmq usage - # we hit the limit. - import resource - resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 10240)) +import psutil from leap.bitmask import __version__ as VERSION from leap.bitmask.backend.backend_proxy import BackendProxy @@ -70,7 +66,12 @@ from leap.mail import __version__ as MAIL_VERSION import codecs codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None) -import psutil + +if platform.system() == "Darwin": + # We need to tune maximum number of files, due to zmq usage + # we hit the limit. + import resource + resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 10240)) def kill_the_children(): @@ -226,9 +227,10 @@ def start_app(): backend_pid = None if not backend_running: frontend_pid = os.getpid() - backend_process = multiprocessing.Process(target=run_backend, - name='Backend', - args=(opts.danger, flags_dict, frontend_pid)) + backend_process = multiprocessing.Process( + target=run_backend, + name='Backend', + args=(opts.danger, flags_dict, frontend_pid)) # we don't set the 'daemon mode' since we need to start child processes # in the backend # backend_process.daemon = True diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py index d7590c24..01900484 100644 --- a/src/leap/bitmask/config/leapsettings.py +++ b/src/leap/bitmask/config/leapsettings.py @@ -361,4 +361,3 @@ class LeapSettings(object): def set_pixelmail_enabled(self, enabled): leap_assert_type(enabled, bool) self._settings.setvalue(self.PIXELMAIL_KEY, enabled) - diff --git a/src/leap/bitmask/util/keyring_helpers.py b/src/leap/bitmask/util/keyring_helpers.py index d81f39b1..c5181348 100644 --- a/src/leap/bitmask/util/keyring_helpers.py +++ b/src/leap/bitmask/util/keyring_helpers.py @@ -24,8 +24,9 @@ try: EncryptedKeyring, PlaintextKeyring ] - canuse = lambda kr: (kr is not None - and kr.__class__ not in OBSOLETE_KEYRINGS) + canuse = lambda kr: ( + kr is not None and + kr.__class__ not in OBSOLETE_KEYRINGS) except Exception: # Problems when importing keyring! It might be a problem binding to the diff --git a/src/leap/bitmask/util/pastebin.py b/src/leap/bitmask/util/pastebin.py index 6d50ac9e..b476ad88 100644 --- a/src/leap/bitmask/util/pastebin.py +++ b/src/leap/bitmask/util/pastebin.py @@ -25,13 +25,13 @@ ############################################################################# +import urllib + __ALL__ = ['delete_paste', 'user_details', 'trending', 'pastes_by_user', 'generate_user_key', 'paste', 'Pastebin', 'PastebinError', 'PostLimitError'] -import urllib - class PastebinError(RuntimeError): """Pastebin API error. -- cgit v1.2.3