2525from ..engine .interfaces import _DBAPICursorDescription
2626from ..engine .interfaces import _DBAPIMultiExecuteParams
2727from ..engine .interfaces import _DBAPISingleExecuteParams
28- from ..util .concurrency import await_fallback
29- from ..util .concurrency import await_only
28+ from ..util .concurrency import await_
3029from ..util .typing import Self
3130
3231
@@ -121,7 +120,6 @@ class AsyncAdapt_dbapi_cursor:
121120 __slots__ = (
122121 "_adapt_connection" ,
123122 "_connection" ,
124- "await_" ,
125123 "_cursor" ,
126124 "_rows" ,
127125 )
@@ -134,12 +132,11 @@ class AsyncAdapt_dbapi_cursor:
134132 def __init__ (self , adapt_connection : AsyncAdapt_dbapi_connection ):
135133 self ._adapt_connection = adapt_connection
136134 self ._connection = adapt_connection ._connection
137- self .await_ = adapt_connection .await_
138135
139136 cursor = self ._make_new_cursor (self ._connection )
140137
141138 try :
142- self ._cursor = self . await_ (cursor .__aenter__ ())
139+ self ._cursor = await_ (cursor .__aenter__ ())
143140 except Exception as error :
144141 self ._adapt_connection ._handle_exception (error )
145142
@@ -181,7 +178,7 @@ def execute(
181178 parameters : Optional [_DBAPISingleExecuteParams ] = None ,
182179 ) -> Any :
183180 try :
184- return self . await_ (self ._execute_async (operation , parameters ))
181+ return await_ (self ._execute_async (operation , parameters ))
185182 except Exception as error :
186183 self ._adapt_connection ._handle_exception (error )
187184
@@ -191,7 +188,7 @@ def executemany(
191188 seq_of_parameters : _DBAPIMultiExecuteParams ,
192189 ) -> Any :
193190 try :
194- return self . await_ (
191+ return await_ (
195192 self ._executemany_async (operation , seq_of_parameters )
196193 )
197194 except Exception as error :
@@ -223,18 +220,16 @@ async def _executemany_async(
223220 return await self ._cursor .executemany (operation , seq_of_parameters )
224221
225222 def nextset (self ) -> None :
226- self . await_ (self ._cursor .nextset ())
223+ await_ (self ._cursor .nextset ())
227224 if self ._cursor .description and not self .server_side :
228- self ._rows = collections .deque (
229- self .await_ (self ._cursor .fetchall ())
230- )
225+ self ._rows = collections .deque (await_ (self ._cursor .fetchall ()))
231226
232227 def setinputsizes (self , * inputsizes : Any ) -> None :
233228 # NOTE: this is overrridden in aioodbc due to
234229 # see https://github.com/aio-libs/aioodbc/issues/451
235230 # right now
236231
237- return self . await_ (self ._cursor .setinputsizes (* inputsizes ))
232+ return await_ (self ._cursor .setinputsizes (* inputsizes ))
238233
239234 def __enter__ (self ) -> Self :
240235 return self
@@ -273,24 +268,23 @@ class AsyncAdapt_dbapi_ss_cursor(AsyncAdapt_dbapi_cursor):
273268
274269 def close (self ) -> None :
275270 if self ._cursor is not None :
276- self . await_ (self ._cursor .close ())
271+ await_ (self ._cursor .close ())
277272 self ._cursor = None # type: ignore
278273
279274 def fetchone (self ) -> Optional [Any ]:
280- return self . await_ (self ._cursor .fetchone ())
275+ return await_ (self ._cursor .fetchone ())
281276
282277 def fetchmany (self , size : Optional [int ] = None ) -> Any :
283- return self . await_ (self ._cursor .fetchmany (size = size ))
278+ return await_ (self ._cursor .fetchmany (size = size ))
284279
285280 def fetchall (self ) -> Sequence [Any ]:
286- return self . await_ (self ._cursor .fetchall ())
281+ return await_ (self ._cursor .fetchall ())
287282
288283
289284class AsyncAdapt_dbapi_connection (AdaptedConnection ):
290285 _cursor_cls = AsyncAdapt_dbapi_cursor
291286 _ss_cursor_cls = AsyncAdapt_dbapi_ss_cursor
292287
293- await_ = staticmethod (await_only )
294288 __slots__ = ("dbapi" , "_execute_mutex" )
295289
296290 _connection : AsyncIODBAPIConnection
@@ -323,21 +317,15 @@ def _handle_exception(self, error: Exception) -> NoReturn:
323317
324318 def rollback (self ) -> None :
325319 try :
326- self . await_ (self ._connection .rollback ())
320+ await_ (self ._connection .rollback ())
327321 except Exception as error :
328322 self ._handle_exception (error )
329323
330324 def commit (self ) -> None :
331325 try :
332- self . await_ (self ._connection .commit ())
326+ await_ (self ._connection .commit ())
333327 except Exception as error :
334328 self ._handle_exception (error )
335329
336330 def close (self ) -> None :
337- self .await_ (self ._connection .close ())
338-
339-
340- class AsyncAdaptFallback_dbapi_connection (AsyncAdapt_dbapi_connection ):
341- __slots__ = ()
342-
343- await_ = staticmethod (await_fallback )
331+ await_ (self ._connection .close ())
0 commit comments