def setup_module(module): global smache, score, h, f, with_raw DummyA.unsubscribe_all() DummyB.unsubscribe_all() DummyC.unsubscribe_all() smache = Smache(scheduler=InProcessScheduler(), write_through=False) @smache.sources(DummyB, DummyC) @smache.computed(DummyA) def score(a): return a.value + 5 + 10 @smache.computed(DummyB, DummyC) def h(b, c): return b.value + c.value @smache.computed(DummyA, DummyB, DummyC) def f(a, b, c): return a.value * h(b, c) @smache.computed(DummyA, DummyB, Raw) def with_raw(a, b, static_value): return (a.value + b.value) * static_value
def setup_module(module): global smache, f, h DummyA.unsubscribe_all() DummyB.unsubscribe_all() DummyC.unsubscribe_all() smache = Smache(scheduler=InProcessScheduler(), write_through=False) @smache.relations((DummyB, lambda b: DummyC.find('30'))) @smache.computed(DummyA, DummyC, Raw, Raw) def f(a, dummyc, c, d): b = DummyB.find('2') return a.value * b.value @smache.relations((DummyB, lambda b: [DummyA.find('1'), DummyA.find('2')])) @smache.computed(DummyA, Raw, Raw) def h(a, c, d): b = DummyB.find('2') return a.value * b.value
def teardown_module(module): DummyA.unsubscribe_all() DummyB.unsubscribe_all() DummyC.unsubscribe_all()