-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.py
More file actions
executable file
·39 lines (33 loc) · 1.03 KB
/
stats.py
File metadata and controls
executable file
·39 lines (33 loc) · 1.03 KB
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
#!/usr/bin/python
import os
import json
import sys
# Please download all repo stats before:
# wget https://api.github.com/search/repositories?q=repo:quarkslab/irma-ansible (this is just one repo)
repos = list()
for f in os.listdir("."):
if not f.startswith("repo"):
continue
with open(f) as ff:
j = json.load(ff)
items = j["items"][0]
repos.append(items)
def displayKey(r, key):
print("\t{}: {}".format(key, r[key]))
watchers, forks, issues, stars = 0, 0, 0, 0
for r in repos:
print(r["name"])
displayKey(r,"pushed_at")
displayKey(r,"updated_at")
displayKey(r,"watchers_count")
watchers += int(r["watchers_count"])
displayKey(r,"stargazers_count")
stars += int(r["stargazers_count"])
displayKey(r,"open_issues_count")
issues += int(r["open_issues_count"])
displayKey(r,"forks_count")
forks += int(r["forks_count"])
print("watchers: {}".format(watchers))
print("forks: {}".format(forks))
print("issues: {}".format(issues))
print("stars: {}".format(stars))