
    [h                        d Z ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlm	Z	  G d	 d
          Z
 G d de
          Z G d de          Z G d de          ZdS )z?generic asyncio-adapted versions of DBAPI connection and cursor    )annotationsN   )AdaptedConnection)asyncio)await_fallback)
await_onlyc                      e Zd ZdZdZd Zd Zed             Zed             Z	ed             Z
e
j        d             Z
ed	             Zd
 ZddZd Zd Zd Zd Zd Zd Zd ZddZd ZdS )AsyncAdapt_dbapi_cursorF)_adapt_connection_connectionawait__cursor_rowsc                    || _         |j        | _        |j        | _        | j                                        }|                     |          | _        | j        st          j                    | _	        d S d S N)
r   r   r   cursor_aenter_cursorr   server_sidecollectionsdequer   selfadapt_connectionr   s      l/var/www/api.easyaligner.net/htdocs/venv_linux/lib/python3.11/site-packages/sqlalchemy/connectors/asyncio.py__init__z AsyncAdapt_dbapi_cursor.__init__   sq    !1+7&-!((****622 	-$*,,DJJJ	- 	-    c                P    |                      |                                          S r   )r   
__aenter__)r   r   s     r   r   z&AsyncAdapt_dbapi_cursor._aenter_cursor*   s     {{6,,..///r   c                    | j         j        S r   )r   descriptionr   s    r   r    z#AsyncAdapt_dbapi_cursor.description-   s    |''r   c                    | j         j        S r   )r   rowcountr!   s    r   r#   z AsyncAdapt_dbapi_cursor.rowcount1   s    |$$r   c                    | j         j        S r   r   	arraysizer!   s    r   r&   z!AsyncAdapt_dbapi_cursor.arraysize5       |%%r   c                    || j         _        d S r   r%   r   values     r   r&   z!AsyncAdapt_dbapi_cursor.arraysize9   s    !&r   c                    | j         j        S r   )r   	lastrowidr!   s    r   r,   z!AsyncAdapt_dbapi_cursor.lastrowid=   r'   r   c                8    | j                                          d S r   )r   clearr!   s    r   closezAsyncAdapt_dbapi_cursor.closeA   s     	
r   Nc                T    |                      |                     ||                    S r   )r   _execute_async)r   	operation
parameterss      r   executezAsyncAdapt_dbapi_cursor.executeF   s$    {{4..y*EEFFFr   c                T    |                      |                     ||                    S r   )r   _executemany_asyncr   r2   seq_of_parameterss      r   executemanyz#AsyncAdapt_dbapi_cursor.executemanyI   s,    {{##I/@AA
 
 	
r   c                R  K   | j         j        4 d {V  | j                            ||pd           d {V }| j        j        r=| j        s6t          j        | j                                         d {V           | _	        |cd d d           d {V  S # 1 d {V swxY w Y   d S )N )
r   _execute_mutexr   r4   r    r   r   r   fetchallr   )r   r2   r3   results       r   r1   z&AsyncAdapt_dbapi_cursor._execute_asyncN   sL     )8 	 	 	 	 	 	 	 	<//	:;KLLLLLLLLF|' N0@ N(.T\5J5J5L5L/L/L/L/L/L/LMM
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A.B
B #B c                   K   | j         j        4 d {V  | j                            ||           d {V cd d d           d {V  S # 1 d {V swxY w Y   d S r   )r   r<   r   r9   r7   s      r   r6   z*AsyncAdapt_dbapi_cursor._executemany_asyncV   s     )8 	P 	P 	P 	P 	P 	P 	P 	P11)=NOOOOOOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   !A		
AAc                   |                      | j                                                   | j        j        rL| j        sGt          j        |                      | j                                                            | _        d S d S d S r   )	r   r   nextsetr    r   r   r   r=   r   r!   s    r   rA   zAsyncAdapt_dbapi_cursor.nextsetZ   s    DL((**+++<# 	D,< 	$*DL113344 DJJJ	 	 	 	r   c                F    |                       | j        j        |           S r   )r   r   setinputsizes)r   
inputsizess     r   rC   z%AsyncAdapt_dbapi_cursor.setinputsizesa   s#    
 {{54<5zBCCCr   c              #  `   K   | j         r$| j                                         V  | j         "d S d S r   r   popleftr!   s    r   __iter__z AsyncAdapt_dbapi_cursor.__iter__h   sJ      j 	'*$$&&&&& j 	' 	' 	' 	' 	'r   c                F    | j         r| j                                         S d S r   rF   r!   s    r   fetchonez AsyncAdapt_dbapi_cursor.fetchonel   s%    : 	:%%'''4r   c           	         || j         }| j        fdt          t          |t	                                        D             S )Nc                8    g | ]}                                 S r;   )rG   ).0_rrs     r   
<listcomp>z5AsyncAdapt_dbapi_cursor.fetchmany.<locals>.<listcomp>v   s!    @@@

@@@r   )r&   r   rangeminlen)r   sizerO   s     @r   	fetchmanyz!AsyncAdapt_dbapi_cursor.fetchmanyr   sH    <>DZ@@@@eCc"gg,>,>&?&?@@@@r   c                `    t          | j                  }| j                                         |S r   )listr   r.   )r   retvals     r   r=   z AsyncAdapt_dbapi_cursor.fetchallx   s*    dj!!
r   r   )__name__
__module____qualname__r   	__slots__r   r   propertyr    r#   r&   setterr,   r/   r4   r9   r1   r6   rA   rC   rH   rJ   rU   r=   r;   r   r   r
   r
      s       KI	- 	- 	-0 0 0 ( ( X( % % X% & & X& ' ' ' & & X&  
G G G G
 
 

  P P P  D D D' ' '  A A A A    r   r
   c                  <    e Zd ZdZdZd Zd Zd Zd
dZd Z	d	 Z
dS )AsyncAdapt_dbapi_ss_cursorr;   Tc                    || _         |j        | _        |j        | _        | j                                        }|                     |                                          | _        d S r   )r   r   r   r   r   r   r   s      r   r   z#AsyncAdapt_dbapi_ss_cursor.__init__   sV    !1+7&-!((**{{6#4#4#6#677r   c                ~    | j         5|                     | j                                                    d | _         d S d S r   )r   r   r/   r!   s    r   r/   z AsyncAdapt_dbapi_ss_cursor.close   s=    <#KK**,,---DLLL $#r   c                Z    |                      | j                                                  S r   )r   r   rJ   r!   s    r   rJ   z#AsyncAdapt_dbapi_ss_cursor.fetchone   "    {{4<0022333r   Nc                ^    |                      | j                            |                    S )N)rT   )r   r   rU   )r   rT   s     r   rU   z$AsyncAdapt_dbapi_ss_cursor.fetchmany   s'    {{4<11t1<<===r   c                Z    |                      | j                                                  S r   )r   r   r=   r!   s    r   r=   z#AsyncAdapt_dbapi_ss_cursor.fetchall   rd   r   c              #     K   | j                                         }	 	 |                     |                                          V  n# t          $ r Y d S w xY w=r   )r   	__aiter__r   	__anext__StopAsyncIteration)r   iterators     r   rH   z#AsyncAdapt_dbapi_ss_cursor.__iter__   sq      <))++	kk("4"4"6"6777777%   	s   )A 
AAr   )rY   rZ   r[   r\   r   r   r/   rJ   rU   r=   rH   r;   r   r   r`   r`   ~   s}        IK8 8 8     
4 4 4> > > >4 4 4    r   r`   c                      e Zd ZeZeZ ee          Z	dZ
d Zd Zd Zd Zed             Zej        d             Zdd	Zd
 Zd Zd ZdS )AsyncAdapt_dbapi_connection)dbapir<   c                R    || _         || _        t          j                    | _        d S r   )rn   r   r   Lockr<   )r   rn   
connections      r   r   z$AsyncAdapt_dbapi_connection.__init__   s%    
%%lnnr   c                \    |                      | j                            |                    S r   )r   r   ping)r   	reconnects     r   rs   z AsyncAdapt_dbapi_connection.ping   s%    {{4+00;;<<<r   c                *     | j         j        |i | d S r   )r   add_output_converter)r   argkws      r   rv   z0AsyncAdapt_dbapi_connection.add_output_converter   s#    --s9b99999r   c                4    | j                                         S r   )r   character_set_namer!   s    r   rz   z.AsyncAdapt_dbapi_connection.character_set_name   s    22444r   c                    | j         j        S r   )r   
autocommitr!   s    r   r|   z&AsyncAdapt_dbapi_connection.autocommit   s    **r   c                (    || j         j        _        d S r   )r   _connr|   r)   s     r   r|   z&AsyncAdapt_dbapi_connection.autocommit   s    
 -2)))r   Fc                Z    |r|                      |           S |                     |           S r   )_ss_cursor_cls_cursor_cls)r   r   s     r   r   z"AsyncAdapt_dbapi_connection.cursor   s2     	*&&t,,,##D)))r   c                ^    |                      | j                                                   d S r   )r   r   rollbackr!   s    r   r   z$AsyncAdapt_dbapi_connection.rollback   s)    D$--//00000r   c                ^    |                      | j                                                   d S r   )r   r   commitr!   s    r   r   z"AsyncAdapt_dbapi_connection.commit   s)    D$++--.....r   c                ^    |                      | j                                                   d S r   )r   r   r/   r!   s    r   r/   z!AsyncAdapt_dbapi_connection.close   s)    D$**,,-----r   N)F)rY   rZ   r[   r
   r   r`   r   staticmethodr   r   r\   r   rs   rv   rz   r]   r|   r^   r   r   r   r/   r;   r   r   rm   rm      s        )K/N\*%%F+I- - -
= = =: : :5 5 5 + + X+ 2 2 2* * * *1 1 1/ / /. . . . .r   rm   c                  (    e Zd ZdZ ee          ZdS )#AsyncAdaptFallback_dbapi_connectionr;   N)rY   rZ   r[   r\   r   r   r   r;   r   r   r   r      s"        I\.))FFFr   r   )__doc__
__future__r   r   enginer   util.concurrencyr   r   r   r
   r`   rm   r   r;   r   r   <module>r      s2   F E " " " " " "     & & & & & & & & & & & & - - - - - - ) ) ) ) ) )f f f f f f f fR! ! ! ! !!8 ! ! !H-. -. -. -. -."3 -. -. -.`* * * * **E * * * * *r   