Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

utils: Add a helper function for None-checks.

PIG2082972e921b7a2
diff --git a/zerver/lib/utils.py b/zerver/lib/utils.py
index 52ccf2948e1..2dda3e1564d 100644
--- a/zerver/lib/utils.py
+++ b/zerver/lib/utils.py
@@ -122,6 +122,11 @@ def has_api_key_format(key: str) -> bool:
return bool(re.fullmatch(r"([A-Za-z0-9]){32}", key))
+def assert_is_not_none(value: Optional[T]) -> T:
+ assert value is not None
+ return value
+
+
def query_chunker(
queries: List[Any],
id_collector: Optional[Set[int]] = None,