MCPcopy Index your code
hub / github.com/VectifyAI/PageIndex / structure_to_list

Function structure_to_list

pageindex/utils.py:159–170  ·  view source on GitHub ↗
(structure)

Source from the content-addressed store, hash-verified

157 return nodes
158
159def structure_to_list(structure):
160 if isinstance(structure, dict):
161 nodes = []
162 nodes.append(structure)
163 if 'nodes' in structure:
164 nodes.extend(structure_to_list(structure['nodes']))
165 return nodes
166 elif isinstance(structure, list):
167 nodes = []
168 for item in structure:
169 nodes.extend(structure_to_list(item))
170 return nodes
171
172
173def get_leaf_nodes(structure):

Callers 3

check_token_limitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected