From 003993efe12afc76569baf90e02858f6301833bf Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sat, 2 Jan 2016 16:51:37 +0100 Subject: [PATCH] CallDistanceTransceiver.py: make log_symbol() a standalone function There is no need for it to be a method, it does not use "self". --- src/savemysugar/CallDistanceTransceiver.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/savemysugar/CallDistanceTransceiver.py b/src/savemysugar/CallDistanceTransceiver.py index aaadafd..d05236b 100755 --- a/src/savemysugar/CallDistanceTransceiver.py +++ b/src/savemysugar/CallDistanceTransceiver.py @@ -161,6 +161,11 @@ class MorseDistanceModulator(object): return distances +def log_symbol(distance, symbol, extra_info=""): + logging.info("distance: %.2f Received \"%s\"%s", distance, symbol, + extra_info) + + class CallDistanceTransceiver(object): """Transmit Morse messages using the distance between calls. @@ -285,17 +290,13 @@ class CallDistanceTransceiver(object): self.end_of_message = False - def log_symbol(self, distance, symbol, extra_info=""): - logging.info("distance: %.2f Received \"%s\"%s", distance, symbol, - extra_info) - def receive_character(self): current_ring_time = time.time() if self.previous_ring_time == -1: self.previous_ring_time = current_ring_time self.previous_call_time = current_ring_time - self.log_symbol(0, "", "(The very first ring)") + log_symbol(0, "", "(The very first ring)") return ring_distance = current_ring_time - self.previous_ring_time @@ -324,7 +325,7 @@ class CallDistanceTransceiver(object): character = self.translator.signal_to_character(signal) extra_info = " got \"%s\"" % character - self.log_symbol(call_distance, symbol, extra_info) + log_symbol(call_distance, symbol, extra_info) if symbol != "EOM": # Add spaces around the wordspace symbol to make it easier to split -- 2.1.4