MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _collect

Function _collect

codewiki/mcp/tools/module_tree.py:32–53  ·  view source on GitHub ↗
(tree: Dict[str, Any], path: List[str])

Source from the content-addressed store, hash-verified

30 order: List[Dict[str, Any]] = []
31
32 def _collect(tree: Dict[str, Any], path: List[str]) -> None:
33 for module_name, module_info in tree.items():
34 current_path = path + [module_name]
35 children = module_info.get("children", {})
36 has_children = isinstance(children, dict) and len(children) > 0
37
38 if has_children:
39 _collect(children, current_path)
40 order.append({
41 "module": module_name,
42 "path": current_path,
43 "is_leaf": False,
44 "children": list(children.keys()),
45 "components": module_info.get("components", []),
46 })
47 else:
48 order.append({
49 "module": module_name,
50 "path": current_path,
51 "is_leaf": True,
52 "components": module_info.get("components", []),
53 })
54
55 _collect(module_tree, parent_path)
56 return order

Callers 1

_get_processing_orderFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected