mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 06:05:00 -04:00
Add most missing type hints to synapse.util (#11328)
This commit is contained in:
parent
3a1462f7e0
commit
7468723697
10 changed files with 161 additions and 165 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue