MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / get_statistics

Method get_statistics

core/error_database.py:327–348  ·  view source on GitHub ↗

Get error database statistics.

(self)

Source from the content-addressed store, hash-verified

325 return match.group(1) if match else "N"
326
327 def get_statistics(self) -> Dict[str, Any]:
328 """Get error database statistics."""
329 total_errors = len(self._cache)
330 total_seen = sum(p.times_seen for p in self._cache.values())
331 total_fixed = sum(p.times_fixed for p in self._cache.values())
332
333 # Group by error type
334 by_type = defaultdict(int)
335 for pattern in self._cache.values():
336 by_type[pattern.error_type] += pattern.times_seen
337
338 # Success rate
339 success_rate = (total_fixed / total_seen * 100) if total_seen > 0 else 0
340
341 return {
342 "total_patterns": total_errors,
343 "total_occurrences": total_seen,
344 "total_fixed": total_fixed,
345 "success_rate": f"{success_rate:.1f}%",
346 "by_type": dict(by_type),
347 "most_common": max(by_type.items(), key=lambda x: x[1])[0] if by_type else None,
348 }
349
350 def clear(self):
351 """Clear error database."""

Callers 3

test_statisticsMethod · 0.95
get_statusMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_statisticsMethod · 0.76