From 3ccb5d9154094b093cb8d4765a863edc7c696a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berra=20S=C3=96YLER?= <118564672+berriesyl@users.noreply.github.com> Date: Sat, 2 Nov 2024 14:06:44 +0300 Subject: [PATCH] Create awaitme_berra_soyler.py --- Week05/awaitme_berra_soyler.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Week05/awaitme_berra_soyler.py diff --git a/Week05/awaitme_berra_soyler.py b/Week05/awaitme_berra_soyler.py new file mode 100644 index 00000000..4a945f1a --- /dev/null +++ b/Week05/awaitme_berra_soyler.py @@ -0,0 +1,14 @@ +import asyncio +from functools import wraps + +def awaitme(func): + @wraps(func) + async def wrapper(*args, **kwargs): + result = func(*args, **kwargs) + + if asyncio.iscoroutine(result): + return await result + else: + return result + + return wrapper