MCPcopy
hub / github.com/HKUDS/DeepCode / load_index_files_from_directory

Function load_index_files_from_directory

tools/code_reference_indexer.py:65–85  ·  view source on GitHub ↗

Load all index files from specified directory

(indexes_directory: str)

Source from the content-addressed store, hash-verified

63
64
65def load_index_files_from_directory(indexes_directory: str) -> Dict[str, Dict]:
66 """Load all index files from specified directory"""
67 indexes_path = Path(indexes_directory).resolve()
68
69 if not indexes_path.exists():
70 logger.warning(f"Indexes directory does not exist: {indexes_path}")
71 return {}
72
73 index_cache = {}
74
75 for index_file in indexes_path.glob("*.json"):
76 try:
77 with open(index_file, "r", encoding="utf-8") as f:
78 index_data = json.load(f)
79 index_cache[index_file.stem] = index_data
80 logger.info(f"Loaded index file: {index_file.name}")
81 except Exception as e:
82 logger.error(f"Failed to load index file {index_file.name}: {e}")
83
84 logger.info(f"Loaded {len(index_cache)} index files from {indexes_path}")
85 return index_cache
86
87
88def extract_code_references(index_data: Dict) -> List[CodeReference]:

Callers 2

search_code_referencesFunction · 0.85
get_indexes_overviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected