python-base-toolkit 1.0.4__py3-none-any.whl → 1.0.5__py3-none-any.whl

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.
@@ -9,27 +9,28 @@ logger = get_logger(__name__)
9
9
 
10
10
 
11
11
  class Timer:
12
- def __init__(self) -> None:
12
+ def __init__(self, name: str | None = None) -> None:
13
+ self.name = name
13
14
  self.start_time = None
14
15
  self.end_time = None
15
16
  self.elapsed_time = None
16
17
 
17
18
  def __enter__(self) -> "Timer":
18
19
  self.start_time = time.perf_counter()
19
- logger.info("Timer started.")
20
+ logger.info(f"Timer started for function: {self.name}")
20
21
  return self
21
22
 
22
23
  def __exit__(self, exc_type: type, exc_value: Exception, exc_traceback: object) -> None:
23
- # logger.info(exc_type, exc_value, exc_traceback)
24
24
  self.end_time = time.perf_counter()
25
25
  self.elapsed_time = self.end_time - self.start_time
26
- logger.info(f"Timer stopped. Elapsed time: {self.elapsed_time:.2f} seconds.")
26
+ logger.info(f"Timer stopped for function: {self.name}")
27
+ logger.info(f"Elapsed time for function: {self.name}: {self.elapsed_time}")
27
28
 
28
29
 
29
30
  def timer(func: Callable[..., Any]) -> Callable[..., Any]:
30
31
  @wraps(func)
31
32
  def wrapper(*args: Any, **kwargs: Any) -> Any:
32
- with Timer():
33
+ with Timer(func.__name__):
33
34
  return func(*args, **kwargs)
34
35
 
35
36
  return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-base-toolkit
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Author: Avi Zaguri
6
6
  License: MIT
@@ -17,7 +17,7 @@ python_base_toolkit/consts/units/binary_units.py,sha256=fgRAP6HXIis6OX4uK8woD-OV
17
17
  python_base_toolkit/consts/units/time_units.py,sha256=aDwRnRR_mbOn2B7NUB9b2-qO98CLFzNE8-ZKfwUZ09Q,216
18
18
  python_base_toolkit/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  python_base_toolkit/decorators/telemetry.py,sha256=XKQTYbTqt_3mLVyin5HY7ucgAyAs_hRX_qRd-d7zRJ4,1416
20
- python_base_toolkit/decorators/timer.py,sha256=MjfkM_aZ1gYG1mmG3Cos3sCM1QdWVyT2wEOEdFA-Uqs,1011
20
+ python_base_toolkit/decorators/timer.py,sha256=GBGiQOblRIw2rZWgWCuw1KtopMSjwCsmZPKmk00Ikgk,1104
21
21
  python_base_toolkit/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  python_base_toolkit/instances/instance_manager.py,sha256=iq72kcPlbc7-AQTuKcBOeqKZbC8vYcsU5GiFXvt5UMs,2278
23
23
  python_base_toolkit/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -36,8 +36,8 @@ python_base_toolkit/utils/pycache.py,sha256=X-pWRjAd2xcBtMkcyCuKz34SbHWc2leBHBIj
36
36
  python_base_toolkit/utils/random_utils.py,sha256=gTH6k1MKKGNZvBTLc5H-eSmtEGvXEdLqtzXN9aHuu-A,2730
37
37
  python_base_toolkit/utils/shorten_url.py,sha256=zsyW3wloFJdVb9s3fhR-olL6ekT03FDlFm2xbFY4viw,359
38
38
  python_base_toolkit/utils/venv_details.py,sha256=d1WlZr1LuWz2SXdFP0Hqh6VHXXXSIuXB0oTmWXJrGqM,210
39
- python_base_toolkit-1.0.4.dist-info/licenses/LICENSE,sha256=cSikHY6SZFsPZSBizCDAJ0-Bjjzxt-JtX6TVbKxwimo,1067
40
- python_base_toolkit-1.0.4.dist-info/METADATA,sha256=QeGBtXYyRqmknRQE6Fu6230qU6UWw5X-RF3jGkcgspU,2995
41
- python_base_toolkit-1.0.4.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
42
- python_base_toolkit-1.0.4.dist-info/top_level.txt,sha256=I9kK6FGKq_6z3aGySoWamY68GRgg0xsL6sS-uyaxJ2k,20
43
- python_base_toolkit-1.0.4.dist-info/RECORD,,
39
+ python_base_toolkit-1.0.5.dist-info/licenses/LICENSE,sha256=cSikHY6SZFsPZSBizCDAJ0-Bjjzxt-JtX6TVbKxwimo,1067
40
+ python_base_toolkit-1.0.5.dist-info/METADATA,sha256=MGXS17ubMpX6tpOKYnwLDxZOG0ylJFK_Ufq8Mn86LSQ,2995
41
+ python_base_toolkit-1.0.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
42
+ python_base_toolkit-1.0.5.dist-info/top_level.txt,sha256=I9kK6FGKq_6z3aGySoWamY68GRgg0xsL6sS-uyaxJ2k,20
43
+ python_base_toolkit-1.0.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.0)
2
+ Generator: setuptools (82.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5