improved code by mypy advice

This commit is contained in:
2024-12-15 18:05:44 +01:00
parent 8cb98e102f
commit 4522c0dd9e
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -1,6 +1,6 @@
from app_class import AppClass
from config import Config
from cpufreq import cpuFreq, cpufreq
from cpufreq import cpuFreq, cpufreq # type: ignore
from functools import cached_property
from mapping import governor_priority_mapping
from exceptions import GovernorNotFound
@@ -46,6 +46,9 @@ class Governor(AppClass):
self.log.warning("application is running in testmode, cpu governor not set")
return None
if self._cpufreq is None:
return None
if governor_name not in self._cpufreq.available_governors:
self.log.error("governor %s not supported by cpu", governor_name)
return None