1
0

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.
This commit is contained in:
Andrew Morgan
2021-11-17 01:02:56 +00:00
parent e532a8f77d
commit 70dc5da72d
+3 -1
View File
@@ -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: