async def test(): g = gully.Gully() observer = g.watch(watch) await g.push(1) observer.disable() await g.push(2) observer.enable() await g.push(3)
async def test(): g = gully.Gully() for _ in range(100_000): async def watch(item): nonlocal c c += 1 g.watch(watch)
async def test(): g = gully.Gully() g.add_mapping(lambda item: item % 2 == 0) for i in range(1, 4): await g.push(i) return g.history
async def test(): g = gully.Gully() g.add_filter(lambda item: item % 3 == 0, lambda item: item % 5 == 0) for i in range(1, 16): await g.push(i) return g.history
async def test(): g = gully.Gully() g.add_mapping(lambda item: item % 2 == 0, lambda item: "Even" if item else "Odd") for i in range(1, 4): await g.push(i) return g.history
async def test(): g1 = gully.Gully(filters=[lambda item: item % 3 == 0]) g2 = g1.map( lambda item: item % 2 == 0, lambda item: "Even" if item else "Odd", ) for i in range(1, 10): await g1.push(i) await NoOp return g1.history, g2.history
async def test(): g = gully.Gully() g.watch(watch) for i in range(100_000): await g.push(i)
async def test(): g = gully.Gully() g.watch(watch) await g.push("testing") await g.push("foobar")
async def test(): g1 = gully.Gully() g2 = gully.Gully(g1) g2.watch(watch) await g1.push(1) await NoOp