-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-result.py
More file actions
30 lines (22 loc) · 839 Bytes
/
git-result.py
File metadata and controls
30 lines (22 loc) · 839 Bytes
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
import json
import pandas as pd
from pandas import DataFrame
total_files = 0
total_languages = []
total_lines = 0
with open('data/new_data.json') as f:
repos = json.load(f)
for i in range(0, len(repos["full_name"])):
with open('data/repos/'+str(i)+'.json') as f:
code = json.load(f)
for j in range(0, len(code["linesOfCode"])):
total_lines = code["linesOfCode"][str(j)] + total_lines
for j in range(0, len(code["files"])):
total_files = code["files"][str(j)] + total_files
for j in range(0, len(code["language"])):
total_languages.append(code["language"][str(j)])
total_languages = list(dict.fromkeys(total_languages))
result = [total_files, total_lines, len(
total_languages), len(repos["full_name"])]
with open('data/result.json', 'w') as file:
json.dump(result, file)