Update nest-asyncio/README.md

This commit is contained in:
2024-11-25 14:04:11 -05:00
parent 0d166b8ad0
commit 46ec9c1127

View File

@@ -1,5 +1,4 @@
```python ```python
''
import asyncio import asyncio
(loop := asyncio.get_event_loop()).__class__._check_running = lambda _: None (loop := asyncio.get_event_loop()).__class__._check_running = lambda _: None
def _run_once(self): def _run_once(self):
@@ -10,7 +9,7 @@ def _run_once(self):
tasks[self] = task tasks[self] = task
loop.__class__._run_once = _run_once loop.__class__._run_once = _run_once
asyncio.run = loop.run_until_complete asyncio.run = loop.run_until_complete
''
async def hello(): async def hello():
async def world(): print('hello') async def world(): print('hello')
asyncio.run(world()) or print('world') asyncio.run(world()) or print('world')