(
rules: dict[str, list[dict[str, Any]]],
label: str,
)
| 1405 | |
| 1406 | |
| 1407 | def _rules_for_label( |
| 1408 | rules: dict[str, list[dict[str, Any]]], |
| 1409 | label: str, |
| 1410 | ) -> list[tuple[str, dict[str, Any]]]: |
| 1411 | normalized_label = _normalized_domain_label(label) |
| 1412 | matches: list[tuple[str, dict[str, Any]]] = [] |
| 1413 | for section in DOMAIN_SECTIONS: |
| 1414 | for rule in rules[section]: |
| 1415 | route_label = _normalized_domain_label(_domain_route_label(rule)) |
| 1416 | terms = [_normalized_domain_label(term) for term in _domain_match_terms(rule)] |
| 1417 | if normalized_label == route_label or normalized_label in terms: |
| 1418 | matches.append((section, rule)) |
| 1419 | return matches |
| 1420 | |
| 1421 | |
| 1422 | def _score_domain_for_inference(rule: dict[str, Any], text: str, *, fallback: bool) -> int: |
no test coverage detected