-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfilter-mobile-issues.py
30 lines (23 loc) · 993 Bytes
/
filter-mobile-issues.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
import csv
import json
import glob
from dateutil import parser
c = csv.writer(open("data/mobile-issues.csv", "w", newline=''))
c.writerow(['id', 'title','state','created','closed', 'time_to_close', 'url'])
issue_files = sorted(glob.glob('data/issues-*.json'))
for issue_file in issue_files:
print(issue_file)
with open(issue_file, encoding="utf8") as f:
d = json.load(f)
pr = "pull_request"
for x in d:
labels = x["labels"]
for label in labels:
if (label["name"] == 'platform:mobile'):
if not pr in x:
print(x["id"])
created = parser.isoparse(x["created_at"])
time_to_close = ''
if (x["closed_at"]):
time_to_close = (parser.isoparse(x["closed_at"]) - created).days
c.writerow([x["id"], x["title"].encode('utf-8'), x["state"], x["created_at"], x["closed_at"], time_to_close, x["html_url"]])