Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
+5
-5
@@ -10,11 +10,12 @@ from typing import Any
|
||||
|
||||
|
||||
def hash_source(*srcs: str | Any) -> str:
|
||||
"""
|
||||
Utility method to hash the sources of functions or objects.
|
||||
"""Utility method to hash the sources of functions or objects.
|
||||
|
||||
Args:
|
||||
srcs: strings or objects to add to the hash.
|
||||
Objects and functions have their source inspected.
|
||||
|
||||
"""
|
||||
hasher = hashlib.sha256()
|
||||
for src in srcs:
|
||||
@@ -34,8 +35,7 @@ def hash_source(*srcs: str | Any) -> str:
|
||||
|
||||
|
||||
def weak_lru_cache(maxsize: int | None = 128, typed: bool = False):
|
||||
"""
|
||||
LRU Cache decorator that keeps a weak reference to 'self'.
|
||||
"""LRU Cache decorator that keeps a weak reference to 'self'.
|
||||
This avoids memory leakage, which happens when functools.lru_cache
|
||||
stores a reference to self in the global cache.
|
||||
|
||||
@@ -57,5 +57,5 @@ def weak_lru_cache(maxsize: int | None = 128, typed: bool = False):
|
||||
|
||||
|
||||
def weak_cache(user_function, /):
|
||||
"""Simple weak equivalent to functools.cache"""
|
||||
"""Simple weak equivalent to functools.cache."""
|
||||
return weak_lru_cache(maxsize=None)(user_function)
|
||||
|
||||
Reference in New Issue
Block a user