py-cachify 2.0.8__tar.gz → 2.0.10__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.1
2
2
  Name: py-cachify
3
- Version: 2.0.8
3
+ Version: 2.0.10
4
4
  Summary: Distributed locks, caching, and locking decorators at hand
5
5
  Home-page: https://github.com/EzyGang/py-cachify
6
6
  License: MIT
@@ -14,15 +14,18 @@ _S = TypeVar('_S')
14
14
 
15
15
 
16
16
  def get_full_key_from_signature(bound_args: inspect.BoundArguments, key: str) -> str:
17
+ bound_args.apply_defaults()
18
+ _args_repr = f'{bound_args}'
19
+
17
20
  args_dict = bound_args.arguments
18
- args: Tuple[str, Any] = args_dict.pop('args', ())
21
+ args: Tuple[Any, ...] = args_dict.pop('args', ())
19
22
  kwargs: Dict[str, Any] = args_dict.pop('kwargs', {})
20
23
  kwargs.update(args_dict)
21
24
 
22
25
  try:
23
26
  return key.format(*args, **kwargs)
24
- except IndexError:
25
- raise ValueError('Arguments in a key do not match function signature') from None
27
+ except (IndexError, KeyError):
28
+ raise ValueError(f'Arguments in a key({key}) do not match function signature params({_args_repr})') from None
26
29
 
27
30
 
28
31
  def is_coroutine(
@@ -5,7 +5,7 @@ from asyncio import sleep as asleep
5
5
  from functools import partial, wraps
6
6
  from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, TypeVar, Union, cast
7
7
 
8
- from typing_extensions import ParamSpec, Self, deprecated, overload, override
8
+ from typing_extensions import ParamSpec, Self, deprecated, final, overload, override
9
9
 
10
10
  from ._exceptions import CachifyLockError
11
11
  from ._helpers import a_reset, get_full_key_from_signature, is_alocked, is_coroutine, is_locked, reset
@@ -93,6 +93,7 @@ class SyncLockMethods(LockProtocolBase):
93
93
  self.release()
94
94
 
95
95
 
96
+ @final
96
97
  class lock(AsyncLockMethods, SyncLockMethods):
97
98
  """
98
99
  Class to manage locking mechanism for synchronous and asynchronous functions.
@@ -210,7 +211,7 @@ class lock(AsyncLockMethods, SyncLockMethods):
210
211
  msg = f'{key} is already locked!'
211
212
 
212
213
  if do_log:
213
- logger.warning(msg)
214
+ logger.debug(msg)
214
215
 
215
216
  if do_raise:
216
217
  raise CachifyLockError(msg)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "py-cachify"
3
- version = "2.0.8"
3
+ version = "2.0.10"
4
4
  homepage = "https://github.com/EzyGang/py-cachify"
5
5
  repository = "https://github.com/EzyGang/py-cachify"
6
6
  license = "MIT"
@@ -50,7 +50,7 @@ mypy = "^1.11.1"
50
50
  coverage = "^7.6.1"
51
51
  pytest-asyncio = "^0.24.0"
52
52
  pytest-socket = "^0.7.0"
53
- ruff = ">=0.7.1,<0.9.0"
53
+ ruff = "^0.9.2"
54
54
 
55
55
 
56
56
  [tool.poetry.group.docs.dependencies]
File without changes
File without changes