Skip to content

Commit 8d412c9

Browse files
committed
chore: isolate docformatter cleanup
1 parent 93a8e3a commit 8d412c9

4 files changed

Lines changed: 17 additions & 21 deletions

File tree

src/cachier/core.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@
3939
class _CachierWrappedFunc(Protocol[_P, _R_co]):
4040
"""Callable returned by ``@cachier`` with the decorated function's signature.
4141
42-
Preserves the original function's parameter and return types via ``ParamSpec``
43-
while also exposing the cache-management attributes attached by the decorator.
44-
Per-call cachier options such as ``max_age`` and ``cachier__skip_cache`` are
45-
accepted at runtime but are not surfaced in the ``__call__`` signature here;
46-
PEP 612 does not permit mixing ParamSpec kwargs with additional keyword-only
47-
parameters.
42+
Preserves the original function's parameter and return types via ``ParamSpec`` while also exposing the cache-
43+
management attributes attached by the decorator. Per-call cachier options such as ``max_age`` and
44+
``cachier__skip_cache`` are accepted at runtime but are not surfaced in the ``__call__`` signature here; PEP 612
45+
does not permit mixing ParamSpec kwargs with additional keyword-only parameters.
4846
4947
"""
5048

@@ -85,9 +83,8 @@ async def _background_recalc_async(
8583
) -> None:
8684
"""Run async recomputation in background and clear processing flag.
8785
88-
This helper ensures that the cache entry's "being calculated" state is
89-
cleared only after the background recomputation and cache update
90-
(performed by ``_function_thread_async``) have completed.
86+
This helper ensures that the cache entry's "being calculated" state is cleared only after the background
87+
recomputation and cache update (performed by ``_function_thread_async``) have completed.
9188
9289
"""
9390
try:

src/cachier/cores/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def check_calc_timeout(self, time_spent):
121121
def get_entry_by_key(self, key: str) -> Tuple[str, Optional[CacheEntry]]:
122122
"""Get entry based on given key.
123123
124-
Return the key and the :class:`~cachier.config.CacheEntry` mapped
125-
to the given key in this core's cache, if such a mapping exists.
124+
Return the key and the :class:`~cachier.config.CacheEntry` mapped to the given key in this core's cache, if such
125+
a mapping exists.
126126
127127
"""
128128

tests/conftest.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,13 @@ def _build_worker_url(original_url: str, schema_name: str) -> str:
4848
def worker_sql_connection(request: pytest.FixtureRequest) -> Optional[str]:
4949
"""Create the worker-specific PostgreSQL schema once per xdist worker session.
5050
51-
Returns the worker-specific connection URL, or None when schema isolation is not
52-
needed (serial run or non-PostgreSQL backend). The schema is created with
53-
``CREATE SCHEMA IF NOT EXISTS`` so this fixture is safe to run even if the schema
54-
already exists from a previous interrupted run.
55-
56-
A non-None return value means "use this URL"; schema creation is attempted but may
57-
fail silently (e.g. if SQLAlchemy is not installed or the DB is unreachable). Tests
58-
that depend on the schema will fail at the DB level with a diagnostic error.
51+
Returns the worker-specific connection URL, or None when schema isolation is not needed (serial run or non-
52+
PostgreSQL backend). The schema is created with ``CREATE SCHEMA IF NOT EXISTS`` so this fixture is safe to run even
53+
if the schema already exists from a previous interrupted run.
54+
55+
A non-None return value means "use this URL"; schema creation is attempted but may fail silently (e.g. if SQLAlchemy
56+
is not installed or the DB is unreachable). Tests that depend on the schema will fail at the DB level with a
57+
diagnostic error.
5958
6059
"""
6160
# Avoid touching SQL backends entirely when no SQL tests are collected.

tests/test_general.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _calls_wait_for_calc_timeout_fast(res_queue):
7777
res = _wait_for_calc_timeout_fast(1, 2)
7878
res_queue.put(res)
7979

80-
""" Testing calls that avoid timeouts store the values in cache. """
80+
# Testing calls that avoid timeouts store the values in cache.
8181
_wait_for_calc_timeout_fast.clear_cache()
8282
val1 = _wait_for_calc_timeout_fast(1, 2)
8383
val2 = _wait_for_calc_timeout_fast(1, 2)
@@ -123,7 +123,7 @@ def _calls_wait_for_calc_timeout_slow(res_queue):
123123
res = _wait_for_calc_timeout_slow(1, 2)
124124
res_queue.put(res)
125125

126-
"""Testing for calls timing out to be performed twice when needed."""
126+
# Testing for calls timing out to be performed twice when needed.
127127
_wait_for_calc_timeout_slow.clear_cache()
128128
res_queue = queue.Queue()
129129
thread1 = threading.Thread(

0 commit comments

Comments
 (0)