Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions codebase_rag/graph_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,21 @@ def dfs(node: dict[str, Any]) -> None:
return results

def find_ending_with(self, suffix: str) -> list[str]:
"""Find all qualified names ending with the given suffix."""
return [qn for qn in self._entries.keys() if qn.endswith(f".{suffix}")]
"""Find all qualified names ending with the given suffix using DFS on the trie."""
results: list[str] = []

def dfs(node: dict[str, Any]) -> None:
if "__qn__" in node:
qn = node["__qn__"]
if qn.endswith(f".{suffix}"):
results.append(qn)

for key, child in node.items():
if not key.startswith("__"):
dfs(child)

dfs(self.root)
return results

def find_with_prefix(self, prefix: str) -> list[tuple[str, str]]:
"""Find all qualified names that start with the given prefix.
Expand Down