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

Function main

Scripts/diff_schema.py:144–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142
143
144def main():
145 if len(sys.argv) < 3:
146 print("Usage: python diff_schema.py <old_snapshot.json> <new_snapshot.json>")
147 return
148
149 old_path = Path(sys.argv[1])
150 new_path = Path(sys.argv[2])
151
152 with open(old_path) as f:
153 old = json.load(f)
154 with open(new_path) as f:
155 new = json.load(f)
156
157 print(f"Old: {old.get('_meta', {}).get('mujoco_version', '?')} ({old_path.name})")
158 print(f"New: {new.get('_meta', {}).get('mujoco_version', '?')} ({new_path.name})")
159
160 diff = diff_schemas(old, new)
161 print_diff(diff)
162
163 # Summary
164 total_added = len(diff["added_elements"]) + sum(len(c["added"]) for c in diff["attribute_changes"])
165 total_removed = len(diff["removed_elements"]) + sum(len(c["removed"]) for c in diff["attribute_changes"])
166 print(f"\nTotal: +{total_added} additions, -{total_removed} removals")
167
168
169if __name__ == "__main__":

Callers 1

diff_schema.pyFile · 0.70

Calls 2

diff_schemasFunction · 0.85
print_diffFunction · 0.85

Tested by

no test coverage detected