MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / _all_schema_attrs

Function _all_schema_attrs

Scripts/codegen/_codegen_checks.py:323–344  ·  view source on GitHub ↗

Union of every schema attr observed anywhere in the snapshot.

(schema: Dict[str, Any], rules: Dict[str, Any])

Source from the content-addressed store, hash-verified

321
322
323def _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
347def _check_orphan_rule_entries(

Callers 1

Calls 1

_walkFunction · 0.70

Tested by

no test coverage detected