diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2021-11-17 01:02:56 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2021-11-17 01:04:29 +0000 |
commit | 70dc5da72d181bfc7bea5467e68cd5aace9a320d (patch) | |
tree | 77ab11200d732efe0dfaa902962368de3684e757 | |
parent | Add types-psycopg2 package to optional dev dependencies (diff) | |
download | synapse-anoa/typehint_tests_utils.tar.xz |
Simply calling execute_values in order to appease mypy github/anoa/typehint_tests_utils anoa/typehint_tests_utils
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.
-rw-r--r-- | synapse/storage/database.py | 4 |
1 files changed, 3 insertions, 1 deletions
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: |