1
1
import logging
2
2
import re
3
3
import time
4
+ import typing
4
5
import warnings
5
6
6
7
from . import errors
15
16
re .IGNORECASE | re .DOTALL ,
16
17
)
17
18
logger = logging .getLogger (__package__ )
19
+ if typing .TYPE_CHECKING :
20
+ from asyncmy .connection import Connection
18
21
19
22
20
23
class Cursor :
@@ -34,7 +37,7 @@ class Cursor:
34
37
#: Default value of max_allowed_packet is 1048576.
35
38
max_stmt_length = 1024000
36
39
37
- def __init__ (self , connection , echo = False ):
40
+ def __init__ (self , connection : "Connection" , echo = False ):
38
41
self .connection = connection
39
42
self .description = None
40
43
self .rownumber = 0
@@ -174,7 +177,7 @@ async def execute(self, query, args=None):
174
177
end = time .time ()
175
178
self ._executed = query
176
179
if self ._echo :
177
- logger .info (f"[{ round ((end - start ) * 1000 ,2 )} ms] { query } " )
180
+ logger .info (f"[{ round ((end - start ) * 1000 , 2 )} ms] { query } " )
178
181
return result
179
182
180
183
async def executemany (self , query , args ):
@@ -378,7 +381,7 @@ async def _do_get_result(self):
378
381
if result .warning_count > 0 :
379
382
await self ._show_warnings (conn )
380
383
381
- async def _show_warnings (self , conn ):
384
+ async def _show_warnings (self , conn : "Connection" ):
382
385
if self ._result and self ._result .has_next :
383
386
return
384
387
ws = await conn .show_warnings ()
0 commit comments