U kf@sdZddlmZddlZddlmZddlmZddlmZddlm Z Gd d d Z Gd d d e Z Gd ddeZ Gddde Z dS)z?generic asyncio-adapted versions of DBAPI connection and cursor) annotationsN)AdaptedConnection)asyncio)await_fallback) await_onlyc@seZdZdZdZddZddZeddZed d Z ed d Z e j d d Z eddZ ddZ d'ddZddZddZddZddZddZdd Zd!d"Zd(d#d$Zd%d&ZdS))AsyncAdapt_dbapi_cursorF)_adapt_connection _connectionawait__cursor_rowscCs@||_|j|_|j|_|j}|||_|jsvsz5AsyncAdapt_dbapi_cursor.fetchmany..)rr rangeminlenrsizerr6r fetchmanyrsz!AsyncAdapt_dbapi_cursor.fetchmanycCst|j}|j|Sr)listr r")rretvalrrrr,xs  z AsyncAdapt_dbapi_cursor.fetchall)N)N)__name__ __module__ __qualname__r __slots__rrpropertyrrrsetterr!r#r'r*r$r(r.r/r2r3r=r,rrrrrs2        rc@sFeZdZdZdZddZddZddZdd d Zd d Z ddZ d S)AsyncAdapt_dbapi_ss_cursorrTcCs4||_|j|_|j|_|j}|||_dSr)r r r rrr rrrrrs  z#AsyncAdapt_dbapi_ss_cursor.__init__cCs$|jdk r ||jd|_dSr)r r r#rrrrr#s z AsyncAdapt_dbapi_ss_cursor.closecCs||jSr)r r r3rrrrr3sz#AsyncAdapt_dbapi_ss_cursor.fetchoneNcCs||jj|dS)N)r<)r r r=r;rrrr=sz$AsyncAdapt_dbapi_ss_cursor.fetchmanycCs||jSr)r r r,rrrrr,sz#AsyncAdapt_dbapi_ss_cursor.fetchallccs>|j}z||VWq tk r6Yq:Yq Xq dSr)r __aiter__r __anext__StopAsyncIteration)riteratorrrrr2s  z#AsyncAdapt_dbapi_ss_cursor.__iter__)N) r@rArBrCrrr#r3r=r,r2rrrrrF~s  rFc@s|eZdZeZeZeeZ dZ ddZ ddZ ddZ dd Zed d Zejd d ZdddZddZddZddZdS)AsyncAdapt_dbapi_connection)dbapir+cCs||_||_t|_dSr)rLr rLockr+)rrL connectionrrrrsz$AsyncAdapt_dbapi_connection.__init__cCs||j|Sr)r r ping)rZ reconnectrrrrOsz AsyncAdapt_dbapi_connection.pingcOs|jj||dSr)r add_output_converter)rargkwrrrrPsz0AsyncAdapt_dbapi_connection.add_output_convertercCs |jSr)r character_set_namerrrrrSsz.AsyncAdapt_dbapi_connection.character_set_namecCs|jjSr)r autocommitrrrrrTsz&AsyncAdapt_dbapi_connection.autocommitcCs||jj_dSr)r Z_connrTrrrrrTsFcCs|r||S||SdSr)_ss_cursor_cls _cursor_cls)rrrrrrs z"AsyncAdapt_dbapi_connection.cursorcCs||jdSr)r r rollbackrrrrrWsz$AsyncAdapt_dbapi_connection.rollbackcCs||jdSr)r r commitrrrrrXsz"AsyncAdapt_dbapi_connection.commitcCs||jdSr)r r r#rrrrr#sz!AsyncAdapt_dbapi_connection.closeN)F)r@rArBrrVrFrU staticmethodrr rCrrOrPrSrDrTrErrWrXr#rrrrrKs    rKc@seZdZdZeeZdS)#AsyncAdaptFallback_dbapi_connectionrN)r@rArBrCrYrr rrrrrZsrZ)__doc__ __future__rrZenginerZutil.concurrencyrrrrrFrKrZrrrr s     i$0