-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.py
executable file
·50 lines (30 loc) · 970 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python2
from collections import defaultdict
import pymongo
import datasets.util
client = pymongo.MongoClient()
db = client.topcoder
def platforms_and_technologies():
count = defaultdict(int)
for challenge in db.challenges.find():
for plat in challenge[u"platforms"]:
count[plat] += 1
for tech in challenge[u"technology"]:
count[tech] += 1
for key in sorted(count.keys()):
print u"%s: %s" % (key, count[key])
print "\nTotal:", len(count), "\n"
def winners():
count = defaultdict(int)
for challenge in db.challenges.find():
winner = datasets.util.topcoder_get_winner(challenge)
if winner is not None:
count[winner] += 1
for key in sorted(count.keys()):
print u"%s: %s" % (key, count[key])
print "\nTotal:", len(count), "\n"
def main():
platforms_and_technologies()
winners()
if __name__ == "__main__":
main()