Add type hints to expiring cache. (#9730)

This commit is contained in:
Patrick Cloke 2021-04-06 08:58:18 -04:00 committed by GitHub
parent 024f121b74
commit 44bb881096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 54 deletions

View file

@ -22,6 +22,7 @@ from typing import (
Callable,
DefaultDict,
Dict,
FrozenSet,
Iterable,
List,
Optional,
@ -515,7 +516,7 @@ class StateResolutionHandler:
expiry_ms=EVICTION_TIMEOUT_SECONDS * 1000,
iterable=True,
reset_expiry_on_get=True,
)
) # type: ExpiringCache[FrozenSet[int], _StateCacheEntry]
#
# stuff for tracking time spent on state-res by room
@ -536,7 +537,7 @@ class StateResolutionHandler:
state_groups_ids: Dict[int, StateMap[str]],
event_map: Optional[Dict[str, EventBase]],
state_res_store: "StateResolutionStore",
):
) -> _StateCacheEntry:
"""Resolves conflicts between a set of state groups
Always generates a new state group (unless we hit the cache), so should