From 2b5b79b114423f8d68c992d1bd0bb251e2dfba2b Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 4 Jan 2018 18:38:01 +0100 Subject: [style] pep8 --- src/leap/bitmask/chrome/chromeapp.py | 2 +- src/leap/bitmask/cli/bitmask_cli.py | 4 ++-- src/leap/bitmask/cli/command.py | 10 +++++----- src/leap/bitmask/gui/app.py | 1 - src/leap/bitmask/gui/app2.py | 1 - src/leap/bitmask/gui/housekeeping.py | 4 ++++ 6 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/leap/bitmask') diff --git a/src/leap/bitmask/chrome/chromeapp.py b/src/leap/bitmask/chrome/chromeapp.py index feb765d6..b1de0990 100644 --- a/src/leap/bitmask/chrome/chromeapp.py +++ b/src/leap/bitmask/chrome/chromeapp.py @@ -61,7 +61,7 @@ def delete_old_authtoken(): def start_app(): if not commands.getoutput('which chromium'): - print ('[!] Cannot find chromium installed in the system!') + print('[!] Cannot find chromium installed in the system!') sys.exit(1) delete_old_authtoken() bitmaskd = Process(target=run_bitmaskd) diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py index eafdb1e4..40f119e9 100755 --- a/src/leap/bitmask/cli/bitmask_cli.py +++ b/src/leap/bitmask/cli/bitmask_cli.py @@ -152,8 +152,8 @@ def execute(): timeout=0.1, printer=_null_printer, errb=lambda: cli.start(args)) except Exception, e: - print (Fore.RED + "ERROR: " + Fore.RESET + - "%s" % str(e)) + print(Fore.RED + "ERROR: " + Fore.RESET + + "%s" % str(e)) defer.returnValue('') cli.data = [] diff --git a/src/leap/bitmask/cli/command.py b/src/leap/bitmask/cli/command.py index fd32ab95..a70b2d43 100644 --- a/src/leap/bitmask/cli/command.py +++ b/src/leap/bitmask/cli/command.py @@ -166,15 +166,15 @@ class Command(object): print(json.dumps(obj, indent=2)) elif not obj['error']: if 'result' not in obj: - print (Fore.RED + 'ERROR: malformed response, expected' - ' obj["result"]' + Fore.RESET) + print(Fore.RED + 'ERROR: malformed response, expected' + ' obj["result"]' + Fore.RESET) elif obj['result'] is None: - print (Fore.RED + 'ERROR: empty response. Check logs.' + - Fore.RESET) + print(Fore.RED + 'ERROR: empty response. Check logs.' + + Fore.RESET) else: return printer(obj['result']) else: - print Fore.RED + 'ERROR: ' + '%s' % obj['error'] + Fore.RESET + print(Fore.RED + 'ERROR: ' + '%s' % obj['error'] + Fore.RESET) def _timeout_handler(self, failure, errb): if failure.trap(ZmqRequestTimeoutError) == ZmqRequestTimeoutError: diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py index 2033fc6d..2988b15c 100644 --- a/src/leap/bitmask/gui/app.py +++ b/src/leap/bitmask/gui/app.py @@ -253,6 +253,5 @@ def start_app(): launch_gui() - if __name__ == "__main__": start_app() diff --git a/src/leap/bitmask/gui/app2.py b/src/leap/bitmask/gui/app2.py index 3e83b435..f8f62938 100644 --- a/src/leap/bitmask/gui/app2.py +++ b/src/leap/bitmask/gui/app2.py @@ -120,7 +120,6 @@ class BrowserWindow(object): print('[bitmask] shutting down gui') - def launch_gui(): global bitmaskd diff --git a/src/leap/bitmask/gui/housekeeping.py b/src/leap/bitmask/gui/housekeeping.py index 7069adba..5c1d8079 100644 --- a/src/leap/bitmask/gui/housekeeping.py +++ b/src/leap/bitmask/gui/housekeeping.py @@ -8,6 +8,7 @@ from leap.common.config import get_path_prefix class NoAuthTokenError(Exception): pass + def get_authenticated_url(): url = "http://localhost:7070" path = os.path.join(get_path_prefix(), 'leap', 'authtoken') @@ -26,6 +27,7 @@ def get_authenticated_url(): url += '#' + token return url + def terminate(pid): if os.path.isfile(pid): with open(pid) as f: @@ -33,6 +35,7 @@ def terminate(pid): print('[bitmask] terminating bitmaskd...') os.kill(pidno, signal.SIGTERM) + def reset_authtoken(): prev_auth = os.path.join(get_path_prefix(), 'leap', 'authtoken') try: @@ -40,6 +43,7 @@ def reset_authtoken(): except OSError: pass + def cleanup(): print('[bitmask] cleaning up files') base = os.path.join(get_path_prefix(), 'leap') -- cgit v1.2.3