Coverage for docs_src/tutorial/asyncify/tutorial001.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-11-11 11:00 +0000

1# 🚨 Don't use this, it will block the event loop! 🚨 

2 

3import time 1abcdefghijklm

4 

5import anyio 1abcdefghijklm

6 

7 

8def do_sync_work(name: str): 1abcdefghijklm

9 time.sleep(1) 1abcdefghijklm

10 return f"Hello, {name}" 1abcdefghijklm

11 

12 

13async def main(): 1abcdefghijklm

14 message = do_sync_work(name="World") 1abcdefghijklm

15 print(message) 1abcdefghijklm

16 

17 

18anyio.run(main) 1abcdefghijklm