added config to Trigger
This commit is contained in:
@@ -3,12 +3,16 @@ from pathlib import Path
|
||||
from lxml import etree
|
||||
from functools import cached_property
|
||||
from arguments import ArgumentsParser
|
||||
from typing import NamedTuple
|
||||
from typing import NamedTuple, Optional
|
||||
|
||||
|
||||
class TriggerTuple(NamedTuple):
|
||||
name: str
|
||||
interval_in_seconds: int
|
||||
|
||||
|
||||
class MissingConfig(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Config:
|
||||
@@ -57,3 +61,7 @@ class Config:
|
||||
)
|
||||
|
||||
return ret_val
|
||||
|
||||
def get_trigger_by_name(self, name: str) -> Optional[TriggerTuple]:
|
||||
_all_trigger_tuples = self.triggertuples.copy()
|
||||
return next((t for t in _all_trigger_tuples if t.name == name), None)
|
||||
|
||||
Reference in New Issue
Block a user