(self, layout: Dict[str, List[str]])
| 723 | """Routes each NodeInfo to an output module path using layout rules.""" |
| 724 | |
| 725 | def __init__(self, layout: Dict[str, List[str]]) -> None: |
| 726 | self.layout = layout |
| 727 | self._fallback_classifier = AutoLayoutGenerator() |
| 728 | # Pre-compile: list of (module_path, list_of_matchers) |
| 729 | self._rules: List[Tuple[str, List[Tuple[str, object]]]] = [] |
| 730 | for mod_path, patterns in layout.items(): |
| 731 | matchers: List[Tuple[str, object]] = [] |
| 732 | for pat in patterns: |
| 733 | if pat.startswith("~"): |
| 734 | matchers.append(("regex", re.compile(pat[1:]))) |
| 735 | else: |
| 736 | matchers.append(("exact", pat)) |
| 737 | self._rules.append((mod_path, matchers)) |
| 738 | |
| 739 | def route(self, node: NodeInfo) -> str: |
| 740 | """Return the target module path for a node.""" |
nothing calls this directly
no test coverage detected