summary refs log tree commit diff
path: root/synapse/util/caches/ttlcache.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-10-06 11:20:49 +0100
committerGitHub <noreply@github.com>2021-10-06 11:20:49 +0100
commitf8d0f72b27e158738f3c75a38399b967f7478011 (patch)
treead1848e462ac985017f62f96734cfd3164c7768f /synapse/util/caches/ttlcache.py
parentRemove "reference" wording according Synapse homeserver (#10971) (diff)
downloadsynapse-f8d0f72b27e158738f3c75a38399b967f7478011.tar.xz
More types for synapse.util, part 1 (#10888)
The following modules now pass `disallow_untyped_defs`:

* synapse.util.caches.cached_call 
* synapse.util.caches.lrucache
* synapse.util.caches.response_cache 
* synapse.util.caches.stream_change_cache
* synapse.util.caches.ttlcache pass
* synapse.util.daemonize
* synapse.util.patch_inline_callbacks pass `no-untyped-defs`
* synapse.util.versionstring

Additional typing in synapse.util.metrics. Didn't get this to pass `no-untyped-defs`, think I'll need to watch #10847
Diffstat (limited to 'synapse/util/caches/ttlcache.py')
-rw-r--r--synapse/util/caches/ttlcache.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/util/caches/ttlcache.py b/synapse/util/caches/ttlcache.py

index 46afe3f934..0b9ac26b69 100644 --- a/synapse/util/caches/ttlcache.py +++ b/synapse/util/caches/ttlcache.py
@@ -159,12 +159,12 @@ class TTLCache(Generic[KT, VT]): del self._expiry_list[0] -@attr.s(frozen=True, slots=True) -class _CacheEntry: +@attr.s(frozen=True, slots=True, auto_attribs=True) +class _CacheEntry: # Should be Generic[KT, VT]. See python-attrs/attrs#313 """TTLCache entry""" # expiry_time is the first attribute, so that entries are sorted by expiry. - expiry_time = attr.ib(type=float) - ttl = attr.ib(type=float) - key = attr.ib() - value = attr.ib() + expiry_time: float + ttl: float + key: Any # should be KT + value: Any # should be VT