diff --git a/mypy.ini b/mypy.ini
index 64f9097206..5530074221 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -97,9 +97,6 @@ disallow_untyped_defs = False
[mypy-synapse.server]
disallow_untyped_defs = False
-[mypy-synapse.storage.database]
-disallow_untyped_defs = False
-
[mypy-tests.*]
disallow_untyped_defs = False
diff --git a/synapse/storage/database.py b/synapse/storage/database.py
index 4ba1e901c2..f2faa41d2a 100644
--- a/synapse/storage/database.py
+++ b/synapse/storage/database.py
@@ -34,6 +34,7 @@ from typing import (
Tuple,
Type,
TypeVar,
+ Union,
cast,
overload,
)
@@ -927,7 +928,7 @@ class DatabasePool:
start_time = monotonic_time()
- def inner_func(conn: adbapi.Connection, *args, **kwargs):
+ def inner_func(conn: adbapi.Connection, *args: P.args, **kwargs: P.kwargs) -> R:
# We shouldn't be in a transaction. If we are then something
# somewhere hasn't committed after doing work. (This is likely only
# possible during startup, as `run*` will ensure changes are
@@ -1020,7 +1021,7 @@ class DatabasePool:
decoder: Optional[Callable[[Cursor], R]],
query: str,
*args: Any,
- ) -> R:
+ ) -> Union[R, List[Tuple[Any, ...]]]:
"""Runs a single query for a result set.
Args:
@@ -1033,7 +1034,7 @@ class DatabasePool:
The result of decoder(results)
"""
- def interaction(txn):
+ def interaction(txn: LoggingTransaction) -> Union[R, List[Tuple[Any, ...]]]:
txn.execute(query, args)
if decoder:
return decoder(txn)
|