Skip to content

Commit 04b1364

Browse files
committed
stats users and prs on community branch
1 parent ac09b69 commit 04b1364

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

stats.py

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

0 commit comments

Comments
 (0)