This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,9 @@ def _build_query(
315
315
return query
316
316
317
317
318
+ _CallableType = typing .TypeVar ("_CallableType" , bound = typing .Callable )
319
+
320
+
318
321
class Transaction :
319
322
def __init__ (
320
323
self ,
@@ -347,13 +350,13 @@ async def __aexit__(
347
350
else :
348
351
await self .commit ()
349
352
350
- def __await__ (self ) -> typing .Generator :
353
+ def __await__ (self ) -> typing .Generator [ None , None , "Transaction" ] :
351
354
"""
352
355
Called if using the low-level `transaction = await database.transaction()`
353
356
"""
354
357
return self .start ().__await__ ()
355
358
356
- def __call__ (self , func : typing . Callable ) -> typing . Callable :
359
+ def __call__ (self , func : _CallableType ) -> _CallableType :
357
360
"""
358
361
Called if using `@database.transaction()` as a decorator.
359
362
"""
@@ -363,7 +366,7 @@ async def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:
363
366
async with self :
364
367
return await func (* args , ** kwargs )
365
368
366
- return wrapper
369
+ return wrapper # type: ignore
367
370
368
371
async def start (self ) -> "Transaction" :
369
372
self ._connection = self ._connection_callable ()
You can’t perform that action at this time.
0 commit comments