From e725ca2854dd07e7d3416514f3b8ae8e63077dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BA=C5=9EAK=20KO=C3=87AN?= <159764779+mimo-o@users.noreply.github.com> Date: Tue, 24 Mar 2026 21:41:18 +0300 Subject: [PATCH] Create awaitme_basak_kocan.py Implement a decorator to handle both synchronous and asynchronous functions seamlessly. --- Week05/awaitme_basak_kocan.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Week05/awaitme_basak_kocan.py diff --git a/Week05/awaitme_basak_kocan.py b/Week05/awaitme_basak_kocan.py new file mode 100644 index 00000000..ba7726aa --- /dev/null +++ b/Week05/awaitme_basak_kocan.py @@ -0,0 +1,9 @@ +import asyncio + +def awaitme(fn): + async def wrapper(*args, **kwargs): + result = fn(*args, **kwargs) + if asyncio.iscoroutine(result): + return await result + return result + return wrapper