-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
stats.py
34 lines (26 loc) · 870 Bytes
/
stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''Checks community branch dir structure to see who submitted most
and what challenge is more popular by number of PRs'''
from collections import Counter
import glob
import os
TOP_N = 5
NOT_USERS = 'static templates data'.split()
users = Counter()
popular_challenges = Counter()
for dir_ in glob.glob('*/*'):
dir_ = dir_.lower()
if not os.path.isdir(dir_):
continue
ch, user = dir_.split('/')
ch = 'PCC' + ch
if user in NOT_USERS:
continue
users[user] += 1
popular_challenges[ch] += 1
print('{} users opened {} PRs\n'.format(len(users),
sum(popular_challenges.values())))
print('Top 5 challenges by PR:')
print(popular_challenges.most_common(TOP_N))
print('Die hard users:')
print(users.most_common(TOP_N))
print('\n* new style PRs only = ch<int>/user<str> directory names')