Skip to content

Commit acef329

Browse files
committed
Add guard when regex does not have all group definitions
1 parent aca5534 commit acef329

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/cheese3d/cheese3d/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import hydra
23
from omegaconf import MISSING, OmegaConf, DictConfig
34
from dataclasses import dataclass, field
@@ -315,6 +316,9 @@ def build_regex(regex):
315316
for key, rstr in regex.items():
316317
full_regex = full_regex.replace("{{" + key + "}}", # type: ignore
317318
fr"(?P<{key}>{rstr})")
319+
missing_groups = re.match("({{.*}})", full_regex)
320+
if missing_groups:
321+
raise RuntimeError(f"Regex is missing definitions for groups: {missing_groups.groups}")
318322

319323
return full_regex
320324
else:

0 commit comments

Comments
 (0)