From 5e1c2260e59c29776dd59c28b2a6c51a012c6ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20Kadir=20Alt=C4=B1nta=C5=9F?= <126012220+kdraltntas@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:27:58 +0300 Subject: [PATCH 1/4] Add awaitme decorator for asynchronous functions --- Week05/awaitme_recepkadir_altintas.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Week05/awaitme_recepkadir_altintas.py diff --git a/Week05/awaitme_recepkadir_altintas.py b/Week05/awaitme_recepkadir_altintas.py new file mode 100644 index 00000000..3419bd8a --- /dev/null +++ b/Week05/awaitme_recepkadir_altintas.py @@ -0,0 +1,5 @@ +def awaitme(func): + + async def wrapper(*args, **kwargs): + return func(*args, **kwargs) + return wrapper From 2aad3e313aee8d8c2edd0b57f0fe69241fc8de32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20Kadir=20Alt=C4=B1nta=C5=9F?= <126012220+kdraltntas@users.noreply.github.com> Date: Wed, 8 Apr 2026 02:42:16 +0300 Subject: [PATCH 2/4] Add Timer class for measuring execution time --- Week06/timer_recepkadir_altintas.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Week06/timer_recepkadir_altintas.py diff --git a/Week06/timer_recepkadir_altintas.py b/Week06/timer_recepkadir_altintas.py new file mode 100644 index 00000000..3d472d12 --- /dev/null +++ b/Week06/timer_recepkadir_altintas.py @@ -0,0 +1,10 @@ +import time + +class Timer: + def __enter__(self): + self.start_time = time.time() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.end_time = time.time() + From f92a2de677b83180593617d64c5bf8e83ad98800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20Kadir=20Alt=C4=B1nta=C5=9F?= <126012220+kdraltntas@users.noreply.github.com> Date: Wed, 8 Apr 2026 06:31:51 +0300 Subject: [PATCH 3/4] Refactor Timer class to use perf_counter for timing --- Week06/timer_recepkadir_altintas.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Week06/timer_recepkadir_altintas.py b/Week06/timer_recepkadir_altintas.py index 3d472d12..b9012b81 100644 --- a/Week06/timer_recepkadir_altintas.py +++ b/Week06/timer_recepkadir_altintas.py @@ -1,10 +1,15 @@ import time class Timer: + def __init__(self): + self.start_time = 0.0 + self.end_time = 0.0 + def __enter__(self): - self.start_time = time.time() - return self - + self.start_time = time.perf_counter() + + return self + def __exit__(self, exc_type, exc_val, exc_tb): - self.end_time = time.time() + self.end_time = time.perf_counter() From cfacb1595937858bbbb6137db6cce12d52e64447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Recep=20Kadir=20Alt=C4=B1nta=C5=9F?= <126012220+kdraltntas@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:45:33 +0300 Subject: [PATCH 4/4] Add threaded decorator for concurrent function execution --- Week07/threaded_recepkadir_altintas.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Week07/threaded_recepkadir_altintas.py diff --git a/Week07/threaded_recepkadir_altintas.py b/Week07/threaded_recepkadir_altintas.py new file mode 100644 index 00000000..ac8cafce --- /dev/null +++ b/Week07/threaded_recepkadir_altintas.py @@ -0,0 +1,20 @@ +import threading + +def threaded(n): + + def decorator(func): + def wrapper(*args, **kwargs): + threads = [] + + for i in range(n): + t = threading.Thread(target=func, args=args, kwargs=kwargs) + threads.append(t) + + for t in threads: + t.start() + + for t in threads: + t.join() + + return wrapper + return decorator