(
raw: dict[str, list[dict[str, Any]]],
)
| 1339 | |
| 1340 | |
| 1341 | def _normalize_domain_rules( |
| 1342 | raw: dict[str, list[dict[str, Any]]], |
| 1343 | ) -> dict[str, list[dict[str, Any]]] | None: |
| 1344 | normalized: dict[str, list[dict[str, Any]]] = {section: [] for section in DOMAIN_SECTIONS} |
| 1345 | for section in DOMAIN_SECTIONS: |
| 1346 | items = raw.get(section) |
| 1347 | if not isinstance(items, list): |
| 1348 | return None |
| 1349 | for item in items: |
| 1350 | if not isinstance(item, dict): |
| 1351 | return None |
| 1352 | rule = _normalize_domain_rule(item) |
| 1353 | if rule is None: |
| 1354 | return None |
| 1355 | normalized[section].append(rule) |
| 1356 | if not normalized["domains"] and not normalized["fallback_domains"]: |
| 1357 | return None |
| 1358 | return normalized |
| 1359 | |
| 1360 | |
| 1361 | def load_domain_rules() -> dict[str, list[dict[str, Any]]]: |
no test coverage detected