Skip to content

Commit f1f0c5c

Browse files
authored
Merge pull request #833 from burakozturk1/patch-5
Create awaitme_burak_ozturk.py
2 parents 2098e2a + a8f5516 commit f1f0c5c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: 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)