mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 20:24:59 -04:00
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
This commit is contained in:
parent
6744273f0b
commit
f8d0f72b27
12 changed files with 134 additions and 73 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue