From f236c0069df020bd838c7c6ed17c774816d459d7 Mon Sep 17 00:00:00 2001 From: flashdagger Date: Sun, 26 Nov 2023 11:06:58 +0100 Subject: [PATCH] resources: extract LRU cache type Signed-off-by: flashdagger --- zammadoo/resources.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zammadoo/resources.py b/zammadoo/resources.py index 0f1cb89..4ca79f9 100644 --- a/zammadoo/resources.py +++ b/zammadoo/resources.py @@ -26,6 +26,7 @@ _ = Resource # make PyCharm happy _T_co = TypeVar("_T_co", bound="Resource", covariant=True) +Cache = LruCache["JsonDict"] class ResourcesT(Generic[_T_co]): @@ -42,9 +43,7 @@ class ResourcesT(Generic[_T_co]): def __init__(self, client: "Client", endpoint: str): self._client = weakref.ref(client) self.endpoint: str = endpoint - self.cache = LruCache["JsonDict"]( - max_size=self.DEFAULT_CACHE_SIZE - ) #: resource LRU cache + self.cache = Cache(max_size=self.DEFAULT_CACHE_SIZE) #: resource LRU cache def __call__(self, rid: int, *, info: Optional["JsonDict"] = None) -> _T_co: if info: