Skip to content

Commit d2e9232

Browse files
committed
docs: improve type hinting and update documentation dependencies
- Add sphinx_autodoc_typehints extension to enable type hinting in docs - Update autodoc_typehints setting to "both" for more comprehensive type information - Install sphinx-autodoc-typehints in docs/requirements.txt and pyproject.toml - Update documentation for RedisFuncCache class to use method references
1 parent adf4a16 commit d2e9232

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"sphinx_copybutton",
3838
"versionwarning.extension",
3939
"sphinxcontrib.mermaid",
40+
"sphinx_autodoc_typehints",
4041
]
4142

4243
source_suffix = {
@@ -69,7 +70,7 @@
6970

7071
# Automatically extract typehints when specified and place them in
7172
# descriptions of the relevant function/method.
72-
autodoc_typehints = "description"
73+
autodoc_typehints = "both"
7374

7475
# Don't show class signature with the class' name.
7576
# autodoc_class_signature = "separated"

docs/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ sphinx-copybutton
1111
sphinx-inline-tabs
1212
sphinx_tippy
1313
sphinx-version-warning
14+
15+
sphinx-autodoc-typehint

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ docs = [
9292
"sphinx-inline-tabs",
9393
"sphinx_tippy",
9494
"sphinx-version-warning",
95+
"sphinx-autodoc-typehints",
9596
]
9697
test = [
9798
"pytest",

src/redis_func_cache/cache.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ def __init__(
165165
166166
or a function that returns one of these objects.
167167
168-
Access the client via the :attr:`client` property.
168+
Get the client via :meth:`get_client`.
169169
170170
Caution:
171-
If a :term:`callable` object is passed here, it will be executed **every time** the :attr:`.client` property is accessed.
171+
If a :term:`callable` object is passed here, it will be executed **every time** :meth:`get_client` is called.
172172
173173
maxsize: The maximum size of the cache.
174174
@@ -881,7 +881,7 @@ async def awrapper(*user_args, **user_kwargs):
881881
__call__ = decorate
882882

883883
@contextmanager
884-
def mode(self, mode: Mode) -> Generator[None, None, None]:
884+
def mode(self, mode: RedisFuncCache.Mode) -> Generator[None, None, None]:
885885
"""A context manager to control cache behavior.
886886
887887
Args:
@@ -894,7 +894,7 @@ def mode(self, mode: Mode) -> Generator[None, None, None]:
894894
self._mode.reset(token)
895895

896896
@contextmanager
897-
def mask_mode(self, mode: Mode) -> Generator[None, None, None]:
897+
def mask_mode(self, mode: RedisFuncCache.Mode) -> Generator[None, None, None]:
898898
"""Apply a mode mask using bitwise AND operation to restrict cache capabilities.
899899
900900
This context manager allows you to temporarily restrict the current cache mode

0 commit comments

Comments
 (0)