diff options
author | John Kacur <jkacur@redhat.com> | 2018-12-04 00:29:28 +0100 |
---|---|---|
committer | John Kacur <jkacur@redhat.com> | 2019-01-29 20:51:54 +0100 |
commit | ce1b166eb555467bb9f4c914b073aaae67f0760a (patch) | |
tree | 72f7c6839832d1b04367d86f1c39275b0ac976b7 | |
parent | 306487213ee38f7d69c44c9b3d58d4feab853139 (diff) | |
download | tuna-ce1b166eb555467bb9f4c914b073aaae67f0760a.tar.gz |
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 <module>
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 <jkacur@redhat.com>
-rwxr-xr-x | tuna/sysfs.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tuna/sysfs.py b/tuna/sysfs.py index acc81d6..8b8a988 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)) |