MCPcopy Index your code
hub / github.com/python/cpython / _get_pred_succ

Method _get_pred_succ

Tools/scripts/summarize_stats.py:220–236  ·  view source on GitHub ↗
(
        self,
    )

Source from the content-addressed store, hash-verified

218
219 @functools.cache
220 def _get_pred_succ(
221 self,
222 ) -> tuple[dict[str, collections.Counter], dict[str, collections.Counter]]:
223 pair_counts = self.get_pair_counts()
224
225 predecessors: dict[str, collections.Counter] = collections.defaultdict(
226 collections.Counter
227 )
228 successors: dict[str, collections.Counter] = collections.defaultdict(
229 collections.Counter
230 )
231 for (first, second), count in pair_counts.items():
232 if count:
233 predecessors[second][first] = count
234 successors[first][second] = count
235
236 return predecessors, successors
237
238 def get_predecessors(self, opcode: str) -> collections.Counter[str]:
239 return self._get_pred_succ()[0][opcode]

Callers 2

get_predecessorsMethod · 0.95
get_successorsMethod · 0.95

Calls 2

get_pair_countsMethod · 0.95
itemsMethod · 0.45

Tested by

no test coverage detected