Use inline type hints in http/federation/, storage/ and util/ (#10381)

This commit is contained in:
Jonathan de Jong 2021-07-15 18:46:54 +02:00 committed by GitHub
parent 3acf85c85f
commit bdfde6dca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 149 additions and 161 deletions

View file

@ -23,7 +23,7 @@ from synapse.util.caches import register_cache
logger = logging.getLogger(__name__)
SENTINEL = object() # type: Any
SENTINEL: Any = object()
T = TypeVar("T")
KT = TypeVar("KT")
@ -35,10 +35,10 @@ class TTLCache(Generic[KT, VT]):
def __init__(self, cache_name: str, timer: Callable[[], float] = time.time):
# map from key to _CacheEntry
self._data = {} # type: Dict[KT, _CacheEntry]
self._data: Dict[KT, _CacheEntry] = {}
# the _CacheEntries, sorted by expiry time
self._expiry_list = SortedList() # type: SortedList[_CacheEntry]
self._expiry_list: SortedList[_CacheEntry] = SortedList()
self._timer = timer