MCPcopy Index your code
hub / github.com/ScrapeGraphAI/toonify / demo_key_folding

Function demo_key_folding

demo.py:101–127  ·  view source on GitHub ↗

Key folding demo.

()

Source from the content-addressed store, hash-verified

99 print(toon_pipe)
100
101def demo_key_folding():
102 """Key folding demo."""
103 print_section("Key Folding for Deeply Nested Data")
104
105 data = {
106 "api": {
107 "response": {
108 "data": {
109 "user": {
110 "name": "Alice"
111 }
112 }
113 }
114 }
115 }
116
117 print("Without key folding:")
118 toon_normal = encode(data)
119 print(toon_normal)
120
121 print("\nWith key folding:")
122 toon_folded = encode(data, {"key_folding": "safe"})
123 print(toon_folded)
124
125 print("\nWith path expansion on decode:")
126 result = decode(toon_folded, {"expand_paths": "safe"})
127 print(json.dumps(result, indent=2))
128
129def main():
130 """Run all demos."""

Callers 1

mainFunction · 0.85

Calls 3

encodeFunction · 0.90
decodeFunction · 0.90
print_sectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…