small updates

This commit is contained in:
2024-12-06 16:41:59 +01:00
parent 9623cfcf2c
commit 43a52391d5
2 changed files with 11 additions and 2 deletions
+2 -1
View File
@@ -1,9 +1,10 @@
import argparse
from argparse import Namespace
from functools import cached_property
class ArgumentsParser:
@cached_property
def parser(self):
def parser(self) -> Namespace:
parser = argparse.ArgumentParser(
prog=__file__,
description='Trigger based CPU governor auto adjust program.',
+9 -1
View File
@@ -1,3 +1,4 @@
import logging
from pathlib import Path
from lxml import etree
from functools import cached_property
@@ -24,7 +25,14 @@ class Config:
@cached_property
def loglevel(self) -> str:
return self.app_root.xpath('logLevel').pop().text
value = self.app_root.xpath('logLevel').pop().text.upper()
_loglevels = ", ".join(logging.getLevelNamesMapping().keys())
if value not in logging.getLevelNamesMapping().keys():
raise ValueError(
"logLevel can only contain one of these values: "
f"{_loglevels}"
)
return value
@cached_property
def testmode(self) -> bool: