[Pkg-privacy-commits] [torbrowser-launcher] 193/476: PEP8 codestyle housekeeping

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.

commit 6ae5dc535c8cae9d8abd1d125d137953d7c9168c
Author: Lazlo Westerhof <github at lazlo.me>
Date:   Fri Mar 7 11:00:52 2014 +0100

    PEP8 codestyle housekeeping
---
 torbrowser-launcher | 62 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 36 insertions(+), 26 deletions(-)

diff --git a/torbrowser-launcher b/torbrowser-launcher
index f3513c5..89f58e3 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -54,13 +54,19 @@ from txsocksx.client import SOCKS5ClientEndpoint
 
 import OpenSSL
 
+
 class TryStableException(Exception):
     pass
+
+
 class TryDefaultMirrorException(Exception):
     pass
+
+
 class DownloadErrorException(Exception):
     pass
 
+
 class VerifyTorProjectCert(ClientContextFactory):
 
     def __init__(self, torproject_pem):
@@ -75,6 +81,7 @@ class VerifyTorProjectCert(ClientContextFactory):
     def verifyHostname(self, connection, cert, errno, depth, preverifyOK):
         return cert.digest('sha256') == self.torproject_ca.digest('sha256')
 
+
 class TBLCommon:
 
     def __init__(self, tbl_version):
@@ -113,7 +120,7 @@ class TBLCommon:
         # figure out the language
         available_languages = ['en-US', 'ar', 'de', 'es-ES', 'fa', 'fr', 'it', 'ko', 'nl', 'pl', 'pt-PT', 'ru', 'vi', 'zh-CN']
         default_locale = locale.getdefaultlocale()[0]
-        if default_locale == None:
+        if default_locale is None:
             self.language = 'en-US'
         else:
             self.language = default_locale.replace('_', '-')
@@ -128,11 +135,11 @@ class TBLCommon:
                 self.language = 'en-US'
 
     # build all relevant paths
-    def build_paths(self, tbb_version = None):
+    def build_paths(self, tbb_version=None):
         homedir = os.getenv('HOME')
         if not homedir:
             homedir = '/tmp/.torbrowser-'+os.getenv('USER')
-            if os.path.exists(homedir) == False:
+            if not os.path.exists(homedir):
                 try:
                     os.mkdir(homedir, 0700)
                 except:
@@ -202,7 +209,7 @@ class TBLCommon:
     # create a directory
     def mkdir(self, path):
         try:
-            if os.path.exists(path) == False:
+            if not os.path.exists(path):
                 os.makedirs(path, 0700)
                 return True
         except:
@@ -295,7 +302,7 @@ class TBLCommon:
         return True
 
     # get the process id of a program
-    def get_pid(self, bin_path, python = False):
+    def get_pid(self, bin_path, python=False):
         pid = None
 
         for p in psutil.process_iter():
@@ -334,6 +341,7 @@ class TBLCommon:
         if win_id:
             subprocess.call(['wmctrl', '-i', '-a', win_id])
 
+
 class TBLSettings:
     def __init__(self, common):
         print _('Starting settings dialog')
@@ -384,7 +392,7 @@ class TBLSettings:
         for option in self.preferred_options:
             self.preferred.append_text(option)
         if self.common.settings['preferred'] in self.common.available_versions:
-            self.preferred.set_active( self.preferred_options.index(self.common.available_versions[self.common.settings['preferred']]) )
+            self.preferred.set_active(self.preferred_options.index(self.common.available_versions[self.common.settings['preferred']]))
         else:
             self.preferred.set_active(0)
         self.preferred_box.pack_start(self.preferred, True, True, 0)
@@ -451,7 +459,7 @@ class TBLSettings:
         for mirror in self.common.mirrors:
             self.mirrors.append_text(mirror)
         if self.common.settings['mirror'] in self.common.mirrors:
-            self.mirrors.set_active( self.common.mirrors.index(self.common.settings['mirror']) )
+            self.mirrors.set_active(self.common.mirrors.index(self.common.settings['mirror']))
         else:
             self.preferred.set_active(0)
         self.mirrors_box.pack_start(self.mirrors, True, True, 0)
@@ -532,6 +540,7 @@ class TBLSettings:
     # exit
     def delete_event(self, widget, event, data=None):
         return False
+
     def destroy(self, widget, data=None):
         gtk.main_quit()
 
@@ -571,8 +580,8 @@ class TBLLauncher:
             # check for update
             print 'Checking for update'
             self.set_gui('task', _("Checking for Tor Browser update."),
-                ['download_update_check',
-                 'attempt_update'])
+                         ['download_update_check',
+                          'attempt_update'])
         else:
             # no need to check for update
             print _('Checked for update within 24 hours, skipping')
@@ -616,12 +625,12 @@ class TBLLauncher:
                 print _('TBB is out of date, attempting to upgrade to {0}'.format(latest_version))
                 # there is a tbb upgrade available
                 self.set_gui('task', _("Your Tor Browser is out of date."),
-                    ['download_sha256',
-                     'download_sha256_sig',
-                     'download_tarball',
-                     'verify',
-                     'extract',
-                     'run'])
+                             ['download_sha256',
+                              'download_sha256_sig',
+                              'download_tarball',
+                              'verify',
+                              'extract',
+                              'run'])
             else:
                 # for some reason the installed tbb is newer than the current version?
                 self.set_gui('error', _("Something is wrong. The version of Tor Browser Bundle you have installed is newer than the current version?"), [])
@@ -630,12 +639,12 @@ class TBLLauncher:
         else:
             print _('TBB is not installed, attempting to install {0}'.format(latest_version))
             self.set_gui('task', _("Downloading and installing Tor Browser."),
-                ['download_sha256',
-                 'download_sha256_sig',
-                 'download_tarball',
-                 'verify',
-                 'extract',
-                 'run'])
+                         ['download_sha256',
+                          'download_sha256_sig',
+                          'download_tarball',
+                          'verify',
+                          'extract',
+                          'run'])
 
     # there are different GUIs that might appear, this sets which one we want
     def set_gui(self, gui, message, tasks, autostart=True):
@@ -666,7 +675,7 @@ class TBLLauncher:
 
         if 'error' in self.gui:
             # labels
-            self.label = gtk.Label( self.gui_message )
+            self.label = gtk.Label(self.gui_message)
             self.label.set_line_wrap(True)
             self.box.pack_start(self.label, True, True, 0)
             self.label.show()
@@ -703,7 +712,7 @@ class TBLLauncher:
 
         elif self.gui == 'task':
             # label
-            self.label = gtk.Label( self.gui_message )
+            self.label = gtk.Label(self.gui_message)
             self.label.set_line_wrap(True)
             self.box.pack_start(self.label, True, True, 0)
             self.label.show()
@@ -728,7 +737,7 @@ class TBLLauncher:
             self.start_button.connect("clicked", self.start, None)
             self.button_box.add(self.start_button)
             if not self.gui_autostart:
-              self.start_button.show()
+                self.start_button.show()
 
             # exit button
             exit_image = gtk.Image()
@@ -1066,7 +1075,7 @@ class TBLLauncher:
 
         self.run_task()
 
-    def run(self, run_next_task = True):
+    def run(self, run_next_task=True):
         subprocess.Popen([self.common.paths['tbb'][self.common.settings['preferred']]['start']])
 
         # play modem sound?
@@ -1082,7 +1091,7 @@ class TBLLauncher:
 
     # make the progress bar pulse until process p (a Popen object) finishes
     def pulse_until_process_exits(self, p):
-        while p.poll() == None:
+        while p.poll() is None:
             time.sleep(0.01)
             self.progressbar.pulse()
             self.refresh_gtk()
@@ -1102,6 +1111,7 @@ class TBLLauncher:
     # exit
     def delete_event(self, widget, event, data=None):
         return False
+
     def destroy(self, widget, data=None):
         if hasattr(self, 'file_download'):
             self.file_download.close()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list