From d9114469e33d8ac2b53bb0cc70989792da224cf7 Mon Sep 17 00:00:00 2001 From: huangsen Date: Thu, 14 May 2026 11:36:39 +0800 Subject: [PATCH] refactor(file_graph): remove unused iter_nodes abstract method BREAKING CHANGE: Removed the iter_nodes abstract method from BaseFileGraph and its implementations in LocalFileGraph and Neo4jFileGraph as it was no longer being used in the codebase. --- reme2/component/file_graph/base_file_graph.py | 4 ---- reme2/component/file_graph/local_file_graph.py | 6 ------ reme2/component/file_graph/neo4j_file_graph.py | 7 ------- 3 files changed, 17 deletions(-) diff --git a/reme2/component/file_graph/base_file_graph.py b/reme2/component/file_graph/base_file_graph.py index 6bce3696..add28ecb 100644 --- a/reme2/component/file_graph/base_file_graph.py +++ b/reme2/component/file_graph/base_file_graph.py @@ -55,10 +55,6 @@ class BaseFileGraph(BaseComponent): async def get_node(self, path: str) -> FileNode | None: """Single-node lookup.""" - @abstractmethod - def iter_nodes(self) -> AsyncIterator[tuple[str, FileNode]]: - """Walk every (path, FileNode) in the graph.""" - # -- Link access ------------------------------------------------------- @abstractmethod diff --git a/reme2/component/file_graph/local_file_graph.py b/reme2/component/file_graph/local_file_graph.py index f587c1ee..6a093746 100644 --- a/reme2/component/file_graph/local_file_graph.py +++ b/reme2/component/file_graph/local_file_graph.py @@ -121,12 +121,6 @@ class LocalFileGraph(BaseFileGraph): return None return self._graph.nodes[path].get("node") - async def iter_nodes(self) -> AsyncIterator[tuple[str, FileNode]]: - for path, data in self._graph.nodes(data=True): - node = data.get("node") - if node is not None: - yield path, node - # -- Link access ------------------------------------------------------- async def get_outlinks(self, path: str) -> list[tuple[FileNode, FileLink]]: diff --git a/reme2/component/file_graph/neo4j_file_graph.py b/reme2/component/file_graph/neo4j_file_graph.py index df8b96bf..d7eb613b 100644 --- a/reme2/component/file_graph/neo4j_file_graph.py +++ b/reme2/component/file_graph/neo4j_file_graph.py @@ -208,13 +208,6 @@ class Neo4jFileGraph(BaseFileGraph): row = await rec.single() return self._row_to_node(row["f"]) if row else None - async def iter_nodes(self) -> AsyncIterator[tuple[str, FileNode]]: - async with self._session() as session: - rec = await session.run("MATCH (f:File) RETURN f") - async for row in rec: - node = self._row_to_node(row["f"]) - yield node.path, node - # -- Link access ------------------------------------------------------- async def get_outlinks(self, path: str) -> list[tuple[FileNode, FileLink]]: