diff options
author | David Robertson <davidr@element.io> | 2022-10-02 23:15:45 +0100 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2022-10-02 23:15:45 +0100 |
commit | a95217238974bae7a7628e05e2c5a76f698cbc82 (patch) | |
tree | cb0ed04a975b5a7df62f3a7294fa912089e9c639 | |
parent | Fix a surprisingly tricky mypy error (diff) | |
download | synapse-a95217238974bae7a7628e05e2c5a76f698cbc82.tar.xz |
Also disallow-untyped-defs lol
-rw-r--r-- | mypy.ini | 3 | ||||
-rw-r--r-- | synapse/storage/database.py | 7 |
2 files changed, 4 insertions, 6 deletions
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) |