@@ -290,7 +290,8 @@ def call_after(
290290 # LoggingTransaction isn't expecting there to be any callbacks; assert that
291291 # is not the case.
292292 assert self .after_callbacks is not None
293- self .after_callbacks .append ((callback , args , kwargs ))
293+ # type-ignore: need mypy containing https://github.com/python/mypy/pull/12668
294+ self .after_callbacks .append ((callback , args , kwargs )) # type: ignore[arg-type]
294295
295296 def async_call_after (
296297 self , callback : Callable [P , Awaitable ], * args : P .args , ** kwargs : P .kwargs
@@ -311,7 +312,8 @@ def async_call_after(
311312 # LoggingTransaction isn't expecting there to be any callbacks; assert that
312313 # is not the case.
313314 assert self .async_after_callbacks is not None
314- self .async_after_callbacks .append ((callback , args , kwargs ))
315+ # type-ignore: need mypy containing https://github.com/python/mypy/pull/12668
316+ self .async_after_callbacks .append ((callback , args , kwargs )) # type: ignore[arg-type]
315317
316318 def call_on_exception (
317319 self , callback : Callable [P , object ], * args : P .args , ** kwargs : P .kwargs
@@ -329,7 +331,8 @@ def call_on_exception(
329331 # LoggingTransaction isn't expecting there to be any callbacks; assert that
330332 # is not the case.
331333 assert self .exception_callbacks is not None
332- self .exception_callbacks .append ((callback , args , kwargs ))
334+ # type-ignore: need mypy containing https://github.com/python/mypy/pull/12668
335+ self .exception_callbacks .append ((callback , args , kwargs )) # type: ignore[arg-type]
333336
334337 def fetchone (self ) -> Optional [Tuple ]:
335338 return self .txn .fetchone ()
@@ -418,7 +421,10 @@ def _do_execute(
418421 sql = self .database_engine .convert_param_style (sql )
419422 if args :
420423 try :
421- sql_logger .debug ("[SQL values] {%s} %r" , self .name , args [0 ])
424+ # The type-ignore should be redundant once mypy releases a version with
425+ # https://github.com/python/mypy/pull/12668. (`args` might be empty,
426+ # (but we'll catch the index error if so.)
427+ sql_logger .debug ("[SQL values] {%s} %r" , self .name , args [0 ]) # type: ignore[index]
422428 except Exception :
423429 # Don't let logging failures stop SQL from working
424430 pass
@@ -649,15 +655,19 @@ def new_transaction(
649655 # For now, we just log an error, and hope that it works on the first attempt.
650656 # TODO: raise an exception.
651657
652- for i , arg in enumerate (args ):
658+ # Type-ignore Mypy doesn't yet consider ParamSpec.args to be iterable; see
659+ # https://github.com/python/mypy/pull/12668
660+ for i , arg in enumerate (args ): # type: ignore[arg-type, var-annotated]
653661 if inspect .isgenerator (arg ):
654662 logger .error (
655663 "Programming error: generator passed to new_transaction as "
656664 "argument %i to function %s" ,
657665 i ,
658666 func ,
659667 )
660- for name , val in kwargs .items ():
668+ # Type-ignore Mypy doesn't yet consider ParamSpec.args to be a mapping; see
669+ # https://github.com/python/mypy/pull/12668
670+ for name , val in kwargs .items (): # type: ignore[attr-defined]
661671 if inspect .isgenerator (val ):
662672 logger .error (
663673 "Programming error: generator passed to new_transaction as "
0 commit comments