-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdemo_p.py
More file actions
60 lines (48 loc) · 1.26 KB
/
Copy pathdemo_p.py
File metadata and controls
60 lines (48 loc) · 1.26 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from vega_lite_linter import Lint
import json
# with open('./vega_lite_linter/test/multiple/test9.json') as json_file:
# demo = json.load(json_file)
# print(demo)
demo = {
"data": {
"url": "data/cars.json"
},
"mark": "bar",
"encoding": {
"x": {
"field": "Horsepower",
"type": "quantitative"
},
"y": {
"field": "Miles_per_Gallon",
"type": "quantitative"
},
"size": {
"field": "Cylinders",
"type": "ordinal"
}
}
}
lint = Lint(demo)
result = lint.lint()
print('lint rules: ', '-'*20, len(result))
print(result)
fix = lint.fix()
print('fix rules: ', '-'*20)
for key in fix:
print('---- ', key, fix[key])
# if fix['fixable']:
# newvl = fix['optimize_spec']
# new_lint = Lint(newvl)
# new_result = new_lint.lint()
# print('new lint rules: ', '-'*20)
# print(new_result)
# new_fix = new_lint.fix()
# for key in new_fix:
# print('---- ', key, new_fix[key])
# if new_fix['fixable']:
# newvl1 = new_fix['optimize_spec']
# new_lint1 = Lint(newvl1)
# new_result1 = new_lint1.lint()
# print('new lint rules: ', '-'*20)
# print(new_result1)