updated event dict to always include path, should be more future proof

This commit is contained in:
PatchOfScotland
2023-01-20 11:03:16 +01:00
parent 226bf7a7f9
commit 75de8147be
5 changed files with 24 additions and 23 deletions

View File

@ -3,7 +3,8 @@ from inspect import signature
from os.path import sep, exists, isfile, isdir, dirname
from typing import Any, _SpecialForm, Union, Tuple, get_origin, get_args
from core.correctness.vars import VALID_PATH_CHARS, get_not_imp_msg, EVENT_TYPE
from core.correctness.vars import VALID_PATH_CHARS, get_not_imp_msg, \
EVENT_TYPE, EVENT_PATH
def check_type(variable:Any, expected_type:type, alt_types:list[type]=[],
or_none:bool=False)->None:
@ -183,3 +184,5 @@ def valid_event(event)->None:
check_type(event, dict)
if not EVENT_TYPE in event.keys():
raise KeyError(f"Events require key '{EVENT_TYPE}'")
if not EVENT_PATH in event.keys():
raise KeyError(f"Events require key '{EVENT_PATH}'")