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

Function print_diff

Scripts/diff_schema.py:117–141  ·  view source on GitHub ↗

Pretty-print the diff results.

(diff: dict)

Source from the content-addressed store, hash-verified

115
116
117def print_diff(diff: dict):
118 """Pretty-print the diff results."""
119 if diff["added_elements"]:
120 print("\n=== NEW ELEMENTS ===")
121 for elem in diff["added_elements"]:
122 print(f" + {elem}")
123
124 if diff["removed_elements"]:
125 print("\n=== REMOVED ELEMENTS ===")
126 for elem in diff["removed_elements"]:
127 print(f" - {elem}")
128
129 if diff["attribute_changes"]:
130 print("\n=== ATTRIBUTE CHANGES ===")
131 for change in diff["attribute_changes"]:
132 elem = change["element"]
133 if change["added"]:
134 for attr in change["added"]:
135 print(f" + {elem}.{attr}")
136 if change["removed"]:
137 for attr in change["removed"]:
138 print(f" - {elem}.{attr}")
139
140 if not any(diff.values()):
141 print("\nNo changes detected. Schemas are identical.")
142
143
144def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected