From a4b79127b073ae4277f71e3bfa87b22adcea0365 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 23 Sep 2024 11:49:16 -0700 Subject: [PATCH] fix: Handle ZeroDivisionError in PageRank calculation --- aider/repomap.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider/repomap.py b/aider/repomap.py index 05c6c9729..6e09edbcf 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -398,7 +398,11 @@ class RepoMap: try: ranked = nx.pagerank(G, weight="weight", **pers_args) except ZeroDivisionError: - return [] + # Issue #1536 + try: + ranked = nx.pagerank(G, weight="weight") + except ZeroDivisionError: + return [] # distribute the rank from each source node, across all of its out edges ranked_definitions = defaultdict(float)