From 8dd1b509edbedb42c6d427f81cfe8709c5c50213 Mon Sep 17 00:00:00 2001 From: NextChai <75498301+NextChai@users.noreply.github.com> Date: Sat, 30 Apr 2022 14:52:58 -0400 Subject: [PATCH 1/2] Update deque annotation for python 3.8 --- Github/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Github/cache.py b/Github/cache.py index 0a8dc3f..3ca7be4 100644 --- a/Github/cache.py +++ b/Github/cache.py @@ -19,7 +19,7 @@ class _BaseCache(UserDict[K, V]): def __init__(self, max_size: int, *args: Any) -> None: self._max_size: int = max(min(max_size, 15), 0) # bounding max_size to 15 for now - self._lru_keys: Deque[K] = deque[K](maxlen=self._max_size) + self._lru_keys: Deque[K] = deque(maxlen=self._max_size) super().__init__(*args) def __getitem__(self, __k: K) -> V: From ee4d1b59fcf388d508bd687e645905a6ddbf4b5c Mon Sep 17 00:00:00 2001 From: NextChai <75498301+NextChai@users.noreply.github.com> Date: Sat, 30 Apr 2022 14:53:47 -0400 Subject: [PATCH 2/2] Update _BaseCache to comply with python 3.8.x --- Github/cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Github/cache.py b/Github/cache.py index 3ca7be4..d63f686 100644 --- a/Github/cache.py +++ b/Github/cache.py @@ -2,8 +2,8 @@ from __future__ import annotations -from collections import deque, UserDict -from typing import Any, Deque, Tuple, TypeVar +from collections import deque +from typing import Any, Deque, Tuple, TypeVar, Dict __all__: Tuple[str, ...] = ('ObjectCache',) @@ -12,7 +12,7 @@ K = TypeVar('K') V = TypeVar('V') -class _BaseCache(UserDict[K, V]): +class _BaseCache(Dict[K, V]): """This is a rough implementation of an LRU Cache using a deque and a dict.""" __slots__: Tuple[str, ...] = ('_max_size', '_lru_keys')