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

Function find_node

pageindex/utils.py:193–207  ·  view source on GitHub ↗
(data, node_id)

Source from the content-addressed store, hash-verified

191def is_leaf_node(data, node_id):
192 # Helper function to find the node by its node_id
193 def find_node(data, node_id):
194 if isinstance(data, dict):
195 if data.get('node_id') == node_id:
196 return data
197 for key in data.keys():
198 if 'nodes' in key:
199 result = find_node(data[key], node_id)
200 if result:
201 return result
202 elif isinstance(data, list):
203 for item in data:
204 result = find_node(item, node_id)
205 if result:
206 return result
207 return None
208
209 # Find the node with the given node_id
210 node = find_node(data, node_id)

Callers 1

is_leaf_nodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected