summary refs log tree commit diff
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-12-16 13:04:54 +0000
committerGitHub <noreply@github.com>2022-12-16 13:04:54 +0000
commit864c3f85b0c420f755a064a3c50a45716db3f8af (patch)
treeea996b2c4aa7c542a6fde1906a7bff33bda03f40
parentAdd missing type hints to tests.handlers. (#14680) (diff)
downloadsynapse-864c3f85b0c420f755a064a3c50a45716db3f8af.tar.xz
Improve type annotations for the helper methods on a `CachedFunction`. (#14685)
-rw-r--r--changelog.d/14685.misc1
-rw-r--r--synapse/util/caches/descriptors.py6
2 files changed, 4 insertions, 3 deletions
diff --git a/changelog.d/14685.misc b/changelog.d/14685.misc
new file mode 100644
index 0000000000..3ba2270100
--- /dev/null
+++ b/changelog.d/14685.misc
@@ -0,0 +1 @@
+Improve type annotations for the helper methods on a `CachedFunction`.
\ No newline at end of file
diff --git a/synapse/util/caches/descriptors.py b/synapse/util/caches/descriptors.py
index 72227359b9..81df71a0c5 100644
--- a/synapse/util/caches/descriptors.py
+++ b/synapse/util/caches/descriptors.py
@@ -53,9 +53,9 @@ F = TypeVar("F", bound=Callable[..., Any])
 
 
 class CachedFunction(Generic[F]):
-    invalidate: Any = None
-    invalidate_all: Any = None
-    prefill: Any = None
+    invalidate: Callable[[Tuple[Any, ...]], None]
+    invalidate_all: Callable[[], None]
+    prefill: Callable[[Tuple[Any, ...], Any], None]
     cache: Any = None
     num_args: Any = None