Skip to content

Commit a8f5516

Browse files
authored
Create awaitme_burak_ozturk.py
1 parent fea20f7 commit a8f5516

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Week05/awaitme_burak_ozturk.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import asyncio
2+
3+
def awaitme(func):
4+
async def wrapped(*a, **kw):
5+
if asyncio.iscoroutinefunction(func):
6+
return await func(*a, **kw)
7+
loop = asyncio.get_event_loop()
8+
return await loop.run_in_executor(None, func, *a)
9+
return wrapped

0 commit comments

Comments
 (0)