ignore lines not fitting the regex when parsing lines from .cnt file

This commit is contained in:
Maximilian Keßler 2021-09-17 14:12:46 +02:00
parent 3407f03091
commit fc9978b484

View file

@ -11,7 +11,10 @@ def parse_counters(filepath: Path, break_point: Dict) -> Dict:
counters: Dict = {}
with open(filepath) as f:
for line in f:
counter, _, num = re.search(r"(.*): (\d*\.)*?(\d*)", line).groups()
match = re.search(r"(.*): (\d*\.)*?(\d+)", line)
if not match:
continue
counter, _, num = match.groups()
num = int(num)
if counter in break_point and num >= break_point[counter]:
return counters