MCPcopy Create free account
hub / github.com/VectifyAI/PageIndex / get_nodes

Function get_nodes

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

Source from the content-addressed store, hash-verified

142 return node_id
143
144def get_nodes(structure):
145 if isinstance(structure, dict):
146 structure_node = copy.deepcopy(structure)
147 structure_node.pop('nodes', None)
148 nodes = [structure_node]
149 for key in list(structure.keys()):
150 if 'nodes' in key:
151 nodes.extend(get_nodes(structure[key]))
152 return nodes
153 elif isinstance(structure, list):
154 nodes = []
155 for item in structure:
156 nodes.extend(get_nodes(item))
157 return nodes
158
159def structure_to_list(structure):
160 if isinstance(structure, dict):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected