forked from OutlierVentures/BlockchainDevReport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.py
18 lines (17 loc) · 775 Bytes
/
stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import csv
import json
with open('./res/stats.csv', 'w+', newline='') as file:
writer = csv.writer(file)
writer.writerow(["Protocol", "Stars", "Forks", "Releases"])
for filename in os.listdir('./output'):
print(filename)
if '_stats.json' not in filename:
continue
with open("./output/" + filename, 'r') as stats_json:
protocol_stats = json.load(stats_json)
protocol = filename.split('_')
stars = protocol_stats['stars'] if "stars" in protocol_stats else 0
forks = protocol_stats['forks'] if "forks" in protocol_stats else 0
releases = protocol_stats['num_releases'] if "num_releases" in protocol_stats else 0
writer.writerow([protocol[0], stars, forks, releases])