Skip to content

Commit e4aa09e

Browse files
author
Fabien Coelho
committed
rst to md a few things to test doc generation
1 parent 4483ebe commit e4aa09e

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

CacheToolsUtils.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
class _MutMapMix:
31-
"""Convenient MutableMapping Mixin, forward to _cache."""
31+
"""Convenient MutableMapping Mixin, forward to `_cache`."""
3232

3333
# FIXME coverage reports this as missing with Python 3.14
3434
_cache: MutableMapping # pragma: no cover
@@ -53,7 +53,7 @@ def __iter__(self):
5353

5454

5555
class _KeyMutMapMix(_MutMapMix):
56-
"""Convenient MutableMapping Mixin with a key filter, forward to _cache."""
56+
"""Convenient MutableMapping Mixin with a key filter, forward to `_cache`."""
5757

5858
@abc.abstractmethod
5959
def _key(self, key: Any) -> Any: # pragma: no cover
@@ -73,7 +73,7 @@ def __delitem__(self, key: Any):
7373

7474

7575
class _StatsMix:
76-
"""Convenient Mixin to forward stats methods to _cache."""
76+
"""Convenient Mixin to forward stats methods to `_cache`."""
7777

7878
def hits(self) -> float|None:
7979
return self._cache.hits() # type: ignore
@@ -114,9 +114,11 @@ def dbsize(self, *args, **kwargs):
114114
class DebugCache(_StatsMix, MutableMapping):
115115
"""Debug class.
116116
117-
:param cache: actual cache
118-
:param log: logging instance
119-
:param name: name of instance for output
117+
Parameters:
118+
119+
- cache: actual cache
120+
- log: logging instance
121+
- name: name of instance for output
120122
"""
121123

122124
def __init__(self, cache: MutableMapping, log: logging.Logger, name="cache"):
@@ -162,7 +164,7 @@ def reset(self): # pragma: no cover
162164

163165

164166
class DictCache(_MutMapMix, MutableMapping):
165-
"""Cache class based on dict."""
167+
"""Cache class based on `dict`."""
166168

167169
def __init__(self):
168170
self._cache = dict()
@@ -174,17 +176,19 @@ def clear(self):
174176
class LockedCache(_MutMapMix, _StatsMix, _RedisMix, MutableMapping):
175177
"""Cache class with a lock.
176178
177-
:param cache: actual cache.
178-
:param lock: lock (context manager) to use
179+
Parameters:
179180
180-
The locked layer should be the last one before the actual cache.
181+
- cache: actual cache.
182+
- lock: lock (context manager) to use
181183
182-
.. code-block: python
184+
The locked layer should be the last one before the actual cache.
183185
184-
import threading
185-
import cachetools as ct
186-
import CacheToolsUtils as ctu
187-
cache = ctu.LockedCache(ct.LFUCache(), threading.RLock())
186+
```python
187+
import threading
188+
import cachetools as ct
189+
import CacheToolsUtils as ctu
190+
cache = ctu.LockedCache(ct.LFUCache(), threading.RLock())
191+
```
188192
"""
189193

190194
def __init__(self, cache: MutableMapping, lock):

0 commit comments

Comments
 (0)