MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _common_root

Function _common_root

graphify/tree_html.py:49–61  ·  view source on GitHub ↗
(paths: List[str])

Source from the content-addressed store, hash-verified

47
48
49def _common_root(paths: List[str]) -> str:
50 if not paths:
51 return ""
52 parts = [Path(p).parent.parts for p in paths if isinstance(p, str) and p]
53 if not parts:
54 return ""
55 common = parts[0]
56 for p in parts[1:]:
57 i = 0
58 while i < len(common) and i < len(p) and common[i] == p[i]:
59 i += 1
60 common = common[:i]
61 return str(Path(*common)) if common else ""
62
63
64def _make_truncation_leaf(

Callers 1

build_treeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected