Exemple #1
0
    },
    {
        "a": -2,
        "b": 8,
    },
    {
        "a": 3,
        "b": 14,
    },
    {
        "a": 12,
        "b": 7,
    },
]

ctx.data = Cell()
ctx.data.hash_pattern = {"!": "#"}
ctx.compute()
#ctx.data.schema.storage = "pure-plain"  # bad idea... validation forces full value construction
ctx.data.set(data)
ctx.compute()
#print(ctx.data.value[0].a) # bad idea... forces full value construction
print(ctx.data.handle[0].value["a"])  # the correct way
#print(ctx.data.handle[0].a.value)  # will not work; .value has to be right after the first key (0 in this case)

ctx.result = Cell()
ctx.result.hash_pattern = {"!": "#"}
ctx.compute()
#ctx.result.schema.storage = "pure-plain" # bad idea... validation forces full value construction

ctx.include(mylib.map_list)
Exemple #2
0
        "b": 8,
    },
    {
        "a": 3,
        "b": 14,
    },
    {
        "a": 12,
        "b": 7,
    },
    {
        "a": 88,
        "b": -20,
    },
]
ctx.data = Cell().set(data)


def get_data_a(data):
    return [v["a"] for v in data]


ctx.get_data_a = get_data_a
ctx.get_data_a.debug = True


def get_data_b(data):
    return [v["b"] for v in data]


ctx.get_data_b = get_data_b