MCPcopy Index your code
hub / github.com/LabPy/lantz / RunningStats

Class RunningStats

lantz/stats.py:68–88  ·  view source on GitHub ↗

Accumulator for categorized event statistics.

Source from the content-addressed store, hash-verified

66
67
68class RunningStats(dict):
69 """Accumulator for categorized event statistics.
70 """
71
72 def add(self, key, value):
73 """Add an event to a given accumulator.
74
75 :param key: category to which the event should be added.
76 :param value: value of the event.
77 """
78 if key in self:
79 super().__getitem__(key).add(value)
80 else:
81 super().__setitem__(key, RunningState(value))
82
83 def stats(self, key):
84 """Return the statistics for the current accumulator.
85
86 :rtype: Stats.
87 """
88 return stats(super().__getitem__(key))

Callers 2

test_groupingMethod · 0.90
__new__Method · 0.85

Calls

no outgoing calls

Tested by 1

test_groupingMethod · 0.72