Union of every schema attr observed anywhere in the snapshot.
(schema: Dict[str, Any], rules: Dict[str, Any])
| 321 | |
| 322 | |
| 323 | def _all_schema_attrs(schema: Dict[str, Any], rules: Dict[str, Any]) -> set: |
| 324 | """Union of every schema attr observed anywhere in the snapshot.""" |
| 325 | out: set = set() |
| 326 | |
| 327 | def _walk(node: Any) -> None: |
| 328 | if isinstance(node, list): |
| 329 | for item in node: |
| 330 | if isinstance(item, str) and _ATTR_NAME_RE.match(item): |
| 331 | out.add(item) |
| 332 | else: |
| 333 | _walk(item) |
| 334 | elif isinstance(node, dict): |
| 335 | for k, v in node.items(): |
| 336 | if k in ("obj_attr", "ref_attr") and isinstance(v, str): |
| 337 | if _ATTR_NAME_RE.match(v): |
| 338 | out.add(v) |
| 339 | _walk(v) |
| 340 | |
| 341 | _walk(schema) |
| 342 | for cat_rules in rules.get("categories", {}).values(): |
| 343 | out |= set(cat_rules.get("schema_common_extra_attrs", [])) |
| 344 | return out |
| 345 | |
| 346 | |
| 347 | def _check_orphan_rule_entries( |
no test coverage detected