-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbug2csv.py
More file actions
executable file
·41 lines (34 loc) · 1.02 KB
/
bug2csv.py
File metadata and controls
executable file
·41 lines (34 loc) · 1.02 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
40
41
#!/usr/bin/env python3
# Extrac bug info from output of "defects4j info -p" command
import os
import sys
import argparse
import re
def loadBugInfo(f):
print('Loading buginfo from file: ' + str(f.name))
status = 'start'
bugs = {}
while True:
line = f.readline()
if line == '': # end of file
break
elif line == '\n':
continue
elif line.startswith("-----"):
continue
elif line.startswith("Summary for Bug:"):
#Start of a new bug
result = re.search(r'\w+-(\d+)', line)
bugNum = result.group(1)
status = 'new'
print(bugNum)
continue
else:
pass
f.close()
if __name__ == '__main__':
DLMTR = ','
parser = argparse.ArgumentParser(description="Extract bug info into a csv file")
parser.add_argument('input', help='bug info output from Defects4j', type=argparse.FileType('r'))
args = parser.parse_args()
loadBugInfo(args.input)