From e962e1488b9950c3f6620675620f840663bfdac6 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 14 Feb 2017 10:12:41 +0100 Subject: [PATCH] Deleted linuxcpureader.py --- status/linuxcpureader.py | 48 ---------------------------------------- status/load.py | 1 + 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 status/linuxcpureader.py diff --git a/status/linuxcpureader.py b/status/linuxcpureader.py deleted file mode 100644 index 72943c4..0000000 --- a/status/linuxcpureader.py +++ /dev/null @@ -1,48 +0,0 @@ - -from functools import partial -from os import path - - -class LinuxCpuTemperatureReader(): - files = [ - '/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone/temp', - '/sys/bus/acpi/devices/LNXTHERM:00/thermal_zone/temp', - '/proc/acpi/thermal_zone/THM0/temperature', - '/proc/acpi/thermal_zone/THRM/temperature', - '/proc/acpi/thermal_zone/THR1/temperature' - ] - - @classmethod - def get_reader(cls): - readers = { - cls.files[0]: cls.reader1, - cls.files[1]: cls.reader1, - cls.files[2]: cls.reader2, - cls.files[3]: cls.reader2, - cls.files[4]: cls.reader2 - } - for file in cls.files: - if path.exists(file): - reader = readers.get(file) - if reader: - print(reader(file)) - return reader(file) - - @classmethod - def reader1(cls, file): - def reader(file): - temperature = open(file).read().strip() - temperature = int(temperature) // 1000 - return temperature - return partial(reader, file) - - @classmethod - def reader2(cls, file): - def reader(file): - temperature = open(file).read().strip() - temperature = temperature.lstrip('temperature :').rstrip(' C') - return int(temperature) - return partial(reader, file) - - -__all__ = ['LinuxCpuTemperatureReader'] diff --git a/status/load.py b/status/load.py index ff780fe..06ae191 100755 --- a/status/load.py +++ b/status/load.py @@ -9,6 +9,7 @@ def load(): arpOutput = check_output("cat /proc/loadavg", shell=True) arpOutput = arpOutput.decode() return findall('[0-9]{1,2}[\.][0-9]{2}', arpOutput) + elif sysName == 'Darwin': arpOutput = check_output("uptime", shell=True) arpOutput = arpOutput.decode()