diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-11-16 08:47:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 08:47:36 -0500 |
commit | 7468723697e4d292315ce807b5000062a02b37be (patch) | |
tree | d35e7f391f31ceb427dfbb97f02c0e355f612247 /synapse/util/caches/expiringcache.py | |
parent | Properly register all callback hooks for legacy password authentication provi... (diff) | |
download | synapse-7468723697e4d292315ce807b5000062a02b37be.tar.xz |
Add most missing type hints to synapse.util (#11328)
Diffstat (limited to 'synapse/util/caches/expiringcache.py')
-rw-r--r-- | synapse/util/caches/expiringcache.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/util/caches/expiringcache.py b/synapse/util/caches/expiringcache.py index c3f72aa06d..6a7e534576 100644 --- a/synapse/util/caches/expiringcache.py +++ b/synapse/util/caches/expiringcache.py @@ -19,6 +19,8 @@ from typing import Any, Generic, Optional, TypeVar, Union, overload 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 @@ -81,7 +83,7 @@ class ExpiringCache(Generic[KT, VT]): # 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 ) @@ -210,7 +212,7 @@ class ExpiringCache(Generic[KT, VT]): 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 |