MCPcopy Index your code
hub / github.com/Persper/code-analytics / Analyzer

Class Analyzer

persper/graphs/analyzer.py:69–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67
68
69class Analyzer:
70
71 def __init__(self, repo_path, graph_server):
72 self.graph_server = graph_server
73 self.ri = RepoIterator(repo_path)
74 self.history = {}
75 self.id_map = {}
76 self.ordered_shas = []
77 self.graph = None
78
79 def analyze(self, rev=None,
80 from_beginning=False,
81 num_commits=None,
82 continue_iter=False,
83 end_commit_sha=None,
84 into_branches=False,
85 max_branch_length=100,
86 min_branch_date=None,
87 checkpoint_interval=1000,
88 verbose=False):
89
90 if not continue_iter:
91 self.reset_state()
92 self.graph_server.reset_graph()
93
94 commits, branch_commits = \
95 self.ri.iter(rev=rev,
96 from_beginning=from_beginning,
97 num_commits=num_commits,
98 continue_iter=continue_iter,
99 end_commit_sha=end_commit_sha,
100 into_branches=into_branches,
101 max_branch_length=max_branch_length,
102 min_branch_date=min_branch_date)
103
104 print_overview(commits, branch_commits)
105 start_time = time.time()
106
107 for idx, commit in enumerate(reversed(commits), 1):
108 phase = 'main'
109 print_commit_info(phase, idx, commit, start_time, verbose)
110 self.analyze_master_commit(commit)
111 self.autosave(phase, idx, checkpoint_interval)
112
113 for idx, commit in enumerate(branch_commits, 1):
114 phase = 'branch'
115 print_commit_info(phase, idx, commit, start_time, verbose)
116 self.analyze_branch_commit(commit)
117 self.autosave(phase, idx, checkpoint_interval)
118
119 self.autosave('finished', 0, 1)
120
121 def _analyze_commit(self, commit, ccg_func):
122 sha = commit.hexsha
123 self.ordered_shas.append(sha)
124 self.history[sha] = {}
125 self.id_map[sha] = {}
126 diff_index = _diff_with_first_parent(commit)

Callers 11

runFunction · 0.90
azFunction · 0.90
test_analyze_interfaceFunction · 0.90
test_map_idFunction · 0.90
azFunction · 0.90
azFunction · 0.90
azFunction · 0.90
azFunction · 0.90
test_black_setFunction · 0.90
azFunction · 0.90
azFunction · 0.90

Calls

no outgoing calls

Tested by 10

azFunction · 0.72
test_analyze_interfaceFunction · 0.72
test_map_idFunction · 0.72
azFunction · 0.72
azFunction · 0.72
azFunction · 0.72
azFunction · 0.72
test_black_setFunction · 0.72
azFunction · 0.72
azFunction · 0.72