diff --git a/Week05/awaitme_burak_ozturk.py b/Week05/awaitme_burak_ozturk.py new file mode 100644 index 00000000..fddfe1db --- /dev/null +++ b/Week05/awaitme_burak_ozturk.py @@ -0,0 +1,9 @@ +import asyncio + +def awaitme(func): + async def wrapped(*a, **kw): + if asyncio.iscoroutinefunction(func): + return await func(*a, **kw) + loop = asyncio.get_event_loop() + return await loop.run_in_executor(None, func, *a) + return wrapped