winipedia-utils 0.1.12__py3-none-any.whl → 0.1.13__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.
@@ -15,7 +15,7 @@ from typing import Any, final
15
15
 
16
16
  from winipedia_utils.logging.logger import get_logger
17
17
  from winipedia_utils.modules.class_ import get_all_methods_from_cls
18
- from winipedia_utils.modules.function import is_func
18
+ from winipedia_utils.modules.function import is_func, unwrap_method
19
19
  from winipedia_utils.text.string import value_to_truncated_string
20
20
 
21
21
  logger = get_logger(__name__)
@@ -51,9 +51,20 @@ class LoggingMeta(type):
51
51
 
52
52
  for attr_name, attr_value in dct.items():
53
53
  if mcs.is_loggable_method(attr_value):
54
- dct[attr_name] = mcs.wrap_with_logging(
55
- func=attr_value, class_name=name, call_times={}
56
- )
54
+ if isinstance(attr_value, classmethod):
55
+ wrapped_method = mcs.wrap_with_logging(
56
+ func=attr_value.__func__, class_name=name, call_times={}
57
+ )
58
+ dct[attr_name] = classmethod(wrapped_method)
59
+ elif isinstance(attr_value, staticmethod):
60
+ wrapped_method = mcs.wrap_with_logging(
61
+ func=attr_value.__func__, class_name=name, call_times={}
62
+ )
63
+ dct[attr_name] = staticmethod(wrapped_method)
64
+ else:
65
+ dct[attr_name] = mcs.wrap_with_logging(
66
+ func=attr_value, class_name=name, call_times={}
67
+ )
57
68
 
58
69
  return super().__new__(mcs, name, bases, dct)
59
70
 
@@ -96,7 +107,7 @@ class LoggingMeta(type):
96
107
  time_time = time.time # Cache the time.time function for performance
97
108
 
98
109
  @wraps(func)
99
- def wrapper(self: object, *args: object, **kwargs: object) -> object:
110
+ def wrapper(*args: object, **kwargs: object) -> object:
100
111
  # call_times as a dictionary to store the call times of the function
101
112
  # we only log if the time since the last call is greater than the threshold
102
113
  # this is to avoid spamming the logs
@@ -132,7 +143,7 @@ class LoggingMeta(type):
132
143
 
133
144
  # Execute the function and return the result
134
145
 
135
- result = func(self, *args, **kwargs)
146
+ result = func(*args, **kwargs)
136
147
 
137
148
  if do_logging:
138
149
  duration = time_time() - current_time
@@ -249,7 +260,10 @@ class ImplementationMeta(type):
249
260
  True if the method is marked with @final, False otherwise
250
261
 
251
262
  """
252
- return getattr(method, "__final__", False)
263
+ unwrapped_method = unwrap_method(method)
264
+ return getattr(method, "__final__", False) or getattr(
265
+ unwrapped_method, "__final__", False
266
+ )
253
267
 
254
268
  @staticmethod
255
269
  def is_abstract_method(method: Callable[..., Any]) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: winipedia-utils
3
- Version: 0.1.12
3
+ Version: 0.1.13
4
4
  Summary: A package with many utility functions
5
5
  License: MIT
6
6
  Author: Winipedia
@@ -30,7 +30,7 @@ winipedia_utils/modules/module.py,sha256=mxaAsRl02CAq_bTW2HsmzRWoyC9jKNM8Q4xdgdQ
30
30
  winipedia_utils/modules/package.py,sha256=kCm4pXQdllafo-2dmWZTvaAqRruzh3iF4hseHlCmTlU,12605
31
31
  winipedia_utils/oop/__init__.py,sha256=wGjsVwLbTVEQWOfDJvN9nlvC-3NmAi8Doc2xIrm6e78,47
32
32
  winipedia_utils/oop/mixins/__init__.py,sha256=PDK-cJcdRUfDUCz36qQ5pmMW07G133WtN49OpmILGNI,54
33
- winipedia_utils/oop/mixins/meta.py,sha256=UpHags1j80OABxW4Q3QYt7A7lLIArvgUrGcWeYJaRyU,10576
33
+ winipedia_utils/oop/mixins/meta.py,sha256=ngV8vdAC5xayWKqrpJ0AhxAXQvm89uzre3aJL03waO0,11311
34
34
  winipedia_utils/oop/mixins/mixin.py,sha256=GuYdeueiOIHoRi9ds2ztxUcLnrcsBhHAsbrO43N9AGg,1170
35
35
  winipedia_utils/os/__init__.py,sha256=WSLt7tb6HqWRlCGGIEwRfVksF0sLJNeEW3iZeJhGWk0,47
36
36
  winipedia_utils/os/os.py,sha256=ITuiLLfjGBV2jH8tHQfwVzsICT-jY1zUxtwu3ASJBG4,1690
@@ -61,7 +61,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=dUPDrgAxlfREQb33zz23Mfz
61
61
  winipedia_utils/testing/tests/conftest.py,sha256=8RounBlI8Jq1aLaLNpv84MW4ne8Qq0aavQextDOp5ng,920
62
62
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
63
63
  winipedia_utils/text/string.py,sha256=1jbBftlgxffGgSlPnQh3aRPIr8XekEwpSenjFCW6JyM,3478
64
- winipedia_utils-0.1.12.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
- winipedia_utils-0.1.12.dist-info/METADATA,sha256=u2sgf1gcfep7whVI1VvB9GMrkXyvX2rNl_FxzxIQ5Zs,12385
66
- winipedia_utils-0.1.12.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
- winipedia_utils-0.1.12.dist-info/RECORD,,
64
+ winipedia_utils-0.1.13.dist-info/LICENSE,sha256=3PrKJ2CWNrnyyHaC_r0wPDSukVWgmjOxHr__eQVH7cw,1087
65
+ winipedia_utils-0.1.13.dist-info/METADATA,sha256=064AzomkJ4xYdn6si8-SJa7LTgiJD6VqO9g2aSGqdf8,12385
66
+ winipedia_utils-0.1.13.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
67
+ winipedia_utils-0.1.13.dist-info/RECORD,,