summaryrefslogtreecommitdiff
path: root/synapse/util/caches/dictionary_cache.py
diff options
context:
space:
mode:
authorAntonio Russo <aerusso@aerusso.net>2023-09-27 18:16:24 -0600
committerAntonio Russo <aerusso@aerusso.net>2023-09-27 18:16:24 -0600
commitb230e2110fd27e03a5452ce95dbbe8ea8dd87037 (patch)
tree6fb976a0de5fa566a805537ade0ddae5502ae138 /synapse/util/caches/dictionary_cache.py
parent44b86bfd0ddbeaf838f80677985bce34ec04d72f (diff)
New upstream version 1.93.0
Diffstat (limited to 'synapse/util/caches/dictionary_cache.py')
-rw-r--r--synapse/util/caches/dictionary_cache.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/util/caches/dictionary_cache.py b/synapse/util/caches/dictionary_cache.py
index 5eaf70c7..2fbc7b1e 100644
--- a/synapse/util/caches/dictionary_cache.py
+++ b/synapse/util/caches/dictionary_cache.py
@@ -14,7 +14,7 @@
import enum
import logging
import threading
-from typing import Any, Dict, Generic, Iterable, Optional, Set, Tuple, TypeVar, Union
+from typing import Dict, Generic, Iterable, Optional, Set, Tuple, TypeVar, Union
import attr
from typing_extensions import Literal
@@ -33,10 +33,8 @@ DKT = TypeVar("DKT")
DV = TypeVar("DV")
-# This class can't be generic because it uses slots with attrs.
-# See: https://github.com/python-attrs/attrs/issues/313
@attr.s(slots=True, frozen=True, auto_attribs=True)
-class DictionaryEntry: # should be: Generic[DKT, DV].
+class DictionaryEntry(Generic[DKT, DV]):
"""Returned when getting an entry from the cache
If `full` is true then `known_absent` will be the empty set.
@@ -50,8 +48,8 @@ class DictionaryEntry: # should be: Generic[DKT, DV].
"""
full: bool
- known_absent: Set[Any] # should be: Set[DKT]
- value: Dict[Any, Any] # should be: Dict[DKT, DV]
+ known_absent: Set[DKT]
+ value: Dict[DKT, DV]
def __len__(self) -> int:
return len(self.value)