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

Method get_histogram

Tools/scripts/summarize_stats.py:596–604  ·  view source on GitHub ↗
(self, prefix: str)

Source from the content-addressed store, hash-verified

594 }
595
596 def get_histogram(self, prefix: str) -> list[tuple[int, int]]:
597 rows = []
598 for k, v in self._data.items():
599 match = re.match(f"{prefix}\\[([0-9]+)\\]", k)
600 if match is not None:
601 entry = int(match.groups()[0])
602 rows.append((entry, v))
603 rows.sort()
604 return rows
605
606 def get_rare_events(self) -> list[tuple[str, int]]:
607 prefix = "Rare event "

Callers 1

calcFunction · 0.80

Calls 5

itemsMethod · 0.45
matchMethod · 0.45
groupsMethod · 0.45
appendMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected