cachetools 7.1.0__tar.gz → 7.1.2__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.
- {cachetools-7.1.0 → cachetools-7.1.2}/CHANGELOG.rst +16 -0
- {cachetools-7.1.0/src/cachetools.egg-info → cachetools-7.1.2}/PKG-INFO +1 -10
- {cachetools-7.1.0 → cachetools-7.1.2}/README.rst +0 -9
- {cachetools-7.1.0 → cachetools-7.1.2}/docs/index.rst +4 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/pyproject.toml +1 -10
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/__init__.py +1 -1
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/__init__.pyi +51 -19
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/func.py +0 -1
- {cachetools-7.1.0 → cachetools-7.1.2/src/cachetools.egg-info}/PKG-INFO +1 -10
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools.egg-info/SOURCES.txt +0 -1
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/__init__.py +1 -1
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_cached.py +0 -1
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_cachedmethod.py +0 -3
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_threading.py +0 -1
- {cachetools-7.1.0 → cachetools-7.1.2}/tox.ini +11 -15
- cachetools-7.1.0/MANIFEST.in +0 -11
- {cachetools-7.1.0 → cachetools-7.1.2}/LICENSE +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/docs/conf.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/setup.cfg +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/_cached.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/_cachedmethod.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/func.pyi +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/keys.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/keys.pyi +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools/py.typed +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools.egg-info/dependency_links.txt +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/src/cachetools.egg-info/top_level.txt +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_cache.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_classmethod.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_fifo.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_func.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_keys.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_lfu.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_lru.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_rr.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_tlru.py +0 -0
- {cachetools-7.1.0 → cachetools-7.1.2}/tests/test_ttl.py +0 -0
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
v7.1.2 (2026-05-16)
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
- Minor type stub improvements.
|
|
5
|
+
|
|
6
|
+
- Minor documentation improvements.
|
|
7
|
+
|
|
8
|
+
- Modernize build environment.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
v7.1.1 (2026-05-03)
|
|
12
|
+
===================
|
|
13
|
+
|
|
14
|
+
- Various type stub improvements.
|
|
15
|
+
|
|
16
|
+
|
|
1
17
|
v7.1.0 (2026-05-01)
|
|
2
18
|
===================
|
|
3
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cachetools
|
|
3
|
-
Version: 7.1.
|
|
3
|
+
Version: 7.1.2
|
|
4
4
|
Summary: Extensible memoizing collections and decorators
|
|
5
5
|
Author-email: Thomas Kemmer <tkemmer@computer.org>
|
|
6
6
|
Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
|
|
@@ -46,19 +46,10 @@ cachetools
|
|
|
46
46
|
:target: https://codecov.io/gh/tkem/cachetools
|
|
47
47
|
:alt: Test coverage
|
|
48
48
|
|
|
49
|
-
.. image:: https://img.shields.io/librariesio/sourcerank/pypi/cachetools
|
|
50
|
-
:target: https://libraries.io/pypi/cachetools
|
|
51
|
-
:alt: Libraries.io SourceRank
|
|
52
|
-
|
|
53
49
|
.. image:: https://img.shields.io/github/license/tkem/cachetools
|
|
54
50
|
:target: https://raw.github.com/tkem/cachetools/master/LICENSE
|
|
55
51
|
:alt: License
|
|
56
52
|
|
|
57
|
-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
|
58
|
-
:target: https://github.com/psf/black
|
|
59
|
-
:alt: Code style: black
|
|
60
|
-
|
|
61
|
-
|
|
62
53
|
This module provides various memoizing collections and decorators,
|
|
63
54
|
including variants of the Python Standard Library's `@lru_cache`_
|
|
64
55
|
function decorator.
|
|
@@ -17,19 +17,10 @@ cachetools
|
|
|
17
17
|
:target: https://codecov.io/gh/tkem/cachetools
|
|
18
18
|
:alt: Test coverage
|
|
19
19
|
|
|
20
|
-
.. image:: https://img.shields.io/librariesio/sourcerank/pypi/cachetools
|
|
21
|
-
:target: https://libraries.io/pypi/cachetools
|
|
22
|
-
:alt: Libraries.io SourceRank
|
|
23
|
-
|
|
24
20
|
.. image:: https://img.shields.io/github/license/tkem/cachetools
|
|
25
21
|
:target: https://raw.github.com/tkem/cachetools/master/LICENSE
|
|
26
22
|
:alt: License
|
|
27
23
|
|
|
28
|
-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
|
29
|
-
:target: https://github.com/psf/black
|
|
30
|
-
:alt: Code style: black
|
|
31
|
-
|
|
32
|
-
|
|
33
24
|
This module provides various memoizing collections and decorators,
|
|
34
25
|
including variants of the Python Standard Library's `@lru_cache`_
|
|
35
26
|
function decorator.
|
|
@@ -88,6 +88,10 @@ inserted into the cache.
|
|
|
88
88
|
This class evicts items in the order they were added to make space
|
|
89
89
|
when necessary.
|
|
90
90
|
|
|
91
|
+
Updating a cache item via :meth:`FIFOCache.__setitem__` will act
|
|
92
|
+
like a re-insertion, i.e. deleting the item followed by an insert,
|
|
93
|
+
and therefore will reset the item's position in the cache.
|
|
94
|
+
|
|
91
95
|
.. autoclass:: LFUCache(maxsize, getsizeof=None)
|
|
92
96
|
:members: popitem
|
|
93
97
|
|
|
@@ -47,17 +47,8 @@ where = ["src"]
|
|
|
47
47
|
[tool.setuptools.dynamic]
|
|
48
48
|
version = {attr = "cachetools.__version__"}
|
|
49
49
|
|
|
50
|
-
[tool.flake8]
|
|
51
|
-
max-line-length = 80
|
|
52
|
-
exclude = [".git", ".tox", "build"]
|
|
53
|
-
select = ["C", "E", "F", "W", "B", "B950", "I", "N"]
|
|
54
|
-
# F401: imported but unused (submodule shims)
|
|
55
|
-
# E501: line too long (black)
|
|
56
|
-
# E704: multiple statements on one line (typehints)
|
|
57
|
-
ignore = ["F401", "E501", "E704"]
|
|
58
|
-
|
|
59
50
|
[tool.pyright]
|
|
60
51
|
typeCheckingMode = "standard"
|
|
61
52
|
reportFunctionMemberAccess = false
|
|
62
53
|
reportOptionalContextManager = false
|
|
63
|
-
reportOptionalMemberAccess = false
|
|
54
|
+
reportOptionalMemberAccess = false
|
|
@@ -3,10 +3,12 @@ from collections.abc import Callable, Iterator, MutableMapping, Sequence
|
|
|
3
3
|
from contextlib import AbstractContextManager
|
|
4
4
|
from typing import (
|
|
5
5
|
Any,
|
|
6
|
+
Concatenate,
|
|
6
7
|
Final,
|
|
7
8
|
Generic,
|
|
8
9
|
Literal,
|
|
9
10
|
NamedTuple,
|
|
11
|
+
ParamSpec,
|
|
10
12
|
Protocol,
|
|
11
13
|
TypeVar,
|
|
12
14
|
overload,
|
|
@@ -26,11 +28,12 @@ __all__: Final = (
|
|
|
26
28
|
)
|
|
27
29
|
__version__: str
|
|
28
30
|
|
|
31
|
+
_P = ParamSpec("_P")
|
|
32
|
+
_R = TypeVar("_R")
|
|
33
|
+
_T = TypeVar("_T")
|
|
29
34
|
_KT = TypeVar("_KT")
|
|
30
35
|
_VT = TypeVar("_VT")
|
|
31
36
|
_TT = TypeVar("_TT", default=float)
|
|
32
|
-
_T = TypeVar("_T")
|
|
33
|
-
_R = TypeVar("_R")
|
|
34
37
|
_KT2 = TypeVar("_KT2")
|
|
35
38
|
_VT2 = TypeVar("_VT2")
|
|
36
39
|
|
|
@@ -147,19 +150,19 @@ class _AbstractCondition(AbstractContextManager[Any], Protocol):
|
|
|
147
150
|
def notify_all(self) -> None: ...
|
|
148
151
|
|
|
149
152
|
@type_check_only
|
|
150
|
-
class _cached_wrapper(Generic[_R]):
|
|
151
|
-
__wrapped__: Callable[
|
|
153
|
+
class _cached_wrapper(Generic[_P, _R]):
|
|
154
|
+
__wrapped__: Callable[_P, _R]
|
|
152
155
|
__name__: str
|
|
153
156
|
__doc__: str | None
|
|
154
157
|
cache: MutableMapping[Any, Any] | None
|
|
155
158
|
cache_key: Callable[..., Any] = ...
|
|
156
159
|
cache_lock: AbstractContextManager[Any] | None = None
|
|
157
160
|
cache_condition: _AbstractCondition | None = None
|
|
158
|
-
def __call__(self, /, *args:
|
|
161
|
+
def __call__(self, /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
|
|
159
162
|
def cache_clear(self) -> None: ...
|
|
160
163
|
|
|
161
164
|
@type_check_only
|
|
162
|
-
class _cached_wrapper_info(_cached_wrapper[_R]):
|
|
165
|
+
class _cached_wrapper_info(_cached_wrapper[_P, _R]):
|
|
163
166
|
def cache_info(self) -> _CacheInfo: ...
|
|
164
167
|
|
|
165
168
|
@overload
|
|
@@ -168,31 +171,47 @@ def cached(
|
|
|
168
171
|
key: Callable[..., _KT] = ...,
|
|
169
172
|
lock: AbstractContextManager[Any] | None = None,
|
|
170
173
|
condition: _AbstractCondition | None = None,
|
|
171
|
-
info: Literal[
|
|
172
|
-
) -> Callable[[Callable[
|
|
174
|
+
info: Literal[False] = ...,
|
|
175
|
+
) -> Callable[[Callable[_P, _R]], _cached_wrapper[_P, _R]]: ...
|
|
173
176
|
@overload
|
|
174
177
|
def cached(
|
|
175
178
|
cache: MutableMapping[_KT, Any] | None,
|
|
176
179
|
key: Callable[..., _KT] = ...,
|
|
177
180
|
lock: AbstractContextManager[Any] | None = None,
|
|
178
181
|
condition: _AbstractCondition | None = None,
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
*,
|
|
183
|
+
info: Literal[True],
|
|
184
|
+
) -> Callable[[Callable[_P, _R]], _cached_wrapper_info[_P, _R]]: ...
|
|
185
|
+
@overload
|
|
186
|
+
def cached(
|
|
187
|
+
cache: MutableMapping[_KT, Any] | None,
|
|
188
|
+
key: Callable[..., _KT],
|
|
189
|
+
lock: AbstractContextManager[Any] | None,
|
|
190
|
+
condition: _AbstractCondition | None,
|
|
191
|
+
info: Literal[True],
|
|
192
|
+
) -> Callable[[Callable[_P, _R]], _cached_wrapper_info[_P, _R]]: ...
|
|
181
193
|
|
|
182
194
|
@type_check_only
|
|
183
|
-
class _cachedmethod_wrapper(Generic[_R]):
|
|
184
|
-
__wrapped__: Callable[
|
|
195
|
+
class _cachedmethod_wrapper(Generic[_P, _R]):
|
|
196
|
+
__wrapped__: Callable[Concatenate[Any, _P], _R]
|
|
185
197
|
__name__: str
|
|
186
198
|
__doc__: str | None
|
|
187
|
-
cache: MutableMapping[Any, Any]
|
|
199
|
+
cache: MutableMapping[Any, Any]
|
|
188
200
|
cache_key: Callable[..., Any] = ...
|
|
189
201
|
cache_lock: AbstractContextManager[Any] | None = None
|
|
190
202
|
cache_condition: _AbstractCondition | None = None
|
|
191
|
-
def
|
|
203
|
+
def __set_name__(self, owner: type, name: str) -> None: ...
|
|
204
|
+
def __get__(
|
|
205
|
+
self, obj: Any, objtype: type | None = None
|
|
206
|
+
) -> _cachedmethod_wrapper[_P, _R]: ...
|
|
207
|
+
def __call__(self, /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
|
|
192
208
|
def cache_clear(self) -> None: ...
|
|
193
209
|
|
|
194
210
|
@type_check_only
|
|
195
|
-
class _cachedmethod_wrapper_info(_cachedmethod_wrapper[_R]):
|
|
211
|
+
class _cachedmethod_wrapper_info(_cachedmethod_wrapper[_P, _R]):
|
|
212
|
+
def __get__(
|
|
213
|
+
self, obj: Any, objtype: type | None = None
|
|
214
|
+
) -> _cachedmethod_wrapper_info[_P, _R]: ...
|
|
196
215
|
def cache_info(self) -> _CacheInfo: ...
|
|
197
216
|
|
|
198
217
|
@overload
|
|
@@ -201,13 +220,26 @@ def cachedmethod(
|
|
|
201
220
|
key: Callable[..., _KT] = ...,
|
|
202
221
|
lock: Callable[[Any], AbstractContextManager[Any]] | None = None,
|
|
203
222
|
condition: Callable[[Any], _AbstractCondition] | None = None,
|
|
204
|
-
info: Literal[
|
|
205
|
-
) -> Callable[[Callable[
|
|
223
|
+
info: Literal[False] = ...,
|
|
224
|
+
) -> Callable[[Callable[Concatenate[Any, _P], _R]], _cachedmethod_wrapper[_P, _R]]: ...
|
|
206
225
|
@overload
|
|
207
226
|
def cachedmethod(
|
|
208
227
|
cache: Callable[[Any], MutableMapping[_KT, Any]],
|
|
209
228
|
key: Callable[..., _KT] = ...,
|
|
210
229
|
lock: Callable[[Any], AbstractContextManager[Any]] | None = None,
|
|
211
230
|
condition: Callable[[Any], _AbstractCondition] | None = None,
|
|
212
|
-
|
|
213
|
-
|
|
231
|
+
*,
|
|
232
|
+
info: Literal[True],
|
|
233
|
+
) -> Callable[
|
|
234
|
+
[Callable[Concatenate[Any, _P], _R]], _cachedmethod_wrapper_info[_P, _R]
|
|
235
|
+
]: ...
|
|
236
|
+
@overload
|
|
237
|
+
def cachedmethod(
|
|
238
|
+
cache: Callable[[Any], MutableMapping[_KT, Any]],
|
|
239
|
+
key: Callable[..., _KT],
|
|
240
|
+
lock: Callable[[Any], AbstractContextManager[Any]] | None,
|
|
241
|
+
condition: Callable[[Any], _AbstractCondition] | None,
|
|
242
|
+
info: Literal[True],
|
|
243
|
+
) -> Callable[
|
|
244
|
+
[Callable[Concatenate[Any, _P], _R]], _cachedmethod_wrapper_info[_P, _R]
|
|
245
|
+
]: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cachetools
|
|
3
|
-
Version: 7.1.
|
|
3
|
+
Version: 7.1.2
|
|
4
4
|
Summary: Extensible memoizing collections and decorators
|
|
5
5
|
Author-email: Thomas Kemmer <tkemmer@computer.org>
|
|
6
6
|
Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
|
|
@@ -46,19 +46,10 @@ cachetools
|
|
|
46
46
|
:target: https://codecov.io/gh/tkem/cachetools
|
|
47
47
|
:alt: Test coverage
|
|
48
48
|
|
|
49
|
-
.. image:: https://img.shields.io/librariesio/sourcerank/pypi/cachetools
|
|
50
|
-
:target: https://libraries.io/pypi/cachetools
|
|
51
|
-
:alt: Libraries.io SourceRank
|
|
52
|
-
|
|
53
49
|
.. image:: https://img.shields.io/github/license/tkem/cachetools
|
|
54
50
|
:target: https://raw.github.com/tkem/cachetools/master/LICENSE
|
|
55
51
|
:alt: License
|
|
56
52
|
|
|
57
|
-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
|
58
|
-
:target: https://github.com/psf/black
|
|
59
|
-
:alt: Code style: black
|
|
60
|
-
|
|
61
|
-
|
|
62
53
|
This module provides various memoizing collections and decorators,
|
|
63
54
|
including variants of the Python Standard Library's `@lru_cache`_
|
|
64
55
|
function decorator.
|
|
@@ -517,7 +517,6 @@ class MethodDecoratorTestMixin(_TestCaseProtocol):
|
|
|
517
517
|
|
|
518
518
|
|
|
519
519
|
class CacheMethodTest(unittest.TestCase, MethodDecoratorTestMixin):
|
|
520
|
-
|
|
521
520
|
def cache(self, minsize, **kwargs):
|
|
522
521
|
return Cache(maxsize=minsize, **kwargs)
|
|
523
522
|
|
|
@@ -636,13 +635,11 @@ class CacheMethodTest(unittest.TestCase, MethodDecoratorTestMixin):
|
|
|
636
635
|
|
|
637
636
|
|
|
638
637
|
class DictMethodTest(unittest.TestCase, MethodDecoratorTestMixin):
|
|
639
|
-
|
|
640
638
|
def cache(self, minsize, **_kwargs):
|
|
641
639
|
return dict()
|
|
642
640
|
|
|
643
641
|
|
|
644
642
|
class WeakRefMethodTest(unittest.TestCase):
|
|
645
|
-
|
|
646
643
|
def test_weakref(self):
|
|
647
644
|
import fractions
|
|
648
645
|
import gc
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[tox]
|
|
2
|
-
envlist =
|
|
2
|
+
envlist = docs,doctest,format,lint,py,pyright
|
|
3
3
|
|
|
4
4
|
[testenv]
|
|
5
5
|
deps =
|
|
@@ -10,13 +10,6 @@ setenv =
|
|
|
10
10
|
commands =
|
|
11
11
|
py.test --basetemp={envtmpdir} --cov=cachetools --cov-report term-missing {posargs}
|
|
12
12
|
|
|
13
|
-
[testenv:check-manifest]
|
|
14
|
-
deps =
|
|
15
|
-
check-manifest
|
|
16
|
-
commands =
|
|
17
|
-
check-manifest
|
|
18
|
-
skip_install = true
|
|
19
|
-
|
|
20
13
|
[testenv:docs]
|
|
21
14
|
deps =
|
|
22
15
|
sphinx
|
|
@@ -29,15 +22,18 @@ deps =
|
|
|
29
22
|
commands =
|
|
30
23
|
sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs {envtmpdir}/doctest
|
|
31
24
|
|
|
32
|
-
[testenv:
|
|
25
|
+
[testenv:format]
|
|
26
|
+
deps =
|
|
27
|
+
ruff
|
|
28
|
+
commands =
|
|
29
|
+
ruff format --diff -q {posargs}
|
|
30
|
+
skip_install = true
|
|
31
|
+
|
|
32
|
+
[testenv:lint]
|
|
33
33
|
deps =
|
|
34
|
-
|
|
35
|
-
flake8-black
|
|
36
|
-
flake8-bugbear
|
|
37
|
-
flake8-import-order
|
|
38
|
-
flake8-pyproject
|
|
34
|
+
ruff
|
|
39
35
|
commands =
|
|
40
|
-
|
|
36
|
+
ruff check {posargs}
|
|
41
37
|
skip_install = true
|
|
42
38
|
|
|
43
39
|
[testenv:pyright]
|
cachetools-7.1.0/MANIFEST.in
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|