CallDistanceTransceiver.py: don't put the general case in an else
authorAntonio Ospite <ao2@ao2.it>
Thu, 17 Dec 2015 11:56:32 +0000 (12:56 +0100)
committerAntonio Ospite <ao2@ao2.it>
Thu, 17 Dec 2015 11:56:32 +0000 (12:56 +0100)
Since the code returns when the particular case of the very first call
occurs, there is no need to put the general case in the else.

src/savemysugar/CallDistanceTransceiver.py

index fd60a1f..c251673 100755 (executable)
@@ -143,10 +143,10 @@ class CallDistanceTransceiver(object):
             self.previous_call_time = current_ring_time
             self.log_symbol(0, "", "(The very first ring)")
             return
-        else:
-            ring_distance = current_ring_time - self.previous_ring_time
-            logging.debug("RINGs distance: %.2f", ring_distance)
-            self.previous_ring_time = current_ring_time
+
+        ring_distance = current_ring_time - self.previous_ring_time
+        logging.debug("RINGs distance: %.2f", ring_distance)
+        self.previous_ring_time = current_ring_time
 
         # Ignore multiple rings in the same call
         if abs(ring_distance - self.rings_distance) < self.ring_uncertainty: