MCPcopy Create free account
hub / github.com/SpaceZephyr/myskill / save_inventory

Function save_inventory

pptx/scripts/inventory.py:1003–1016  ·  view source on GitHub ↗

Save inventory to JSON file with proper formatting. Converts ShapeData objects to dictionaries for JSON serialization.

(inventory: InventoryData, output_path: Path)

Source from the content-addressed store, hash-verified

1001
1002
1003def save_inventory(inventory: InventoryData, output_path: Path) -> None:
1004 """Save inventory to JSON file with proper formatting.
1005
1006 Converts ShapeData objects to dictionaries for JSON serialization.
1007 """
1008 # Convert ShapeData objects to dictionaries
1009 json_inventory: InventoryDict = {}
1010 for slide_key, shapes in inventory.items():
1011 json_inventory[slide_key] = {
1012 shape_key: shape_data.to_dict() for shape_key, shape_data in shapes.items()
1013 }
1014
1015 with open(output_path, "w", encoding="utf-8") as f:
1016 json.dump(json_inventory, f, indent=2, ensure_ascii=False)
1017
1018
1019if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls 1

to_dictMethod · 0.45

Tested by

no test coverage detected