added a few more comments
This commit is contained in:
@ -289,6 +289,8 @@ def parameterize_python_script(script:list[str], parameters:dict[str,Any],
|
||||
return output_script
|
||||
|
||||
def print_debug(print_target, debug_level, msg, level)->None:
|
||||
"""Function to print a message to the debug target, if its level exceeds
|
||||
the given one."""
|
||||
if print_target is None:
|
||||
return
|
||||
else:
|
||||
@ -302,6 +304,8 @@ def print_debug(print_target, debug_level, msg, level)->None:
|
||||
|
||||
def replace_keywords(old_dict:dict[str,str], job_id:str, src_path:str,
|
||||
monitor_base:str)->dict[str,str]:
|
||||
"""Function to replace all MEOW magic words in a dictionary with dynamic
|
||||
values."""
|
||||
new_dict = {}
|
||||
|
||||
filename = os.path.basename(src_path)
|
||||
@ -330,6 +334,7 @@ def replace_keywords(old_dict:dict[str,str], job_id:str, src_path:str,
|
||||
|
||||
def create_event(event_type:str, path:str, rule:Any, extras:dict[Any,Any]={}
|
||||
)->dict[Any,Any]:
|
||||
"""Function to create a MEOW dictionary."""
|
||||
return {
|
||||
**extras,
|
||||
EVENT_PATH: path,
|
||||
@ -339,6 +344,7 @@ def create_event(event_type:str, path:str, rule:Any, extras:dict[Any,Any]={}
|
||||
|
||||
def create_watchdog_event(path:str, rule:Any, base:str, hash:str,
|
||||
extras:dict[Any,Any]={})->dict[Any,Any]:
|
||||
"""Function to create a MEOW event dictionary."""
|
||||
return create_event(
|
||||
EVENT_TYPE_WATCHDOG,
|
||||
path,
|
||||
@ -354,6 +360,7 @@ def create_watchdog_event(path:str, rule:Any, base:str, hash:str,
|
||||
|
||||
def create_job(job_type:str, event:dict[str,Any], extras:dict[Any,Any]={}
|
||||
)->dict[Any,Any]:
|
||||
"""Function to create a MEOW job dictionary."""
|
||||
job_dict = {
|
||||
#TODO compress event?
|
||||
JOB_ID: generate_id(prefix="job_"),
|
||||
@ -370,4 +377,6 @@ def create_job(job_type:str, event:dict[str,Any], extras:dict[Any,Any]={}
|
||||
return {**extras, **job_dict}
|
||||
|
||||
def lines_to_string(lines:list[str])->str:
|
||||
"""Function to convert a list of str lines, into one continuous string
|
||||
separated by newline characters"""
|
||||
return "\n".join(lines)
|
||||
|
Reference in New Issue
Block a user