brilliant-learn-python 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: brilliant-learn-python
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Add your description here
5
5
  Author: Oliver Tautz
6
6
  Author-email: Oliver Tautz <oliver_tautz@yahoo.de>
@@ -4,7 +4,7 @@ description = "Add your description here"
4
4
  name = "brilliant-learn-python"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
7
- version = "0.1.7"
7
+ version = "0.1.9"
8
8
 
9
9
  [[project.authors]]
10
10
  name = "Oliver Tautz"
@@ -7,7 +7,7 @@ description = "Add your description here"
7
7
  name = "brilliant-learn-python"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.14"
10
- version = "0.1.7"
10
+ version = "0.1.9"
11
11
 
12
12
  [build-system]
13
13
  build-backend = "uv_build"
@@ -1,6 +1,7 @@
1
1
  """Decorator for measuring function execution time."""
2
2
 
3
3
  from collections.abc import Callable
4
+ from functools import wraps
4
5
  from typing import Any
5
6
 
6
7
  from brilliant_learn_python.context_managers.timer import Timer
@@ -9,12 +10,13 @@ from brilliant_learn_python.context_managers.timer import Timer
9
10
  def timer(func: Callable[..., Any]) -> Callable[..., Any]:
10
11
  """Measure the execution time of a function."""
11
12
 
13
+ @wraps(func)
12
14
  def wrapper(*args: Any, **kwargs: Any) -> Any:
13
15
  """Execute the wrapped function and measure its duration."""
14
16
 
15
- with Timer() as timer:
17
+ with Timer() as t:
16
18
  result = func(*args, **kwargs)
17
- print(f"func {func.__name__} ran for {timer.get_elapsed()}")
19
+ print(f"func {func.__name__} ran for {t.get_elapsed()}")
18
20
 
19
21
  return result
20
22
 
@@ -0,0 +1,15 @@
1
+ class Countdown:
2
+ def __init__(self, start: int):
3
+ self.current = start
4
+ pass
5
+
6
+ def __iter__(self):
7
+ return self
8
+
9
+ def __next__(self) -> int:
10
+
11
+ if self.current <= 0:
12
+ raise StopIteration
13
+ else:
14
+ self.current -= 1
15
+ return self.current + 1