MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / build_tree

Function build_tree

scripts/generate_classification_pages.py:54–63  ·  view source on GitHub ↗

Build {l1_code: {l2_code: [items]}} structure.

(catalog)

Source from the content-addressed store, hash-verified

52
53
54def build_tree(catalog):
55 """Build {l1_code: {l2_code: [items]}} structure."""
56 tree = {}
57 for item in catalog.get("items", []):
58 l1 = item.get("l1_code", "")
59 l2 = item.get("l2_code", "")
60 if not l1 or not l2:
61 continue
62 tree.setdefault(l1, {}).setdefault(l2, []).append(item)
63 return tree
64
65
66def generate_zh_index(catalog, tree):

Callers 1

mainFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected