From 676e256e1f9bf8186ec6d9cad71eadd25f3257c4 Mon Sep 17 00:00:00 2001 From: jay817 Date: Mon, 25 Nov 2024 14:34:27 -0500 Subject: [PATCH] Update nest-asyncio/README.md --- nest-asyncio/README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/nest-asyncio/README.md b/nest-asyncio/README.md index b2a4b3d..93343c5 100644 --- a/nest-asyncio/README.md +++ b/nest-asyncio/README.md @@ -1,19 +1,17 @@ ```python import asyncio -(loop := asyncio.get_event_loop()).__class__._check_running = lambda _: None def _run_once(loop): loop._process_events(loop._selector.select(0)) - if (ready := loop._ready) and not (handle := ready.popleft())._cancelled: + if (ready := loop._ready) and (handle := ready.popleft())._cancelled is False: task = (tasks := asyncio.tasks._current_tasks).pop(loop, None) - handle._run() - tasks[loop] = task -loop.__class__._run_once = _run_once -asyncio.run = loop.run_until_complete - + handle._run(); tasks[loop] = task +(loop := asyncio.get_event_loop()).__class__._run_once = _run_once +loop.__class__._check_running = lambda _: 0; asyncio.run = loop.run_until_complete async def hello(): print('hello') - async def world(): print('world') + async def world(): + print('world') asyncio.run(world()) asyncio.run(hello()) """