mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
removed graph
This commit is contained in:
parent
36f21fcfb6
commit
47293c5ba9
1 changed files with 0 additions and 37 deletions
|
@ -8,7 +8,6 @@ import tempfile
|
||||||
from collections import Counter, defaultdict
|
from collections import Counter, defaultdict
|
||||||
|
|
||||||
# import shelve
|
# import shelve
|
||||||
import graphviz
|
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
import tiktoken
|
import tiktoken
|
||||||
from pygments.lexers import guess_lexer_for_filename
|
from pygments.lexers import guess_lexer_for_filename
|
||||||
|
@ -347,48 +346,12 @@ class RepoMap:
|
||||||
ident = data["ident"]
|
ident = data["ident"]
|
||||||
ranked_definitions[(dst, ident)] += data["rank"]
|
ranked_definitions[(dst, ident)] += data["rank"]
|
||||||
|
|
||||||
draw_graph = False
|
|
||||||
|
|
||||||
if draw_graph:
|
|
||||||
clusters = dict()
|
|
||||||
for fname in set(show_fnames):
|
|
||||||
clusters[fname] = graphviz.Digraph(f"cluster_{fname}")
|
|
||||||
clusters[fname].attr(label=fname, style="filled")
|
|
||||||
clusters[fname].node(f"invis_{fname}", style="invis", width="0", label="")
|
|
||||||
|
|
||||||
ranked_tags = []
|
ranked_tags = []
|
||||||
ranked_definitions = sorted(ranked_definitions.items(), reverse=True, key=lambda x: x[1])
|
ranked_definitions = sorted(ranked_definitions.items(), reverse=True, key=lambda x: x[1])
|
||||||
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}")
|
||||||
ranked_tags += list(definitions.get((fname, ident), []))
|
ranked_tags += list(definitions.get((fname, ident), []))
|
||||||
|
|
||||||
if draw_graph:
|
|
||||||
sz = str(rank * 25)
|
|
||||||
font_sz = rank * 500
|
|
||||||
font_sz = str(max(10, font_sz))
|
|
||||||
clusters[fname].node(
|
|
||||||
str((fname, ident)), label=ident, width=sz, height=sz, fontsize=font_sz
|
|
||||||
)
|
|
||||||
|
|
||||||
if draw_graph:
|
|
||||||
dot = graphviz.Digraph(graph_attr={"ratio": ".5"})
|
|
||||||
|
|
||||||
for cluster in clusters.values():
|
|
||||||
dot.subgraph(cluster)
|
|
||||||
|
|
||||||
for src, dst, data in G.edges(data=True):
|
|
||||||
frm = f"invis_{src}"
|
|
||||||
ident = data["ident"]
|
|
||||||
to = str((dst, ident))
|
|
||||||
|
|
||||||
dot.edge(
|
|
||||||
frm,
|
|
||||||
to,
|
|
||||||
# penwidth=str(weight), color=color, fontcolor=color, label=label,
|
|
||||||
)
|
|
||||||
|
|
||||||
dot.render("tmp", format="pdf", view=True)
|
|
||||||
|
|
||||||
return ranked_tags
|
return ranked_tags
|
||||||
|
|
||||||
def get_ranked_tags_map(self, chat_fnames, other_fnames=None):
|
def get_ranked_tags_map(self, chat_fnames, other_fnames=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue