summaryrefslogtreecommitdiffstats
path: root/third_party/rust/jsparagus/.metrics/not_implemented_count.py
blob: 947044eca9345e5fa32eee1f14c22f6e7707a6c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python
import json
import os.path

filename = 'count/not-implemented.json'
if not os.path.isfile(filename):
    with open(filename, 'w') as f:
        json.dump([], f, indent=4)  # initialize with an empty list

with open(filename, 'r+') as f:
    data = json.load(f)
    if len(data) == 0 or data[-1]["commit"] != os.environ['current_commit']:
        data.append({
            "commit": os.environ['current_commit'],
            "total_count": os.environ['total_count']
        })
        f.seek(0)
        json.dump(data, f, indent=4)
        f.truncate()