We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ccfcf07 + fbb1483 commit e84703fCopy full SHA for e84703f
Week05/awaitme_ege_enc.py
@@ -0,0 +1,16 @@
1
+import asyncio
2
+
3
+def awaitme(func):
4
+ """
5
+ This function waits if it receives an async function, otherwise it just calls the function.
6
+ :param func: The function to be called.
7
8
+ async def await_case(*args, **kwargs):
9
+ result = func(*args, **kwargs)
10
11
+ if asyncio.iscoroutine(result):
12
+ return await result
13
+ else:
14
+ return result
15
16
+ return await_case
0 commit comments