[chirp_devel] [PATCH 20/22] Fix style issues in reporting.py (#2355)

Zach Welch
Sat Feb 28 22:54:57 PST 2015


# HG changeset patch
# User Zach Welch <zach at mandolincreekfarm.com>
# Fake Node ID c550f660cafcd538c3e64a4e8fc6300ed1c67e69

Fix style issues in reporting.py (#2355)


diff --git a/chirpui/reporting.py b/chirpui/reporting.py
index efe18c1..0f524c5 100644
--- a/chirpui/reporting.py
+++ b/chirpui/reporting.py
@@ -34,7 +34,7 @@ from chirp import CHIRP_VERSION, platform
 
 REPORT_URL = "http://chirp.danplanet.com/report/report.php?do_report"
 ENABLED = True
-THREAD_SEM = threading.Semaphore(10) # Maximum number of outstanding threads
+THREAD_SEM = threading.Semaphore(10)  # Maximum number of outstanding threads
 LAST = 0
 LAST_TYPE = None
 
@@ -47,6 +47,7 @@ try:
 except:
     ENABLED = False
 
+
 def should_report():
     if not ENABLED:
         LOG.debug("Not reporting due to recent failure")
@@ -59,11 +60,13 @@ def should_report():
 
     return True
 
+
 def _report_model_usage(model, direction, success):
     global ENABLED
-    if direction not in ["live", "download", "upload", "import", "export", "importsrc"]:
+    if direction not in ["live", "download", "upload",
+                         "import", "export", "importsrc"]:
         print "Invalid direction `%s'" % direction
-        return True # This is a bug, but not fatal
+        return True  # This is a bug, but not fatal
 
     model = "%s_%s" % (model.VENDOR, model.MODEL)
     data = "%s,%s,%s" % (model, direction, success)
@@ -79,6 +82,7 @@ def _report_model_usage(model, direction, success):
     # If the server returns zero, it wants us to shut up
     return id != 0
 
+
 def _report_exception(stack):
     global ENABLED
 
@@ -93,6 +97,7 @@ def _report_exception(stack):
     # If the server returns zero, it wants us to shut up
     return id != 0
 
+
 def _report_misc_error(module, data):
     global ENABLED
 
@@ -106,6 +111,7 @@ def _report_misc_error(module, data):
     # If the server returns zero, it wants us to shut up
     return id != 0
 
+
 def _check_for_updates(callback):
     LOG.debug("Checking for updates")
     proxy = xmlrpclib.ServerProxy(REPORT_URL)
@@ -116,6 +122,7 @@ def _check_for_updates(callback):
     callback(ver)
     return True
 
+
 class ReportThread(threading.Thread):
     def __init__(self, func, *args):
         threading.Thread.__init__(self)
@@ -128,7 +135,7 @@ class ReportThread(threading.Thread):
         except Exception, e:
             LOG.debug("Failed to report: %s" % e)
             return False
-        
+
     def run(self):
         start = time.time()
         result = self._run()
@@ -137,12 +144,13 @@ class ReportThread(threading.Thread):
             ENABLED = False
         elif (time.time() - start) > 15:
             # Reporting took too long
-            LOG.debug("Time to report was %.2f sec -- Disabling" % \
+            LOG.debug("Time to report was %.2f sec -- Disabling" %
                       (time.time()-start))
             ENABLED = False
 
         THREAD_SEM.release()
 
+
 def dispatch_thread(func, *args):
     global LAST
     global LAST_TYPE
@@ -169,15 +177,19 @@ def dispatch_thread(func, *args):
     t = ReportThread(func, *args)
     t.start()
 
+
 def report_model_usage(model, direction, success):
     dispatch_thread(_report_model_usage, model, direction, success)
 
+
 def report_exception(stack):
     dispatch_thread(_report_exception, stack)
 
+
 def report_misc_error(module, data):
     dispatch_thread(_report_misc_error, module, data)
 
+
 # Calls callback with the latest version
 def check_for_updates(callback):
     dispatch_thread(_check_for_updates, callback)
diff --git a/tools/cpep8.blacklist b/tools/cpep8.blacklist
index 8421d48..54f568f 100644
--- a/tools/cpep8.blacklist
+++ b/tools/cpep8.blacklist
@@ -71,6 +71,5 @@
 ./chirp/wouxun_common.py
 ./chirp/yaesu_clone.py
 ./chirpui/fips.py
-./chirpui/reporting.py
 ./tools/bitdiff.py
 ./tools/img2thd72.py




More information about the chirp_devel mailing list