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

Function _hand_enums_from_snapshot

Scripts/codegen/_codegen_checks.py:69–85  ·  view source on GitHub ↗

Pull URLab's hand-rolled ``EMj*`` enums out of the merged introspect snapshot when present. Snapshot path produces real ENUM_CONSTANT_DECL members from libclang. Regex fallback covers the local-dev case where the snapshot wasn't regenerated.

(mjspec: Optional[Dict[str, Any]])

Source from the content-addressed store, hash-verified

67
68
69def _hand_enums_from_snapshot(mjspec: Optional[Dict[str, Any]]) -> Dict[str, List[str]]:
70 """Pull URLab's hand-rolled ``EMj*`` enums out of the merged
71 introspect snapshot when present. Snapshot path produces real
72 ENUM_CONSTANT_DECL members from libclang. Regex fallback covers
73 the local-dev case where the snapshot wasn't regenerated."""
74 if not mjspec:
75 return {}
76 introspect = mjspec.get("introspect", {}) or {}
77 hand_enums = introspect.get("hand_enums") or {}
78 out: Dict[str, List[str]] = {}
79 for name, entry in hand_enums.items():
80 if not isinstance(entry, dict):
81 continue
82 members = entry.get("members", {})
83 if isinstance(members, dict):
84 out[name] = list(members.keys())
85 return out
86
87
88# ---------------------------------------------------------------------------

Callers 1

_check_hand_enum_driftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected