-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
26 lines (20 loc) · 774 Bytes
/
Copy pathexample.py
File metadata and controls
26 lines (20 loc) · 774 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
25
26
import yamlet
import datetime
opts = yamlet.YamletOptions(functions={'now': datetime.datetime.now})
loader = yamlet.Loader(opts)
t = loader.load_file('yaml-gcl.yaml')
print(t['childtuple']['coolbeans'])
print(t['childtuple2']['coolbeans'])
# Didn't I tell you not to do this?
print(t['horribletuple']['coolbeans'])
print(t['horribletuple2']['coolbeans'])
print(t['other_features']['timestamp'])
print(t['other_features']['two'])
print('Condition 1:', t['c1']['value'])
print('Condition 2:', t['c2']['value'])
print('Condition 3:', t['c3']['value'])
# The following would break because of cycles.
# print(t['recursive']['a'])
print(t['childtuple'].explain_value('coolbeans'))
print(t['childtuple'].explain_value('beans'))
print(t['childtuple2'].explain_value('beans'))