-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathcheck.py
More file actions
32 lines (27 loc) · 1014 Bytes
/
check.py
File metadata and controls
32 lines (27 loc) · 1014 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
31
32
import os
import json
import re
from checker import Checker
if __name__ == '__main__':
checker = Checker()
scores = {}
results = {}
folder_path = 'hw_data/significance/'
for filename in os.listdir(folder_path):
if filename.endswith('.py'):
name, score = checker.check(folder_path + filename)
print(name, score)
if name is not None and score is not None:
print('score is', max(round(2 ** (6 * (score - 2.8)), 2), 0.05))
results[name] = score
else:
scores[name] = 0.05
best_accuracy = max(results.values())
for name in results:
scores[name] = max(round(2 ** (6 * (results[name] - 2.8)), 2), 0.05)
with open('hw_data/significance.json', 'w') as f:
json.dump(scores, f, indent=4)
with open('hw_data/significance.csv', 'w') as f:
f.write('email, score\n')
for name in sorted(scores):
f.write('{},{}\n'.format(name, scores[name]))