Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Chainlit_chainlit /cypress /e2e /context /main.py
| import chainlit as cl | |
| from chainlit.context import context | |
| from chainlit.sync import make_async, run_sync | |
| async def async_function_from_sync(): | |
| await cl.sleep(2) | |
| return context.emitter | |
| def sync_function(): | |
| emitter_from_make_async = context.emitter | |
| emitter_from_async_from_sync = run_sync(async_function_from_sync()) | |
| return (emitter_from_make_async, emitter_from_async_from_sync) | |
| async def async_function(): | |
| return await another_async_function() | |
| async def another_async_function(): | |
| await cl.sleep(2) | |
| return context.emitter | |
| async def main(): | |
| emitter_from_async = await async_function() | |
| if emitter_from_async: | |
| await cl.Message(content="emitter from async found!").send() | |
| else: | |
| await cl.ErrorMessage(content="emitter from async not found").send() | |
| emitter_from_make_async, emitter_from_async_from_sync = await make_async( | |
| sync_function | |
| )() | |
| if emitter_from_make_async: | |
| await cl.Message(content="emitter from make_async found!").send() | |
| else: | |
| await cl.ErrorMessage(content="emitter from make_async not found").send() | |
| if emitter_from_async_from_sync: | |
| await cl.Message(content="emitter from async_from_sync found!").send() | |
| else: | |
| await cl.ErrorMessage(content="emitter from async_from_sync not found").send() | |
Xet Storage Details
- Size:
- 1.35 kB
- Xet hash:
- 616db07db8529cc7e01c33f070f23f55517a9706d072242412b1d37479667a01
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.