mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
fix: Update repomap.py to improve caching and logging
This commit is contained in:
parent
3ba6e95d22
commit
042a4f14d2
1 changed files with 9 additions and 2 deletions
|
@ -146,7 +146,6 @@ class RepoMap:
|
||||||
return self.TAGS_CACHE[cache_key]["data"]
|
return self.TAGS_CACHE[cache_key]["data"]
|
||||||
|
|
||||||
# miss!
|
# miss!
|
||||||
|
|
||||||
data = list(self.get_tags_raw(fname, rel_fname))
|
data = list(self.get_tags_raw(fname, rel_fname))
|
||||||
|
|
||||||
# Update the cache
|
# Update the cache
|
||||||
|
@ -247,6 +246,8 @@ class RepoMap:
|
||||||
fnames = tqdm(fnames)
|
fnames = tqdm(fnames)
|
||||||
self.cache_missing = False
|
self.cache_missing = False
|
||||||
|
|
||||||
|
print('tags')
|
||||||
|
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
if not Path(fname).is_file():
|
if not Path(fname).is_file():
|
||||||
if fname not in self.warned_files:
|
if fname not in self.warned_files:
|
||||||
|
@ -280,9 +281,10 @@ class RepoMap:
|
||||||
key = (rel_fname, tag.name)
|
key = (rel_fname, tag.name)
|
||||||
definitions[key].add(tag)
|
definitions[key].add(tag)
|
||||||
|
|
||||||
if tag.kind == "ref":
|
elif tag.kind == "ref":
|
||||||
references[tag.name].append(rel_fname)
|
references[tag.name].append(rel_fname)
|
||||||
|
|
||||||
|
print('graph')
|
||||||
##
|
##
|
||||||
# dump(defines)
|
# dump(defines)
|
||||||
# dump(references)
|
# dump(references)
|
||||||
|
@ -323,11 +325,14 @@ class RepoMap:
|
||||||
else:
|
else:
|
||||||
pers_args = dict()
|
pers_args = dict()
|
||||||
|
|
||||||
|
print('rank')
|
||||||
try:
|
try:
|
||||||
ranked = nx.pagerank(G, weight="weight", **pers_args)
|
ranked = nx.pagerank(G, weight="weight", **pers_args)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
print('dist rank')
|
||||||
|
|
||||||
# distribute the rank from each source node, across all of its out edges
|
# distribute the rank from each source node, across all of its out edges
|
||||||
ranked_definitions = defaultdict(float)
|
ranked_definitions = defaultdict(float)
|
||||||
for src in G.nodes:
|
for src in G.nodes:
|
||||||
|
@ -344,6 +349,7 @@ class RepoMap:
|
||||||
|
|
||||||
# dump(ranked_definitions)
|
# dump(ranked_definitions)
|
||||||
|
|
||||||
|
print('ranked_tags')
|
||||||
for (fname, ident), rank in ranked_definitions:
|
for (fname, ident), rank in ranked_definitions:
|
||||||
# print(f"{rank:.03f} {fname} {ident}")
|
# print(f"{rank:.03f} {fname} {ident}")
|
||||||
if fname in chat_rel_fnames:
|
if fname in chat_rel_fnames:
|
||||||
|
@ -364,6 +370,7 @@ class RepoMap:
|
||||||
for fname in rel_other_fnames_without_tags:
|
for fname in rel_other_fnames_without_tags:
|
||||||
ranked_tags.append((fname,))
|
ranked_tags.append((fname,))
|
||||||
|
|
||||||
|
print('done')
|
||||||
return ranked_tags
|
return ranked_tags
|
||||||
|
|
||||||
def get_ranked_tags_map(
|
def get_ranked_tags_map(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue