Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
narrow (mypy): Add NarrowPredicate protocol.
Steve Howell6a2b560b7ff6
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.pyindex 53c065779d0..cd855c201b4 100644--- a/zerver/lib/narrow.py+++ b/zerver/lib/narrow.py@@ -10,6 +10,7 @@ from typing import (Iterable,List,Optional,+ Protocol,Sequence,Set,Tuple,@@ -147,9 +148,14 @@ def is_web_public_narrow(narrow: Optional[Iterable[Dict[str, Any]]]) -> bool:)+class NarrowPredicate(Protocol):+ def __call__(self, *, message: Dict[str, Any], flags: List[str]) -> bool:+ ...++def build_narrow_filter(narrow: Collection[NarrowTerm],-) -> Callable[..., bool]:+) -> NarrowPredicate:"""Changes to this function should come with corresponding changes toNarrowLibraryTest."""check_supported_events_narrow_filter(narrow)