MCPcopy
hub / github.com/VectifyAI/PageIndex / write_node_id

Function write_node_id

pageindex/utils.py:132–142  ·  view source on GitHub ↗
(data, node_id=0)

Source from the content-addressed store, hash-verified

130 return {}
131
132def write_node_id(data, node_id=0):
133 if isinstance(data, dict):
134 data['node_id'] = str(node_id).zfill(4)
135 node_id += 1
136 for key in list(data.keys()):
137 if 'nodes' in key:
138 node_id = write_node_id(data[key], node_id)
139 elif isinstance(data, list):
140 for index in range(len(data)):
141 node_id = write_node_id(data[index], node_id)
142 return node_id
143
144def get_nodes(structure):
145 if isinstance(structure, dict):

Callers 2

page_index_builderFunction · 0.85
md_to_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected