From 684f336c438951c9a7712adaa80f241dc136f9ff Mon Sep 17 00:00:00 2001 From: David Robertson Date: Sat, 1 Oct 2022 23:57:19 +0100 Subject: [PATCH] Suppress false positives from mypy --- synapse/storage/database.py | 6 +++++- synapse/storage/databases/state/store.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/synapse/storage/database.py b/synapse/storage/database.py index a547fabe42..35c03f083c 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -1684,7 +1684,11 @@ class DatabasePool: table, keyvalues, retcol, - allow_none=allow_none, + # Type ignore suppresses a mypy bug: + # Argument "allow_none" to "runInteraction_advanced" of "DatabasePool" + # has incompatible type "bool"; expected "Literal[False]" [arg-type] + # I think mypy is confused by the overloads of simple_select_one_onecol_txn. + allow_none=allow_none, # type:ignore[arg-type] ) @overload diff --git a/synapse/storage/databases/state/store.py b/synapse/storage/databases/state/store.py index f8cfcaca83..023a559a31 100644 --- a/synapse/storage/databases/state/store.py +++ b/synapse/storage/databases/state/store.py @@ -547,6 +547,9 @@ class StateGroupDataStore(StateBackgroundUpdateStore, SQLBaseStore): return state_group if prev_group is not None: + # This assertion is for mypy's benefit and is checked above. + assert delta_ids is not None + state_group = await self.db_pool.runInteraction( "store_state_group.insert_delta_group", insert_delta_group_txn,