From feb9d98bb0ed49ed5b9c2977700e9144b5707aa0 Mon Sep 17 00:00:00 2001 From: John Kacur Date: Tue, 4 Dec 2018 00:29:28 +0100 Subject: [PATCH 1/2] tuna: sysfs.py: Add method to compare class cpu In python3 you have to supply a method to compare class instances Without this you get this kind of error $ python3 sysfs.py Traceback (most recent call last): File "sysfs.py", line 97, in cpus = cpus() File "sysfs.py", line 57, in __init__ self.reload() File "sysfs.py", line 92, in reload self.sockets[socket].sort() TypeError: '<' not supported between instances of 'cpu' and 'cpu' Signed-off-by: John Kacur --- tuna/sysfs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tuna/sysfs.py b/tuna/sysfs.py index acc81d667753..8b8a988659ce 100755 --- a/tuna/sysfs.py +++ b/tuna/sysfs.py @@ -9,6 +9,9 @@ class cpu: self.dir = "%s/%s" % (basedir, name) self.reload() + def __lt__(self, other): + self.name < other.name + def readfile(self, name): try: f = open("%s/%s" % (self.dir, name)) -- 2.19.2