path: root/apps
diff options
authorPetter Reinholdtsen <pere@hungry.com>2017-08-24 11:33:03 +0200
committerPetter Reinholdtsen <pere@hungry.com>2017-08-24 11:33:03 +0200
commit284282ef68aaf9519a022bb10a77fdb922d43b14 (patch)
tree33197ad13266bfa9cd29e16bb00b126ec468b6f8 /apps
parent6c4304da43346150d00b2bdc5a520746c2f45906 (diff)
Change channel_info to provide both __str__ and __repr__.
The __str__() function should be used for pretty-printing of the class, while __repr__ should be used to print a complete representation of the class. Earlier __repr__ would not include all the information in the class.
Diffstat (limited to 'apps')
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/grgsm_scanner b/apps/grgsm_scanner
index 397d51e..240f8fb 100755
--- a/apps/grgsm_scanner
+++ b/apps/grgsm_scanner
@@ -288,6 +288,12 @@ class channel_info(object):
return self.getKey().__cmp__(other.getKey())
def __repr__(self):
+ return "%s(%s, %s, %s, %s, %s, %s, %s, %s, %s)" % (
+ self.__class__, self.arfcn, self.freq, self.cid, self.lac,
+ self.mcc, self.mnc, self.ccch_conf, self.power,
+ self.neighbours, self.cell_arfcns)
+ def __str__(self):
return "ARFCN: %4u, Freq: %6.1fM, CID: %5u, LAC: %5u, MCC: %3u, MNC: %3u, Pwr: %3i" % (
self.arfcn, self.freq / 1e6, self.cid, self.lac, self.mcc, self.mnc, self.power)