small updates
This commit is contained in:
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
from argparse import Namespace
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
class ArgumentsParser:
|
class ArgumentsParser:
|
||||||
@cached_property
|
@cached_property
|
||||||
def parser(self):
|
def parser(self) -> Namespace:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog=__file__,
|
prog=__file__,
|
||||||
description='Trigger based CPU governor auto adjust program.',
|
description='Trigger based CPU governor auto adjust program.',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
@@ -24,7 +25,14 @@ class Config:
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def loglevel(self) -> str:
|
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
|
@cached_property
|
||||||
def testmode(self) -> bool:
|
def testmode(self) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user