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

Function format_structure

pageindex/utils.py:640–651  ·  view source on GitHub ↗
(structure, order=None)

Source from the content-addressed store, hash-verified

638
639
640def format_structure(structure, order=None):
641 if not order:
642 return structure
643 if isinstance(structure, dict):
644 if 'nodes' in structure:
645 structure['nodes'] = format_structure(structure['nodes'], order)
646 if not structure.get('nodes'):
647 structure.pop('nodes', None)
648 structure = reorder_dict(structure, order)
649 elif isinstance(structure, list):
650 structure = [format_structure(item, order) for item in structure]
651 return structure
652
653
654class ConfigLoader:

Callers 2

page_index_builderFunction · 0.85
md_to_treeFunction · 0.85

Calls 1

reorder_dictFunction · 0.85

Tested by

no test coverage detected