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.

mypy: Fix CustomFetch=Any hack.

Steve Howell54a3a423e589
diff --git a/zerver/lib/export.py b/zerver/lib/export.py
index 38ee7ba10e1..4ee948a0ad3 100644
--- a/zerver/lib/export.py
+++ b/zerver/lib/export.py
@@ -81,11 +81,7 @@ FilterArgs = Dict[str, Any]
IdSource = Tuple[TableName, Field]
SourceFilter = Callable[[Record], bool]
-# This next type is a callback, which mypy does not
-# support well, because PEP 484 says "using callbacks
-# with keyword arguments is not perceived as a common use case."
-# CustomFetch = Callable[[TableData, Config, Context], None]
-CustomFetch = Any # TODO: make more specific, see above
+CustomFetch = Callable[[TableData, "Config", Context], None]
# The keys of our MessageOutput variables are normally
# List[Record], but when we write partials, we can get
@@ -539,9 +535,9 @@ def export_from_config(
elif config.custom_fetch:
config.custom_fetch(
- response=response,
- config=config,
- context=context,
+ response,
+ config,
+ context,
)
if config.custom_tables:
for t in config.custom_tables: