Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add most missing type hints to synapse.util #11328

Merged
merged 14 commits into from
Nov 16, 2021
10 changes: 6 additions & 4 deletions synapse/util/caches/expiringcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import attr
from typing_extensions import Literal

from twisted.internet import defer

from synapse.config import cache as cache_config
from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.util import Clock
Expand Down Expand Up @@ -81,7 +83,7 @@ def __init__(
# Don't bother starting the loop if things never expire
return

def f():
def f() -> "defer.Deferred[None]":
return run_as_background_process(
"prune_cache_%s" % self._cache_name, self._prune_cache
)
Expand Down Expand Up @@ -210,7 +212,7 @@ def set_cache_factor(self, factor: float) -> bool:
return False


@attr.s(slots=True)
@attr.s(slots=True, auto_attribs=True)
class _CacheEntry:
time = attr.ib(type=int)
value = attr.ib()
time: int
value: Any
clokep marked this conversation as resolved.
Show resolved Hide resolved