MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / _normalize_domain_rules

Function _normalize_domain_rules

scripts/common.py:1341–1358  ·  view source on GitHub ↗
(
    raw: dict[str, list[dict[str, Any]]],
)

Source from the content-addressed store, hash-verified

1339
1340
1341def _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
1361def load_domain_rules() -> dict[str, list[dict[str, Any]]]:

Callers 1

load_domain_rulesFunction · 0.85

Calls 1

_normalize_domain_ruleFunction · 0.85

Tested by

no test coverage detected