Show summary statistics.
(args, data)
| 513 | |
| 514 | |
| 515 | def cmd_stats(args, data): |
| 516 | """Show summary statistics.""" |
| 517 | from collections import Counter |
| 518 | |
| 519 | print(f"Repository: {data['repository']}") |
| 520 | print(f"Fetched: {data['fetched_at'][:19]}") |
| 521 | print(f"Open: {data['open_count']} Closed: {data['closed_count']}") |
| 522 | print() |
| 523 | |
| 524 | label_counts = Counter() |
| 525 | for i in data["open_issues"]: |
| 526 | for lbl in i["labels"]: |
| 527 | label_counts[lbl] += 1 |
| 528 | |
| 529 | print("Open issue labels:") |
| 530 | for label, count in label_counts.most_common(): |
| 531 | print(f" {count:3d} {label}") |
| 532 | |
| 533 | unlabeled = sum(1 for i in data["open_issues"] if not i["labels"]) |
| 534 | print(f" {unlabeled:3d} (unlabeled)") |
| 535 | |
| 536 | |
| 537 | def main(): |
nothing calls this directly
no outgoing calls
no test coverage detected