-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvarypy.py
66 lines (55 loc) · 2.11 KB
/
varypy.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import argparse
import json
import pandas as pd
import matplotlib as plt
import subprocess
def averageCsv(names):
res = []
key =""
for n in names:
temp = pd.read_csv(n)
key = temp.keys() #tab of keys
res.append(temp)
df = pd.concat(res)
result=df.groupby(key[0], as_index=False).mean()
return result
def plotSome(csvLog):
csvDf = averageCsv(csvLog)
for frame in csvLog:
df = pd.read_csv(frame)
csvDf.plot.scatter(x="Predicted",y="Id")
plt.show()
print(csvDf)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
#Parse args and option
parser.add_argument("--prog",help="PATH of program or directory to be used for cyclying dependecies",action='store')
parser.add_argument("pkg",help="package to be cycled")
parser.add_argument("-rt","--releasetype",help="what type of release to test for default major",default="major",choices=['minor','patch','all'])
parser.add_argument("-v","--verbose", help="logs from every process",action='store_true')
parser.add_argument("-N","--ntimes",help="INT number of execution of prog for pkg version default 1",default=1)
parser.add_argument("-t","--test",help="if your project using pytest use this option",action='store_true')
parser.add_argument("--outputfile",help="Name of the ouputfile if prog outputs csv file")
args = parser.parse_args()
prog = args.prog
pkg = args.pkg
releasetype = args.releasetype
ntimes = args.ntimes
verbose = args.verbose
test = args.test
outputfile = args.outputfile
#cyclePackage = subprocess.Popen(['python3','~/projet/varypy/cyclePackage.py',parser])
#Constructing dataframe from logs
resMap = {}
with open("result.json", "r") as read_file:
resMap = json.load(read_file)
df = pd.DataFrame(resMap)
df.to_csv(pkg+"-"+releasetype)
print(df)
#Constructing csv mean
if outputfile is not None:
resList = []
with open("csvList.json",'r') as read_ifle:
resList = json.load(read_ifle)
csvMean = averageCsv(resList)
print(csvMean)