summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-07-16 09:39:17 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-07-16 09:39:17 -0300
commit432fcab9f838b0bfc81ed8d40d92b4b5d3854f24 (patch)
tree35f69a152468850ca0f5ad0e5b25baab131730d3
parent3fc88bbc70b3da4a2f8b371813bf87a42443f29c (diff)
Code style fixes.
-rw-r--r--src/leap/bitmask/__init__.py10
-rw-r--r--src/leap/bitmask/backend/components.py6
-rw-r--r--src/leap/bitmask/config/provider_spec.py2
-rw-r--r--src/leap/bitmask/crypto/srpauth.py2
-rwxr-xr-xsrc/leap/bitmask/crypto/tests/fake_provider.py4
-rw-r--r--src/leap/bitmask/gui/eip_status.py11
-rw-r--r--src/leap/bitmask/gui/statemachines.py11
-rw-r--r--src/leap/bitmask/platform_init/initializers.py3
-rw-r--r--src/leap/bitmask/provider/providerbootstrapper.py4
-rw-r--r--src/leap/bitmask/services/eip/conductor.py4
-rw-r--r--src/leap/bitmask/services/eip/tests/test_eipbootstrapper.py2
-rw-r--r--src/leap/bitmask/services/eip/vpnlauncher.py10
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py2
-rw-r--r--src/leap/bitmask/services/mail/plumber.py4
-rw-r--r--src/leap/bitmask/services/soledad/soledadbootstrapper.py2
-rw-r--r--src/leap/bitmask/services/tests/test_abstractbootstrapper.py2
-rw-r--r--src/leap/bitmask/util/leap_argparse.py26
-rw-r--r--src/leap/bitmask/util/polkit_agent.py6
-rw-r--r--src/leap/bitmask/util/privilege_policies.py4
19 files changed, 56 insertions, 59 deletions
diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py
index 03da1e2f..9ec5aae7 100644
--- a/src/leap/bitmask/__init__.py
+++ b/src/leap/bitmask/__init__.py
@@ -29,7 +29,7 @@ from leap.bitmask.util import first
# place, it can't be technically imported, but that doesn't matter
# because the import is never executed
if False:
- import _scrypt
+ import _scrypt # noqa - skip 'not used' warning
def _is_release_version(version):
@@ -66,16 +66,16 @@ try:
IS_RELEASE_VERSION = _is_release_version(__version__)
del get_versions
except ImportError:
- #running on a tree that has not run
- #the setup.py setver
+ # running on a tree that has not run
+ # the setup.py setver
pass
__appname__ = "unknown"
try:
from leap.bitmask._appname import __appname__
except ImportError:
- #running on a tree that has not run
- #the setup.py setver
+ # running on a tree that has not run
+ # the setup.py setver
pass
__short_version__ = first(re.findall('\d+\.\d+\.\d+', __version__))
diff --git a/src/leap/bitmask/backend/components.py b/src/leap/bitmask/backend/components.py
index 8fa8b285..b372db89 100644
--- a/src/leap/bitmask/backend/components.py
+++ b/src/leap/bitmask/backend/components.py
@@ -486,9 +486,9 @@ class EIP(object):
self._signaler.signal(self._signaler.eip_stopped)
return
else:
- #msg = "Firewall is not down yet, waiting... {0} of {1}"
- #msg = msg.format(retry, MAX_FW_WAIT_RETRIES)
- #logger.debug(msg)
+ # msg = "Firewall is not down yet, waiting... {0} of {1}"
+ # msg = msg.format(retry, MAX_FW_WAIT_RETRIES)
+ # logger.debug(msg)
time.sleep(FW_WAIT_STEP)
retry += 1
logger.warning("After waiting, firewall is not down... "
diff --git a/src/leap/bitmask/config/provider_spec.py b/src/leap/bitmask/config/provider_spec.py
index cf942c7b..a1d91b90 100644
--- a/src/leap/bitmask/config/provider_spec.py
+++ b/src/leap/bitmask/config/provider_spec.py
@@ -37,7 +37,7 @@ leap_provider_spec = {
'default': {u'en': u'Test Provider'}
},
'description': {
- #'type': LEAPTranslatable,
+ # 'type': LEAPTranslatable,
'type': dict,
'format': 'translatable',
'default': {u'en': u'Test provider'}
diff --git a/src/leap/bitmask/crypto/srpauth.py b/src/leap/bitmask/crypto/srpauth.py
index 67c686b0..d59b3c31 100644
--- a/src/leap/bitmask/crypto/srpauth.py
+++ b/src/leap/bitmask/crypto/srpauth.py
@@ -24,7 +24,7 @@ import requests
import srp
import json
-#this error is raised from requests
+# this error is raised from requests
from simplejson.decoder import JSONDecodeError
from functools import partial
from requests.adapters import HTTPAdapter
diff --git a/src/leap/bitmask/crypto/tests/fake_provider.py b/src/leap/bitmask/crypto/tests/fake_provider.py
index b8cdbb12..60a3ef0a 100755
--- a/src/leap/bitmask/crypto/tests/fake_provider.py
+++ b/src/leap/bitmask/crypto/tests/fake_provider.py
@@ -156,7 +156,7 @@ def getSession(self, sessionInterface=None):
put the right cookie name in place
"""
if not self.session:
- #cookiename = b"_".join([b'TWISTED_SESSION'] + self.sitepath)
+ # cookiename = b"_".join([b'TWISTED_SESSION'] + self.sitepath)
cookiename = b"_".join([b'_session_id'] + self.sitepath)
sessionCookie = self.getCookie(cookiename)
if sessionCookie:
@@ -321,7 +321,7 @@ class OpenSSLServerContextFactory(object):
Create an SSL context.
"""
ctx = SSL.Context(SSL.SSLv23_METHOD)
- #ctx = SSL.Context(SSL.TLSv1_METHOD)
+ # ctx = SSL.Context(SSL.TLSv1_METHOD)
ctx.use_certificate_file(where('leaptestscert.pem'))
ctx.use_privatekey_file(where('leaptestskey.pem'))
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py
index df9f3741..a707050a 100644
--- a/src/leap/bitmask/gui/eip_status.py
+++ b/src/leap/bitmask/gui/eip_status.py
@@ -24,7 +24,6 @@ from functools import partial
from PySide import QtCore, QtGui
-from leap.bitmask.config import flags
from leap.bitmask.services import get_service_display_name, EIP_SERVICE
from leap.bitmask.platform_init import IS_LINUX
from leap.bitmask.util.averages import RateMovingAverage
@@ -123,8 +122,8 @@ class EIPStatusWidget(QtGui.QWidget):
# XXX we cannot connect this signal now because
# it interferes with the proper notifications during restarts
# without available network.
- #signaler.eip_network_unreachable.connect(
- #self._on_eip_network_unreachable)
+ # signaler.eip_network_unreachable.connect(
+ # self._on_eip_network_unreachable)
def _make_status_clickable(self):
"""
@@ -326,7 +325,7 @@ class EIPStatusWidget(QtGui.QWidget):
Triggered after a successful login.
Enables the start button.
"""
- #logger.debug('Showing EIP start button')
+ # logger.debug('Showing EIP start button')
self.eip_button.show()
# Restore the eip action menu
@@ -545,7 +544,7 @@ class EIPStatusWidget(QtGui.QWidget):
elif vpn_state == "ALREADYRUNNING":
# Put the following calls in Qt's event queue, otherwise
# the UI won't update properly
- #self.send_disconnect_signal()
+ # self.send_disconnect_signal()
QtDelayedCall(
0, self.eipconnection.qtsigns.do_disconnect_signal.emit)
msg = self.tr("Unable to start VPN, it's already running.")
@@ -738,7 +737,7 @@ class EIPStatusWidget(QtGui.QWidget):
self.set_eip_status_icon("error")
def set_eipstatus_off(self, error=True):
- # XXX this should be handled by the state machine.
+ # XXX this should be handled by the state machine.
"""
Sets eip status to off
"""
diff --git a/src/leap/bitmask/gui/statemachines.py b/src/leap/bitmask/gui/statemachines.py
index 00a1387e..91f1f605 100644
--- a/src/leap/bitmask/gui/statemachines.py
+++ b/src/leap/bitmask/gui/statemachines.py
@@ -240,9 +240,9 @@ class CompositeMachine(QStateMachine):
c2.qtsigs.disconnected_signal.connect(self.off_ev2_slot)
# XXX why is this getting deletec in c++?
- #Traceback (most recent call last):
- #self.postEvent(self.events.on_ev2)
- #RuntimeError: Internal C++ object (ConnectedEvent2) already deleted.
+ # Traceback (most recent call last):
+ # self.postEvent(self.events.on_ev2)
+ # RuntimeError: Internal C++ object (ConnectedEvent2) already deleted.
# XXX trying the following workaround, since
# I cannot find why in the world this is getting deleted :(
# XXX refactor!
@@ -318,9 +318,8 @@ class ConnectionMachineBuilder(object):
components = self._conn.components
if components is None:
- # simple case: connection definition inherits directly from
- # the abstract connection.
-
+ # simple case: connection definition inherits directly from
+ # the abstract connection.
leap_assert_type(self._conn, connections.AbstractLEAPConnection)
return self._make_simple_machine(self._conn, **kwargs)
diff --git a/src/leap/bitmask/platform_init/initializers.py b/src/leap/bitmask/platform_init/initializers.py
index 2d800703..e4d6f9b3 100644
--- a/src/leap/bitmask/platform_init/initializers.py
+++ b/src/leap/bitmask/platform_init/initializers.py
@@ -21,7 +21,6 @@ import logging
import os
import platform
import stat
-import sys
import subprocess
import tempfile
@@ -103,7 +102,7 @@ def get_missing_helpers_dialog():
msg.setWindowTitle(msg.tr("Missing helper files"))
msg.setText(msg.tr(WE_NEED_POWERS))
# but maybe the user really deserve to know more
- #msg.setInformativeText(msg.tr(BECAUSE))
+ # msg.setInformativeText(msg.tr(BECAUSE))
msg.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
msg.addButton("No, don't ask again", QtGui.QMessageBox.RejectRole)
msg.setDefaultButton(QtGui.QMessageBox.Yes)
diff --git a/src/leap/bitmask/provider/providerbootstrapper.py b/src/leap/bitmask/provider/providerbootstrapper.py
index 5064f6a4..71edbb87 100644
--- a/src/leap/bitmask/provider/providerbootstrapper.py
+++ b/src/leap/bitmask/provider/providerbootstrapper.py
@@ -194,8 +194,8 @@ class ProviderBootstrapper(AbstractBootstrapper):
verify = self.verify
if mtime: # the provider.json exists
- # So, we're getting it from the api.* and checking against
- # the provider ca.
+ # So, we're getting it from the api.* and checking against
+ # the provider ca.
try:
provider_config = ProviderConfig()
provider_config.load(provider_json)
diff --git a/src/leap/bitmask/services/eip/conductor.py b/src/leap/bitmask/services/eip/conductor.py
index dfd27f3d..bb07809a 100644
--- a/src/leap/bitmask/services/eip/conductor.py
+++ b/src/leap/bitmask/services/eip/conductor.py
@@ -202,7 +202,7 @@ class EIPConductor(object):
# we bypass the on_eip_disconnected here
plug_restart_on_disconnected()
self.qtsigs.disconnected_signal.emit()
- #QtDelayedCall(0, self.qtsigs.disconnected_signal.emit)
+ # QtDelayedCall(0, self.qtsigs.disconnected_signal.emit)
# ...and reconnect the original signal again, after having used the
# diversion
QtDelayedCall(500, reconnect_disconnected_signal)
@@ -301,7 +301,7 @@ class EIPConductor(object):
# XXX FIXME --- check exitcode is != 0 really.
# bitmask-root is masking the exitcode, so we might need
# to fix it on that side.
- #if exitCode != 0 and not self.user_stopped_eip:
+ # if exitCode != 0 and not self.user_stopped_eip:
if not self.user_stopped_eip:
eip_status_label = self._eip_status.tr(
"{0} finished in an unexpected manner!")
diff --git a/src/leap/bitmask/services/eip/tests/test_eipbootstrapper.py b/src/leap/bitmask/services/eip/tests/test_eipbootstrapper.py
index 6640a860..1888f2c9 100644
--- a/src/leap/bitmask/services/eip/tests/test_eipbootstrapper.py
+++ b/src/leap/bitmask/services/eip/tests/test_eipbootstrapper.py
@@ -30,7 +30,7 @@ import time
try:
import unittest2 as unittest
except ImportError:
- import unittest
+ import unittest # noqa - skip 'unused import' warning
from nose.twistedtools import deferred, reactor
from twisted.internet import threads
diff --git a/src/leap/bitmask/services/eip/vpnlauncher.py b/src/leap/bitmask/services/eip/vpnlauncher.py
index e36fd76b..72e19413 100644
--- a/src/leap/bitmask/services/eip/vpnlauncher.py
+++ b/src/leap/bitmask/services/eip/vpnlauncher.py
@@ -169,11 +169,11 @@ class VPNLauncher(object):
leap_assert_type(providerconfig, ProviderConfig)
# XXX this still has to be changed on osx and windows accordingly
- #kwargs = {}
- #openvpn_possibilities = which(kls.OPENVPN_BIN, **kwargs)
- #if not openvpn_possibilities:
- #raise OpenVPNNotFoundException()
- #openvpn = first(openvpn_possibilities)
+ # kwargs = {}
+ # openvpn_possibilities = which(kls.OPENVPN_BIN, **kwargs)
+ # if not openvpn_possibilities:
+ # raise OpenVPNNotFoundException()
+ # openvpn = first(openvpn_possibilities)
# -----------------------------------------
openvpn_path = force_eval(kls.OPENVPN_BIN_PATH)
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index 1c11a337..d1a3fdaa 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -817,7 +817,7 @@ class VPNProcess(protocol.ProcessProtocol, VPNManager):
leap_assert_type(eipconfig, EIPConfig)
leap_assert_type(providerconfig, ProviderConfig)
- #leap_assert(not self.isRunning(), "Starting process more than once!")
+ # leap_assert(not self.isRunning(), "Starting process more than once!")
self._eipconfig = eipconfig
self._providerconfig = providerconfig
diff --git a/src/leap/bitmask/services/mail/plumber.py b/src/leap/bitmask/services/mail/plumber.py
index fa33afcd..1af65c5d 100644
--- a/src/leap/bitmask/services/mail/plumber.py
+++ b/src/leap/bitmask/services/mail/plumber.py
@@ -232,8 +232,8 @@ class MBOXPlumber(object):
with open(mail_filename) as f:
mail_string = f.read()
- #uid = self._mbox.getUIDNext()
- #print "saving with UID: %s" % uid
+ # uid = self._mbox.getUIDNext()
+ # print "saving with UID: %s" % uid
d = self._mbox.messages.add_msg(
mail_string, notify_on_disk=True)
return d
diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
index a5904dce..c4e43bfe 100644
--- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py
+++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
@@ -134,7 +134,7 @@ class SoledadBootstrapper(AbstractBootstrapper):
MAX_INIT_RETRIES = 10
MAX_SYNC_RETRIES = 10
WAIT_MAX_SECONDS = 600
- #WAIT_STEP_SECONDS = 1
+ # WAIT_STEP_SECONDS = 1
WAIT_STEP_SECONDS = 5
def __init__(self, signaler=None):
diff --git a/src/leap/bitmask/services/tests/test_abstractbootstrapper.py b/src/leap/bitmask/services/tests/test_abstractbootstrapper.py
index 3ac126ac..c3fda9e1 100644
--- a/src/leap/bitmask/services/tests/test_abstractbootstrapper.py
+++ b/src/leap/bitmask/services/tests/test_abstractbootstrapper.py
@@ -1,4 +1,4 @@
-## -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
# test_abstrctbootstrapper.py
# Copyright (C) 2013 LEAP
#
diff --git a/src/leap/bitmask/util/leap_argparse.py b/src/leap/bitmask/util/leap_argparse.py
index c7fed0a3..cbd6d8a5 100644
--- a/src/leap/bitmask/util/leap_argparse.py
+++ b/src/leap/bitmask/util/leap_argparse.py
@@ -107,19 +107,19 @@ def build_parser():
'against domains.')
# Not in use, we might want to reintroduce them.
- #parser.add_argument('-i', '--no-provider-checks',
- #action="store_true", default=False,
- #help="skips download of provider config files. gets "
- #"config from local files only. Will fail if cannot "
- #"find any")
- #parser.add_argument('-k', '--no-ca-verify',
- #action="store_true", default=False,
- #help="(insecure). Skips verification of the server "
- #"certificate used in TLS handshake.")
- #parser.add_argument('-c', '--config', metavar="CONFIG FILE", nargs='?',
- #action="store", dest="config_file",
- #type=argparse.FileType('r'),
- #help='optional config file')
+ # parser.add_argument('-i', '--no-provider-checks',
+ # action="store_true", default=False,
+ # help="skips download of provider config files. gets "
+ # "config from local files only. Will fail if cannot "
+ # "find any")
+ # parser.add_argument('-k', '--no-ca-verify',
+ # action="store_true", default=False,
+ # help="(insecure). Skips verification of the server "
+ # "certificate used in TLS handshake.")
+ # parser.add_argument('-c', '--config', metavar="CONFIG FILE", nargs='?',
+ # action="store", dest="config_file",
+ # type=argparse.FileType('r'),
+ # help='optional config file')
return parser
diff --git a/src/leap/bitmask/util/polkit_agent.py b/src/leap/bitmask/util/polkit_agent.py
index 6fda2f88..7764f571 100644
--- a/src/leap/bitmask/util/polkit_agent.py
+++ b/src/leap/bitmask/util/polkit_agent.py
@@ -39,9 +39,9 @@ def _launch_agent():
logger.error('Exception while running polkit authentication agent '
'%s' % (exc,))
# XXX fix KDE launch. See: #3755
- #try:
- #subprocess.call(KDE_PATH)
- #except Exception as exc:
+ # try:
+ # subprocess.call(KDE_PATH)
+ # except Exception as exc:
def launch():
diff --git a/src/leap/bitmask/util/privilege_policies.py b/src/leap/bitmask/util/privilege_policies.py
index adc3503f..f894d73b 100644
--- a/src/leap/bitmask/util/privilege_policies.py
+++ b/src/leap/bitmask/util/privilege_policies.py
@@ -87,8 +87,8 @@ class LinuxPolicyChecker(PolicyChecker):
else self.LINUX_POLKIT_FILE)
def is_missing_policy_permissions(self):
- # FIXME this name is quite confusing, it does not have anything to do with
- # file permissions.
+ # FIXME this name is quite confusing, it does not have anything to do
+ # with file permissions.
"""
Returns True if we could not find the appropriate policykit file
in place