Skip to content

Commit

Permalink
Template Parsing Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-sincek committed Sep 23, 2024
1 parent 831a1aa commit 1ce8896
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/chad_extractor/chad_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get_results(self):
# 1st round: extraction - pop all entries with no "extract" RegEx
# 2nd round: validation - pop all entries with no "validate" RegEx
def parse_template(self):
for key in self.__template:
for key in list(self.__template.keys()):
if self.__active["regex"] not in self.__template[key]:
self.__template.pop(key)
return bool(self.__template)
Expand Down Expand Up @@ -894,6 +894,9 @@ def __validate_template_keys(self, value):
elif len(pvalue) < 1:
self.__error("Template: All primary keys must have at least one sub-key")
break
elif KEYS["extract"]["regex"] not in pvalue:
self.__error(f"Template[{pkey}]: Must contain '{KEYS['extract']['regex']}' sub-key")
break
error = False
for skey, svalue in pvalue.items():
if skey in [KEYS["extract"]["regex"], KEYS["validate"]["regex"]]:
Expand Down

0 comments on commit 1ce8896

Please sign in to comment.