-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimg.py
More file actions
24 lines (22 loc) · 679 Bytes
/
img.py
File metadata and controls
24 lines (22 loc) · 679 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
import json
f = open('img.json', 'r')
o = json.load(f)
taglist = ['base']
depth = 0
for event in o:
if event['evt.type'] == 'tracer':
dir = event['evt.dir']
info = event['evt.info'].split()
tags = info[1].split('tags=')[1]
print(dir + ' ' + tags)
if dir == '>' and tags != taglist[-1]:
taglist.append(tags)
depth += 1
print('push:' + tags + ' depth = ' + str(depth))
elif dir == '<' and tags == taglist[-1]:
print(' pop:' + tags + ' depth = ' + str(depth))
taglist.pop()
depth -= 1
else:
print('THIS SHOULD NEVER HAPPEN!')
f.close()