@@ -218,12 +218,7 @@ async def execute(self, query: str, *args, timeout: float=None) -> str:
218218 _ , status , _ = await self ._execute (query , args , 0 , timeout , True )
219219 return status .decode ()
220220
221- async def executemany (self , command : str , args ,
222- _timeout : float = None , ** kw ):
223- # The real signature of this method is:
224- #
225- # executemany(self, command: str, args, *, timeout: float=None)
226- #
221+ async def executemany (self , command : str , args , * , timeout : float = None ):
227222 """Execute an SQL *command* for each sequence of arguments in *args*.
228223
229224 Example:
@@ -242,24 +237,6 @@ async def executemany(self, command: str, args,
242237 .. versionadded:: 0.7.0
243238 """
244239 self ._check_open ()
245-
246- if 'timeout' in kw :
247- timeout = kw .pop ('timeout' )
248- else :
249- timeout = _timeout
250- if timeout is not None :
251- warnings .warn (
252- "Passing 'timeout' as a positional argument to "
253- "executemany() is deprecated and will be removed in "
254- "asyncpg 0.11.0. Pass it as a keyword argument instead: "
255- "`executemany(..., timeout=...)`." ,
256- DeprecationWarning , stacklevel = 2 )
257- if kw :
258- first_kwarg = next (iter (kw ))
259- raise TypeError (
260- 'executemany() got an unexpected keyword argument {!r}' .format (
261- first_kwarg ))
262-
263240 return await self ._executemany (command , args , timeout )
264241
265242 async def _get_statement (self , query , timeout , * , named : bool = False ):
@@ -1290,21 +1267,3 @@ def _detect_server_capabilities(server_version, connection_settings):
12901267 sql_reset = sql_reset ,
12911268 sql_close_all = sql_close_all
12921269 )
1293-
1294-
1295- def _patch_executemany_signature ():
1296- # Patch Connection.executemany() signature to remove '**kw' parameter
1297- # and change '_timeout' keyword arg to 'timeout' keyword-only arg.
1298- # TODO Remove in 0.11.0.
1299- import inspect
1300- sig = inspect .signature (Connection .executemany )
1301- params = sig .parameters .copy ()
1302- params .pop ('kw' )
1303- timeout = params .pop ('_timeout' )
1304- timeout = timeout .replace (name = 'timeout' , kind = timeout .KEYWORD_ONLY )
1305- params ['timeout' ] = timeout
1306- Connection .executemany .__signature__ = sig .replace (
1307- parameters = params .values ())
1308-
1309-
1310- _patch_executemany_signature ()
0 commit comments