Coverage for docs_src/tutorial/soonify/tutorial002.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 01:12 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 01:12 +0000
1import anyio 1abcde
2import asyncer 1abcde
5async def do_work(name: str): 1abcde
6 await anyio.sleep(1) 1abcde
7 print(f"Hello, {name}") 1abcde
10async def get_data(): 1abcde
11 async with asyncer.create_task_group() as task_group: 1abcde
12 task_group.soonify(do_work)(name="Yury") 1abcde
13 task_group.soonify(do_work)(name="Nathaniel") 1abcde
14 task_group.soonify(do_work)(name="Alex") 1abcde
17async def main(): 1abcde
18 await get_data() 1abcde
21anyio.run(main) 1abcde