more fixes #5

Merged
muellerr merged 1 commits from event-parser-fixes into main 2026-02-20 16:38:28 +01:00
+11 -2
View File
@@ -1,4 +1,5 @@
import re
import sys
import logging
from pathlib import Path
from typing import List, Optional, Dict
@@ -70,8 +71,9 @@ class EventParser(FileParser):
self.set_moving_window_mode(moving_window_size)
self.interfaces = interface_list
self.count = 0
self.subsystem_id = 0
self.current_id = 0
self.subsystem_id = None
self.current_id = None
self.current_file = None
self.mib_table: EventDictT = dict()
self.obsw_root_path: Optional[Path] = None
self.last_lines = ["", "", ""]
@@ -89,6 +91,10 @@ class EventParser(FileParser):
*args,
**kwargs,
):
if file_name != self.current_file:
self.current_file = file_name
self.subsystem_id = None
self.current_id = None
subsystem_id_assignment_match = re.search(
rf"{SUBSYSTEM_ID_NAMESPACE}::([A-Z_0-9]*)",
moving_window[self.moving_window_center_idx],
@@ -155,6 +161,9 @@ class EventParser(FileParser):
elif meta.type == MetaType.DESC:
description = meta.value
if event_full_match:
if self.subsystem_id is None:
_LOGGER.error("Subsystem ID not set, cannot parse event")
sys.exit(1)
name = event_match.group(EVENT_NAME_IDX)
if macro_api_match:
full_id = (self.subsystem_id * 100) + self.return_number_from_string(