Exemple #1
0
ctx.compute()
print(ctx.s.value)
print(ctx.ss.value)
print(ctx.s.exception)
print("")
ctx.b = Cell("int").set(999)
ctx.s.b = ctx.b
ctx.compute()
print(ctx.s.value)
print(ctx.ss.value)
print(ctx.s.exception)
print("")
ctx.b = None
ctx.compute()
print(ctx.s.value)
print(ctx.ss.value)
print(ctx.s.exception)
print("")
ctx.d = 123
#ctx.d.celltype = "int" ###
ctx.s.d = ctx.d
ctx.compute()
print(ctx.s.value)
print(ctx.ss.value)
print(ctx.s.exception)
print("")
ctx.d = None
ctx.compute()
print(ctx.s.value)
print(ctx.ss.value)
print(ctx.s.exception)
Exemple #2
0
ctx.a = {}
ctx.translate()
ctx.a.b = 12
ctx.compute()
print(ctx.a.value, ctx.a.value.data)
print(type(ctx.a.value), type(ctx.a.value.data))

ctx.a.example.b = 1.1
ctx.compute()
print(ctx.a.value, ctx.a.value.data, ctx.a.schema)

ctx.tf = lambda x, y: x + y
ctx.tf.x = ctx.a.b
ctx.c = 20
ctx.tf.y = ctx.c
ctx.d = ctx.tf
ctx.compute()
print(ctx.d.value)  #32
print(ctx.tf.inp.value)
print()

print("Stage 2")
ctx.f0 = 20
ctx.q = {}
ctx.translate()
ctx.q.c = ctx.c
ctx.q.d = ctx.d
ctx.q.f = ctx.f0
ctx.q.g = 50
ctx.compute()
print(ctx.q.value)  #{'c': 20, 'd': 32, 'f': 20, 'g': 50}