From 70dc5da72d181bfc7bea5467e68cd5aace9a320d Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Wed, 17 Nov 2021 01:02:56 +0000 Subject: Simply calling execute_values in order to appease mypy mypy was getting upset as it thought 'fetch' was being passed multiple times to execute_values. This cannot happen, as fetch would never be part of 'args', and thus seems like a bug in mypy. This code was a bit strange anyhow. Why collect values with *x only to expand them again immediately afterwards when calling execute_values? The code is simpler now IMO, and appeases mypy. --- synapse/storage/database.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/synapse/storage/database.py b/synapse/storage/database.py index d4cab69ebf..a3084c96dd 100644 --- a/synapse/storage/database.py +++ b/synapse/storage/database.py @@ -300,7 +300,9 @@ class LoggingTransaction: from psycopg2.extras import execute_values # type: ignore return self._do_execute( - lambda *x: execute_values(self.txn, *x, fetch=fetch), sql, *args + lambda sql, argslist: execute_values(self.txn, sql, argslist, fetch=fetch), + sql, + *args, ) def execute(self, sql: str, *args: Any) -> None: -- cgit 1.5.1