summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-05-13 08:24:50 -0400
committerGitHub <noreply@github.com>2020-05-13 08:24:50 -0400
commitedd3b0747cc651d224fc1bf81ae7fbd6a25a2ea5 (patch)
treeba9843033806aeb0849c8e2b99ed9edb5fd71213 /synapse/notifier.py
parentDon't UPGRADE database rows (diff)
downloadsynapse-edd3b0747cc651d224fc1bf81ae7fbd6a25a2ea5.tar.xz
Fix new flake8 errors (#7489)
This is a cherry-pick of 1a1da60ad2c9172fe487cd38a164b39df60f4cb5 (#7470)
to the release-v1.13.0 branch.
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 71d9ed62b0..87c120a59c 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -15,7 +15,7 @@
 
 import logging
 from collections import namedtuple
-from typing import Callable, List
+from typing import Callable, Iterable, List, TypeVar
 
 from prometheus_client import Counter
 
@@ -42,12 +42,14 @@ users_woken_by_stream_counter = Counter(
     "synapse_notifier_users_woken_by_stream", "", ["stream"]
 )
 
+T = TypeVar("T")
+
 
 # TODO(paul): Should be shared somewhere
-def count(func, l):
-    """Return the number of items in l for which func returns true."""
+def count(func: Callable[[T], bool], it: Iterable[T]) -> int:
+    """Return the number of items in it for which func returns true."""
     n = 0
-    for x in l:
+    for x in it:
         if func(x):
             n += 1
     return n