§
    YŠtj:   ã                  óŒ  — d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	 ddl
mZ ddlmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZm Z m!Z! ddlm"Z" ddl#m$Z$m%Z% ddlm&Z&m'Z'm(Z( ddl)m*Z*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl-m5Z5m6Z6m7Z7 ddl8m9Z9 	 ddl:Z:e;e:j<        fZ= ej>        d¦  «        Z? G d„ dee         e%¦  «        Z@ G d„ dee         ¦  «        ZA G d„ de¦  «        ZB G d „ d!eB¦  «        ZC G d"„ d#eB¦  «        ZD G d$„ d%eB¦  «        ZE G d&„ d'eB¦  «        ZF G d(„ d)eB¦  «        ZGdS )*z1
Psycopg connection pool module (async version).
é    )ÚannotationsN)ÚABCÚabstractmethod)Ú	monotonic)ÚTracebackType)ÚAnyÚGenericÚcast)Úref)Úasynccontextmanager)Údeque)ÚAsyncIterator)ÚAsyncConnection)Úerrors)ÚTransactionStatusé   )ÚACTÚAsyncConnectFailedCBÚAsyncConnectionCBÚAsyncConninfoParam)ÚAsyncKwargsParam)ÚAttemptWithBackoffÚBasePool)Ú
PoolClosedÚPoolTimeoutÚTooManyRequests)ÚPSYCOPG_VERSIONÚAsyncPoolConnectionÚSelf)Ú
AConditionÚAEventÚALockÚAQueueÚAWorkerÚagatherÚasleep)ÚaspawnÚcurrent_task_nameÚensure_async)ÚAsyncSchedulerTzpsycopg.poolc                  ó  ‡ — e Zd ZU ded<   	 dt eee         e¦  «        dddddddddddd	d
ddddœduˆ fd+„Z	 dvˆ fd/„Z
	 dvd1„Zdwdxd2„Zedydzd5„¦   «         Zdyd{d7„Zd|d9„Zd}d:„Zd~d<„Zdd>„Zdvd?„Zdd@„ZdvdA„Zd€dC„Zd�dD„Zd‚dƒdF„ZdvdG„Z	 dvdH„ZdvdI„ZdvdJ„Zd„dxdL„Zd…dN„Zd†dP„Z d‡dW„Z!dydˆdX„Z"dvdY„Z#e$ddZ„¦   «         Z%dvd[„Z&d‰d^„Z'dŠd`„Z(e)d‹dc„¦   «         Z*dyd{dd„Z+dŒdf„Z,d�dh„Z-	 dŽd�dl„Z.d€dm„Z/ddn„Z0ddo„Z1ddp„Z2dvdq„Z3d�ˆ fds„Z4ˆ xZ5S )‘ÚAsyncConnectionPoolz
deque[ACT]Ú_poolÚ Né   Fç      >@r   g      ¬@g     À‚@g     Àr@é   )Úconnection_classÚkwargsÚmin_sizeÚmax_sizeÚopenÚ	configureÚcheckÚresetÚnameÚclose_returnsÚtimeoutÚmax_waitingÚmax_lifetimeÚmax_idleÚreconnect_timeoutÚreconnect_failedÚnum_workersÚconninfor   r2   ú	type[ACT]r3   úAsyncKwargsParam | Noner4   Úintr5   ú
int | Noner6   úbool | Noner7   úAsyncConnectionCB[ACT] | Noner8   r9   r:   ú
str | Noner;   Úboolr<   Úfloatr=   r>   r?   r@   rA   úAsyncConnectFailedCB | NonerB   c               óR  •— |rIt           dk     r>|t          u r&t          t          t                   t
          ¦  «        }nt          d¦  «        ‚|| _        || _        || _	        || _
        || _        |	| _        || _        |  |  |  t          t          t                            ¦   «         | _        d | _        d | _        g | _        t)          ¦   «                              |||
|||||||¬¦
  «
         	 |r|                      ¦   «          |€	dx}| _        |r|                      ¦   «          d S d S )N)r1   r1   zÓUsing 'close_returns=True' and a non-standard 'connection_class' requires psycopg 3.3 or newer. Please check the docs at https://www.psycopg.org/psycopg3/docs/advanced/pool.html#pool-sqlalchemy for a workaround.)
r4   r5   r:   r;   r<   r=   r>   r?   r@   rB   T)r   r   r
   Útyper   r   Ú	TypeErrorrC   r3   r2   Ú_checkÚ
_configureÚ_resetÚ_reconnect_failedr   ÚWaitingClientÚ_waitingÚ_pool_full_eventÚ_sched_runnerÚ_workersÚsuperÚ__init__Ú_warn_open_asyncr"   Ú_lockÚ_open_implicitÚ_open)ÚselfrC   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   Ú	__class__s                      €úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/psycopg_pool/pool_async.pyr[   zAsyncConnectionPool.__init__1   s_  ø€ ð, ð 		�_¨vÒ5Ð5Ø¥?Ð2Ð2Ý#'­­S¬	Õ3FÑ#GÔ#GÐ Ð åð9ñô ð ð !ˆŒØˆŒØ 0ˆÔØˆŒØ#ˆŒØˆŒà!1ˆÔð 	ÐØÐ#ØÐ,å�m­CÔ0Ô1Ñ3Ô3ˆŒð 04ˆÔà-1ˆÔØ')ˆŒå‰Œ×ÒØØØØ'ØØ#Ø%ØØ/Ø#ð 	ñ 	
ô 	
ð 	
ð	!Øð (Ø×%Ò%Ñ'Ô'Ð'ð ˆ<Ø)-Ð-ˆD�4Ô&àð 	Ø�JŠJ‰LŒLˆLˆLˆLð	ð 	ó    ÚreturnÚNonec                ór   — t          | dd¦  «        rd S |                      ¦   «         }d}t          |d|dœŽ d S )NÚ_closedTzNyou can try to call 'close()' explicitly or to use the pool as context managerç      @)r<   Útimeout_hint)ÚgetattrÚ_signal_stop_workerr%   )r`   ÚworkersÚhints      rb   Ú__del__zAsyncConnectionPool.__del__…   sU   € õ �t˜Y¨Ñ-Ô-ð Ø�à×.Ò.Ñ0Ô0ˆGð8ð õ �W c¸Ð=Ð=Ð=Ð=Ð=Ð=rc   c                ó’   •— t          ¦   «                              ¦   «          | j        rd| _        	 |                      ¦   «          d S d S ©NF)	rZ   Ú_check_open_getconnr^   r\   ÚwarningsÚwarnrO   Ú__name__ÚDeprecationWarning)r`   ra   s    €rb   rq   z'AsyncConnectionPool._check_open_getconn’   sS   ø€ Ý‰Œ×#Ò#Ñ%Ô%Ð%àÔð 	Ø"'ˆDÔð
à×%Ò%Ñ'Ô'Ð'Ð'Ð'ð	ð 	rc   Tc                ó�   — t          j        dt          | ¦  «        j        › dt          | ¦  «        j        › d�t          ¦  «         d S )Nzopening the async pool z¯ in the constructor is deprecated and will not be supported anymore in a future release. Please use `await pool.open()`, or use the pool as context manager using: `async with z(...) as pool: `...)rr   rs   rO   rt   ÚRuntimeWarning©r`   s    rb   r\   z$AsyncConnectionPool._warn_open_async¦   sb   € ÝŒMðX­$¨t©*¬*Ô*=ð Xð Xõ 04°D©z¬zÔ/BðXð Xð Xõ ñô ð ð ð rc   c              ƒ  óÊ  K  — |                       ¦   «          | j        4 ƒd{V —† | j        rJ ‚t          | j        ¦  «        | j        k    r	 ddd¦  «        ƒd{V —† dS t          ¦   «         | _        ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   t                               d| j	        ¦  «         | j         
                    |¦  «        ƒ d{V —†s-|                      ¦   «         ƒ d{V —† t          d|› d�¦  «        ‚| j        4 ƒd{V —† | j        sJ ‚d| _        ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   t                               d| j	        ¦  «         dS )a-  
        Wait for the pool to be full (with `min_size` connections) after creation.

        Close the pool, and raise `PoolTimeout`, if not ready within *timeout*
        sec.

        Calling this method is not mandatory: you can try and use the pool
        immediately after its creation. The first client will be served as soon
        as a connection is ready. You can use this method if you prefer your
        program to terminate in case the environment is not configured
        properly, rather than trying to stay up the hardest it can.
        Nz"waiting for pool %r initializationz%pool initialization incomplete after ú seczpool %r is ready to use)rq   r]   rW   Úlenr-   Ú	_min_sizer!   ÚloggerÚinfor:   Úwait_timeoutÚcloser   )r`   r<   s     rb   ÚwaitzAsyncConnectionPool.wait¯   s¸  è è € ð 	× Ò Ñ"Ô"Ð"à”:ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ØÔ,Ð,Ð,Ð,Ý�4”:‰Œ $¤.Ò0Ð0Øð	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-õ %+¡H¤HˆDÔ!ð		-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-õ 	�ŠÐ8¸$¼)ÑDÔDÐDØÔ*×7Ò7¸Ñ@Ô@Ð@Ð@Ð@Ð@Ð@Ð@ð 	UØ—*’*‘,”,ÐÐÐÐÐÐÐÝÐSÀgÐSÐSÐSÑTÔTÐTà”:ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ØÔ(Ð(Ð(Ð(Ø$(ˆDÔ!ð	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)øøøð 	)ð 	)ð 	)ð 	)õ 	�ŠÐ-¨t¬yÑ9Ô9Ð9Ð9Ð9s)   ¤(BÁBÂ
BÂBÄD2Ä2
D<Ä?D<úfloat | NoneúAsyncIterator[ACT]c           
    ó$  K  — |                       |¬¦  «        ƒ d{V —†}	 t          ¦   «         }|4 ƒd{V —† |W V — ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   |                      |¦  «        ƒ d{V —† t          ¦   «         }| j        | j        xx         t          d||z
  z  ¦  «        z  cc<   dS # |                      |¦  «        ƒ d{V —† t          ¦   «         }| j        | j        xx         t          d||z
  z  ¦  «        z  cc<   w xY w)a&  Context manager to obtain a connection from the pool.

        Return the connection immediately if available, otherwise wait up to
        *timeout* or `self.timeout` seconds and throw `PoolTimeout` if a
        connection is not available in time.

        Upon context exit, return the connection to the pool. Apply the normal
        :ref:`connection context behaviour <with-connection>` (commit/rollback
        the transaction in case of success/error). If the connection is no more
        in working state, replace it with a new one.
        ©r<   Nç     @�@)Úgetconnr   ÚputconnÚ_statsÚ	_USAGE_MSrF   )r`   r<   ÚconnÚt0Út1s        rb   Ú
connectionzAsyncConnectionPool.connectionÏ   sÏ  è è € ð —\’\¨'�\Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ˆð	CÝ‘”ˆBØð ð ð ð ð ð ð ð Ø�
�
�
�
ðð ð ñ ô ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð øøøð ð ð ð ð —,’,˜tÑ$Ô$Ð$Ð$Ð$Ð$Ð$Ð$Ð$Ý‘”ˆBØŒK˜œÐ'Ð'Ô'­3¨v¸¸b¹Ñ/AÑ+BÔ+BÑBÐ'Ð'Ñ'Ð'Ð'øð —,’,˜tÑ$Ô$Ð$Ð$Ð$Ð$Ð$Ð$Ð$Ý‘”ˆBØŒK˜œÐ'Ð'Ô'­3¨v¸¸b¹Ñ/AÑ+BÔ+BÑBÐ'Ð'Ñ'Ð'Ð'Ð'Ð's.    B7 ¶A¼B7 Á
AÁB7 ÁAÁB7 Â7ADr   c              ƒ  óT  K  — |€| j         }t          ¦   «         |z   }t                               d| j        ¦  «         | j        | j        xx         dz  cc<   |                      ¦   «          	 |                      |¦  «        ƒ d{V —†S # t          $ r t          d|d›d�¦  «        d‚w xY w)a„  Obtain a connection from the pool.

        You should preferably use `connection()`. Use this function only if
        it is not possible to use the connection as context manager.

        After using this function you *must* call a corresponding `putconn()`:
        failing to do so will deplete the pool. A depleted pool is a sad pool:
        you don't want a depleted pool.
        Nzconnection requested from %rr   ú couldn't get a connection after ú.2frz   )
r<   r   r}   r~   r:   r‰   Ú_REQUESTS_NUMrq   Ú_getconn_with_check_loopr   )r`   r<   Údeadlines      rb   r‡   zAsyncConnectionPool.getconnæ   sÚ   è è € ð ˆ?Ø”lˆGÝ‘;”; Ñ(ˆå�ŠÐ2°D´IÑ>Ô>Ð>ØŒ�DÔ&Ð'Ð'Ô'¨1Ñ,Ð'Ð'Ñ'à× Ò Ñ"Ô"Ð"ð	Ø×6Ò6°xÑ@Ô@Ð@Ð@Ð@Ð@Ð@Ð@Ð@øõ ð 	ð 	ð 	ÝØD°7ÐDÐDÐDÐDñô àðð	øøøs   Á,B Â B'r”   c              ƒ  ó&  K  — d }	 |                       |t          ¦   «         z
  ¦  «        ƒ d {V —†}	 |                      |¦  «        ƒ d {V —† t                               d| j        ¦  «         |S # t          $ r  |                      |d¬¦  «        ƒ d {V —† Y nw xY wt          ¦   «         }|st          ||z
  ¬¦  «        }n| 	                    |¦  «         | 
                    |¦  «        rt          ¦   «         ‚t          |j        ¦  «        ƒ d {V —† �Œ)NTzconnection given by %r©Úfrom_getconnr…   )Ú_getconn_uncheckedr   Ú_check_connectionr}   r~   r:   ÚCLIENT_EXCEPTIONSÚ_putconnr   Úupdate_delayÚtime_to_give_upr   r&   Údelay)r`   r”   Úattemptr‹   Únows        rb   r“   z,AsyncConnectionPool._getconn_with_check_loop  sV  è è € Ø-1ˆð	,Ø×0Ò0°½I¹K¼KÑ1GÑHÔHÐHÐHÐHÐHÐHÐHˆDðØ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2õ —’Ð4°d´iÑ@Ô@Ð@Ø�øõ	 %ð =ð =ð =Ø—m’m D°t�mÑ<Ô<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<Ð<ð=øøøõ ‘+”+ˆCØð *Ý,°XÀ±^ÐDÑDÔD��à×$Ò$ SÑ)Ô)Ð)à×&Ò& sÑ+Ô+ð ,Ý!‘m”mÐ#å˜Wœ]Ñ+Ô+Ð+Ð+Ð+Ð+Ð+Ð+Ð+ñ+	,s   ±A. Á.'BÂBc           
   ƒ  ój  K  — | j         4 ƒd {V —† |                      |¦  «        ƒ d {V —†x}sdt          ¦   «         }t          ¦   «         }| j                             |¦  «         | j        | j        xx         dz  cc<   |                      ¦   «          d d d ¦  «        ƒd {V —† n# 1 ƒd {V —†swxY w Y   |sõ	 | 	                    |¬¦  «        ƒ d {V —†}nZ# t          $ rM |j        r*|                      t          | |j        d¬¦  «        ¦  «         | j        | j        xx         dz  cc<   ‚ w xY w	 t          ¦   «         }| j        | j        xx         t!          d||z
  z  ¦  «        z  cc<   n@# t          ¦   «         }| j        | j        xx         t!          d||z
  z  ¦  «        z  cc<   w xY w| |_        |S )Nr   r…   Tr–   r†   )r]   Ú_get_ready_connectionr   rU   rV   Úappendr‰   Ú_REQUESTS_QUEUEDÚ_maybe_grow_poolr�   rš   r‹   Úrun_taskÚReturnConnectionÚ_REQUESTS_ERRORSÚ_REQUESTS_WAIT_MSrF   r-   )r`   r<   r‹   rŒ   Úposr�   s         rb   r˜   z&AsyncConnectionPool._getconn_unchecked  s�  è è € ð ”:ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(Ø#'×#=Ò#=¸gÑ#FÔ#FÐFÐFÐFÐFÐFÐFÐG�Dð (å‘[”[�Ý*7©/¬/�Ø”×$Ò$ SÑ)Ô)Ð)Ø”˜DÔ1Ð2Ð2Ô2°aÑ7Ð2Ð2Ñ2ð ×%Ò%Ñ'Ô'Ð'ð		(ð 		(ð 		(ñ 		(ô 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(ð 		(øøøð 		(ð 		(ð 		(ð 		(ð ð 
	Oð	OØ ŸXšX¨g˜XÑ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6��øÝ$ð ð ð Ø”8ð WØ—M’MÕ"2°4¸¼ÐPTÐ"UÑ"UÔ"UÑVÔVÐVØ”˜DÔ1Ð2Ð2Ô2°aÑ7Ð2Ð2Ñ2Øð	øøøð õ ‘[”[�Ø”˜DÔ2Ð3Ð3Ô3µs¸6ÀRÈ"ÁWÑ;MÑ7NÔ7NÑNÐ3Ð3Ñ3Ð3øõ ‘[”[�Ø”˜DÔ2Ð3Ð3Ô3µs¸6ÀRÈ"ÁWÑ;MÑ7NÔ7NÑNÐ3Ð3Ñ3Ð3Ð3Ð3Ð3ð
 ˆŒ
Øˆs1   �BB$Â$
B.Â1B.Â8C ÃE, ÃAD,Ä,E, Å,=F)ú
ACT | Nonec              ƒ  ó¾  K  — |�|dk    rt          ¦   «         ‚d}| j        rP| j                             ¦   «         }t          | j        ¦  «        | j        k     rt          | j        ¦  «        | _        nk| j        rdt          | j        ¦  «        | j        k    rG| j        | j        xx         dz  cc<   t          d| j
        ›dt          | j        ¦  «        › d�¦  «        ‚|S )z0Return a connection, if the client deserves one.Ng        r   ú	the pool z has already z requests waiting)r   r-   Úpopleftr{   Ú_nconns_minr=   rV   r‰   r¨   r   r:   )r`   r<   r‹   s      rb   r¢   z)AsyncConnectionPool._get_ready_connection?  sò   è è € àÐ 7¨c¢> >Ý‘-”-ÐàˆØŒ:ð 
	à”:×%Ò%Ñ'Ô'ˆDÝ�4”:‰Œ Ô!1Ò1Ð1Ý#& t¤z¡?¤?�Ô øØÔð 	¥# d¤mÑ"4Ô"4¸Ô8HÒ"HÐ"HØŒK˜Ô-Ð.Ð.Ô.°!Ñ3Ð.Ð.Ñ.Ý!ð:˜DœIð :ð :Ý˜œÑ&Ô&ð:ð :ð :ñô ð ð ˆrc   r‹   c              ƒ  ó°   K  — | j         sd S 	 |                       |¦  «        ƒ d {V —† d S # t          $ r!}t                               d|¦  «         ‚ d }~ww xY w)Nzconnection failed check: %s)rQ   rš   r}   r~   )r`   r‹   Úes      rb   r™   z%AsyncConnectionPool._check_connectionR  s{   è è € ØŒ{ð 	ØˆFð	Ø—+’+˜dÑ#Ô#Ð#Ð#Ð#Ð#Ð#Ð#Ð#Ð#Ð#øÝ ð 	ð 	ð 	Ý�KŠKÐ5°qÑ9Ô9Ð9Øøøøøð	øøøs   �* ª
A´AÁAc                óú   — | j         | j        k    s| j        rd S | xj         dz  c_         t                               d| j        | j         ¦  «         d| _        |                      t          | d¬¦  «        ¦  «         d S )Nr   úgrowing pool %r to %sT©Úgrowing)Ú_nconnsÚ	_max_sizeÚ_growingr}   r~   r:   r¦   ÚAddConnectionrx   s    rb   r¥   z$AsyncConnectionPool._maybe_grow_pool[  sv   € ð Œ<˜4œ>Ò)Ð)¨T¬]Ð)ØˆFØˆŒ˜ÑˆŒÝ�ŠÐ+¨T¬Y¸¼ÑEÔEÐEØˆŒØ�Š•m D°$Ð7Ñ7Ô7Ñ8Ô8Ð8Ð8Ð8rc   c              ƒ  óè   K  — |                       |¦  «         t                               d| j        ¦  «         |                      |¦  «        ƒ d{V —†rdS |                      |d¬¦  «        ƒ d{V —† dS )zÞReturn a connection to the loving hands of its pool.

        Use this function only paired with a `getconn()`. You don't need to use
        it if you use the much more comfortable `connection()` context manager.
        zreturning connection to %rNFr–   )Ú_check_pool_putconnr}   r~   r:   Ú_maybe_close_connectionr›   ©r`   r‹   s     rb   rˆ   zAsyncConnectionPool.putconne  sŽ   è è € ð 	× Ò  Ñ&Ô&Ð&å�ŠÐ0°$´)Ñ<Ô<Ð<Ø×-Ò-¨dÑ3Ô3Ð3Ð3Ð3Ð3Ð3Ð3ð 	ØˆFà�mŠm˜D¨uˆmÑ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5Ð5Ð5Ð5rc   c              ƒ  óp  K  — | j         4 ƒd{V —† t          | j        ¦  «        }| j                             ¦   «          t	          ¦   «         | _        ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   |D ]?}|                      |¦  «        ƒ d{V —† |                      t          | ¦  «        ¦  «         Œ@dS )ak  
        Remove all the connections from the pool and create new ones.

        If a connection is currently out of the pool it will be closed when
        returned to the pool and replaced with a new one.

        This method is useful to force a connection re-configuration, for
        example when the adapters map changes after the pool was created.
        N)	r]   Úlistr-   Úclearr   Ú_drained_atÚ_close_connectionr¦   r¹   ©r`   Úconnsr‹   s      rb   ÚdrainzAsyncConnectionPool.draint  sL  è è € ð ”:ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+Ý˜œÑ$Ô$ˆEØŒJ×ÒÑÔÐÝ(™{œ{ˆDÔð	+ð 	+ð 	+ñ 	+ô 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+øøøð 	+ð 	+ð 	+ð 	+ð ð 	/ð 	/ˆDØ×(Ò(¨Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.Ø�MŠM�-¨Ñ-Ô-Ñ.Ô.Ð.Ð.ð	/ð 	/s   �AA#Á#
A-Á0A-r—   c              ƒ  ó    K  — | j         r'|                      t          | ||¬¦  «        ¦  «         d S |                      ||¬¦  «        ƒ d {V —† d S ©Nr–   )rS   r¦   r§   Ú_return_connection©r`   r‹   r—   s      rb   r›   zAsyncConnectionPool._putconnˆ  sj   è è € àŒ;ð 	KØ�MŠMÕ*¨4°ÀLÐQÑQÔQÑRÔRÐRÐRÐRà×)Ò)¨$¸\Ð)ÑJÔJÐJÐJÐJÐJÐJÐJÐJÐJÐJrc   c              ƒ  óR   K  — | j         sdS |                      |¦  «        ƒ d{V —† dS )zgClose a returned connection if necessary.

        Return `!True if the connection was closed.
        FNT)rg   rÂ   r½   s     rb   r¼   z+AsyncConnectionPool._maybe_close_connection�  sB   è è € ð Œ|ð 	Ø�5à×$Ò$ TÑ*Ô*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Øˆtrc   r�   c              ƒ  óþ   K  — 	 |                       ¦   «          | j        4 ƒd{V —† |                      ¦   «          ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   |r|                      |¬¦  «        ƒ d{V —† dS dS )a`  Open the pool by starting connecting and and accepting clients.

        If *wait* is `!False`, return immediately and let the background worker
        fill the pool if `min_size` > 0. Otherwise wait up to *timeout* seconds
        for the requested number of connections to be ready (see `wait()` for
        details).

        It is safe to call `!open()` again on a pool already open (because the
        method was already called, or because the pool context was entered, or
        because the pool was initialized with *open* = `!True`) but you cannot
        currently re-open a closed pool.
        TNr…   )Ú_ensure_lockr]   r_   r�   )r`   r�   r<   s      rb   r6   zAsyncConnectionPool.openœ  s!  è è € ð	 à×ÒÑÔÐà”:ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	Ø�JŠJ‰LŒLˆLð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð ð 	-Ø—)’) G�)Ñ,Ô,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Ð,ð	-ð 	-s   ¥AÁ
AÁAc                ó"  — | j         sd S |                      ¦   «          	 |                      ¦   «          t          ¦   «         | _        t          ¦   «         | _        d| _         d| _        |                      ¦   «          |  	                    ¦   «          d S )NTF)
rg   Ú_check_openrÌ   r#   Ú_tasksr*   Ú_schedÚ_openedÚ_start_workersÚ_start_initial_tasksrx   s    rb   r_   zAsyncConnectionPool._open³  sŽ   € ØŒ|ð 	ØˆFà×ÒÑÔÐð	 ð ×ÒÑÔÐõ ‘h”hˆŒÝ$Ñ&Ô&ˆŒàˆŒØˆŒà×ÒÑÔÐØ×!Ò!Ñ#Ô#Ð#Ð#Ð#rc   c                óð   — 	 | j          dS # t          $ r Y nw xY w	 t          j        ¦   «          n3# t          $ r& t	          t          | ¦  «        j        › d�¦  «        d‚w xY wt          ¦   «         | _         dS )z;Make sure the pool lock is created and the loop is running.Nz open with no running loop)r]   ÚAttributeErrorÚasyncioÚget_running_loopÚRuntimeErrorrO   rt   r"   rx   s    rb   rÌ   z AsyncConnectionPool._ensure_lockË  s    € ðØ”
�
Ø�øÝ!ð ð ð Ø�ðøøøðÝÔ(Ñ*Ô*Ð*Ð*øÝð ð ð Ý"Ý˜D‘z”zÔ*ÐFÐFÐFñô àððøøøõ
 ™œˆDŒJˆJˆJs   ‚ ‹
—œ0 °0A c                ó  — t          | j        j        | j        › d�¬¦  «        | _        | j        rJ ‚t          | j        ¦  «        D ]C}t          | j        | j	        f| j        › d|› �¬¦  «        }| j         
                    |¦  «         ŒDd S )Nz
-scheduler)r:   z-worker-)Úargsr:   )r'   rÐ   Úrunr:   rX   rY   ÚrangerB   ÚworkerrÏ   r£   )r`   ÚiÚts      rb   rÒ   z"AsyncConnectionPool._start_workersÜ  sœ   € Ý# D¤K¤O¸T¼YÐ:RÐ:RÐ:RÐSÑSÔSˆÔØ”=Ð Ð Ð Ý�tÔ'Ñ(Ô(ð 	$ð 	$ˆAÝ�t”{¨$¬+¨ÀÄÐ>WÐ>WÐTUÐ>WÐ>WÐXÑXÔXˆAØŒM× Ò  Ñ#Ô#Ð#Ð#ð	$ð 	$rc   c                óä   — t          | j        ¦  «        D ]$}|                      t          | ¦  «        ¦  «         Œ%|                      t	          | t          | ¦  «        | j        ¦  «        ¦  «         d S ©N)rÜ   r¶   r¦   r¹   ÚScheduleÚ
ShrinkPoolr?   )r`   rÞ   s     rb   rÓ   z(AsyncConnectionPool._start_initial_tasksã  sh   € å�t”|Ñ$Ô$ð 	/ð 	/ˆAØ�MŠM�-¨Ñ-Ô-Ñ.Ô.Ð.Ð.ð 	�Š•h˜t¥Z°Ñ%5Ô%5°t´}ÑEÔEÑFÔFÐFÐFÐFrc   rh   c              ƒ  ó„  K  — | j         rdS | j        4 ƒd{V —† d| _         t                               d| j        ¦  «         t          | j        ¦  «        }| j                             ¦   «          t          | j        ¦  «        }| j                             ¦   «          |  	                    ¦   «         ƒ d{V —†}ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   t          |d|iŽƒ d{V —† |D ]}|                      |¦  «        ƒ d{V —† Œ|D ]3}|                     t          d| j        ›d�¦  «        ¦  «        ƒ d{V —† Œ4dS )aÆ  Close the pool and make it unavailable to new clients.

        All the waiting and future clients will fail to acquire a connection
        with a `PoolClosed` exception. Currently used connections will not be
        closed until returned to the pool.

        Wait *timeout* seconds for threads to terminate their job, if positive.
        If the timeout expires the pool is closed anyway, although it may raise
        some warnings on exit.
        NTzpool %r closedr<   r­   z
 is closed)rg   r]   r}   Údebugr:   r¿   rV   rÀ   r-   rk   r%   rÂ   Úfailr   )r`   r<   ÚwaitingÚconnectionsrl   r‹   rª   s          rb   r€   zAsyncConnectionPool.closeì  s  è è € ð Œ<ð 	ØˆFà”:ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ØˆDŒLÝ�LŠLÐ)¨4¬9Ñ5Ô5Ð5õ ˜4œ=Ñ)Ô)ˆGØŒM×ÒÑ!Ô!Ð!Ý˜tœzÑ*Ô*ˆKØŒJ×ÒÑÔÐð !×4Ò4Ñ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6ˆGð	7ð 	7ð 	7ñ 	7ô 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7øøøð 	7ð 	7ð 	7ð 	7õ" �wÐ0¨Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0ð  ð 	/ð 	/ˆDØ×(Ò(¨Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.Ð.ð ð 	Lð 	LˆCØ—(’(�:Ð&I°$´)Ð&IÐ&IÐ&IÑJÔJÑKÔKÐKÐKÐKÐKÐKÐKÐKÐKð	Lð 	Ls   ™BCÃ
CÃCúlist[AWorker]c              ƒ  ó  K  — | j                              dd ¦  «        ƒ d {V —† | j        d d …         g c}| _        |D ]$}|                      t	          | ¦  «        ¦  «         Œ%| j        r!|                     | j        ¦  «         d | _        |S )Nr   )rÐ   ÚenterrY   r¦   Ú
StopWorkerrX   r£   )r`   rl   Ú_s      rb   rk   z'AsyncConnectionPool._signal_stop_worker  s¤   è è € àŒk×Ò  4Ñ(Ô(Ð(Ð(Ð(Ð(Ð(Ð(Ð(ð "&¤¨q¨q¨qÔ!1°2Ðˆ�”Øð 	,ð 	,ˆAØ�MŠM�* TÑ*Ô*Ñ+Ô+Ð+Ð+àÔð 	&Ø�NŠN˜4Ô-Ñ.Ô.Ð.Ø!%ˆDÔàˆrc   r   c              ƒ  óL   K  — d| _         |                      ¦   «         ƒ d {V —† | S rp   )r^   r6   rx   s    rb   Ú
__aenter__zAsyncConnectionPool.__aenter__$  s3   è è € Ø#ˆÔØ�iŠi‰kŒkÐÐÐÐÐÐÐØˆrc   Úexc_typeútype[BaseException] | NoneÚexc_valúBaseException | NoneÚexc_tbúTracebackType | Nonec              ƒ  ó>   K  — |                       ¦   «         ƒ d {V —† d S rá   )r€   )r`   rð   rò   rô   s       rb   Ú	__aexit__zAsyncConnectionPool.__aexit__)  s.   è è € ð �jŠj‰lŒlÐÐÐÐÐÐÐÐÐrc   c              ƒ  ó¶  K  — |                       ||¦  «        \  }}t          d|| j        z
  ¦  «        }t                               d| j        ||¦  «         | j        4 ƒd{V —† || _        || _        | xj        |z  c_        ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   t          |¦  «        D ]$}|  
                    t          | ¦  «        ¦  «         Œ%dS )z+Change the size of the pool during runtime.r   z&resizing %r to min_size=%s max_size=%sN)Ú_check_sizeÚmaxr|   r}   r~   r:   r]   r·   r¶   rÜ   r¦   r¹   )r`   r4   r5   ÚngrowrÞ   s        rb   ÚresizezAsyncConnectionPool.resize1  sl  è è € à!×-Ò-¨h¸ÑAÔAÑˆ�(å�A�x $¤.Ñ0Ñ1Ô1ˆå�ŠØ4°d´iÀÈ8ñ	
ô 	
ð 	
ð ”:ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"Ø%ˆDŒNØ%ˆDŒNØˆLŒL˜EÑ!ˆLŒLð	"ð 	"ð 	"ñ 	"ô 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"øøøð 	"ð 	"ð 	"ð 	"õ
 �u‘”ð 	/ð 	/ˆAØ�MŠM�-¨Ñ-Ô-Ñ.Ô.Ð.Ð.ð	/ð 	/s   Á#BÂ
BÂ!Bc              ƒ  óD  K  — | j         4 ƒd{V —† t          | j        ¦  «        }| j                             ¦   «          |                      ¦   «          ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   |�r(|                     ¦   «         }|j        t          ¦   «         k    rYt           	                    d|¦  «         |  
                    |¦  «        ƒ d{V —† |                      t          | ¦  «        ¦  «         Œ‡	 |                      |¦  «        ƒ d{V —† |                      |¦  «        ƒ d{V —† ng# t          $ rZ | j        | j        xx         dz  cc<   t                               d|¦  «         |                      t          | ¦  «        ¦  «         Y nw xY w|�°&dS dS )z»Verify the state of the connections currently in the pool.

        Test each connection: if it works return it to the pool, otherwise
        dispose of it and create a new one.
        Nz discarding expired connection %sr   z discarding broken connection: %s)r]   r¿   r-   rÀ   r¥   ÚpopÚ
_expire_atr   r}   r~   rÂ   r¦   r¹   Úcheck_connectionÚ_add_to_poolrš   r‰   Ú_CONNECTIONS_LOSTÚwarningrÃ   s      rb   r8   zAsyncConnectionPool.checkB  s_  è è € ð ”:ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$Ý˜œÑ$Ô$ˆEØŒJ×ÒÑÔÐð
 ×!Ò!Ñ#Ô#Ð#ð	$ð 	$ð 	$ñ 	$ô 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$øøøð 	$ð 	$ð 	$ð 	$ð ñ 	.Ø—9’9‘;”;ˆDð Œ¥)¡+¤+Ò-Ð-Ý—’Ð>ÀÑEÔEÐEØ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ø—’�m¨DÑ1Ô1Ñ2Ô2Ð2Øð.Ø×+Ò+¨DÑ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1Ð1ð ×'Ò'¨Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ð-øõ %ð 3ð 3ð 3Ø”˜DÔ2Ð3Ð3Ô3°qÑ8Ð3Ð3Ñ3Ý—’ÐAÀ4ÑHÔHÐHØ—’�m¨DÑ1Ô1Ñ2Ô2Ð2Ð2Ð2ð3øøøð ñ 	.ð 	.ð 	.ð 	.ð 	.s%   �AA$Á$
A.Á1A.Ã=D4 Ä4A!FÆFc              ƒ  ó8  K  — | j         r|                      d¦  «        ƒ d{V —† dS 	 |                      d¦  «        ƒ d{V —† 	 |                      d¦  «        ƒ d{V —† |                      d¦  «        ƒ d{V —† dS # |                      d¦  «        ƒ d{V —† w xY w)a>  
        A simple check to verify that a connection is still working.

        Return quietly if the connection is still working, otherwise raise
        an exception.

        Used internally by `check()`, but also available for client usage,
        for instance as `!check` callback when a pool is created.
        r.   NTF)Ú
autocommitÚexecuteÚset_autocommit)r‹   s    rb   r   z$AsyncConnectionPool.check_connectione  sê   è è € ð Œ?ð 	,Ø—,’,˜rÑ"Ô"Ð"Ð"Ð"Ð"Ð"Ð"Ð"Ð"Ð"ð,ð ×)Ò)¨$Ñ/Ô/Ð/Ð/Ð/Ð/Ð/Ð/Ð/ð5ØŸ,š, rÑ*Ô*Ð*Ð*Ð*Ð*Ð*Ð*Ð*à×-Ò-¨eÑ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4Ð4Ð4Ð4ø˜$×-Ò-¨eÑ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4Ð4Ð4øøøs   ÁA< Á<Bc              ƒ  óR   K  — | j         sdS t          | j         | ¦  «        ƒ d{V —† dS )zV
        Called when reconnection failed for longer than `reconnect_timeout`.
        N)rT   r)   rx   s    rb   rA   z$AsyncConnectionPool.reconnect_failedƒ  sC   è è € ð Ô%ð 	ØˆFå˜4Ô1°4Ñ8Ô8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8rc   ÚtaskÚMaintenanceTaskc                ó:   — | j                              |¦  «         dS )z#Run a maintenance task in a worker.N)rÏ   Ú
put_nowait)r`   r	  s     rb   r¦   zAsyncConnectionPool.run_taskŒ  s   € àŒ×Ò˜tÑ$Ô$Ð$Ð$Ð$rc   rž   c              ƒ  óV   K  — | j                              ||j        ¦  «        ƒ d{V —† dS )z1Run a maintenance task in a worker in the future.N)rÐ   rë   Útick)r`   r	  rž   s      rb   Úschedule_taskz!AsyncConnectionPool.schedule_task�  s8   è è € àŒk×Ò  t¤yÑ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1Ð1Ð1Ð1rc   ÚqúAQueue[MaintenanceTask]c              ƒ  ón  K  — 	 t          |                     ¦   «         ƒ d{V —†x}t          ¦  «        r)t                               dt          ¦   «         ¦  «         dS 	 |                     ¦   «         ƒ d{V —† n># t          $ r1}t                               d||j	        j
        |¦  «         Y d}~nd}~ww xY wŒ³)zÒRunner to execute pending maintenance task.

        The function is designed to run as a task.

        Block on the queue *q*, run a task received. Finish running if a
        StopWorker is received.
        TNzterminating working task %sztask run %s failed: %s: %s)Ú
isinstanceÚgetrì   r}   rå   r(   rÛ   rš   r  ra   rt   )Úclsr  r	  Úexs       rb   rÝ   zAsyncConnectionPool.worker”  sà   è è € ð	Ý¨!¯%ª%©'¬' M M M M M MÐ2˜4µZÑ@Ô@ð Ý—’Ð:Õ<MÑ<OÔ<OÑPÔPÐPØ�ðØ—h’h‘j”jÐ Ð Ð Ð Ð Ð Ð Ð øÝ$ð ð ð Ý—’Ø0°$¸¼Ô8MÈrñô ð ð ð ð ð ð øøøøðøøøð	s   ÁA8 Á8
B3Â'B.Â.B3c              ƒ  óH  K  — | j         | j        xx         dz  cc<   |                      ¦   «         ƒ d{V —†}|                      ¦   «         ƒ d{V —†}|r4|                     ¦   «         }t          t          |¦  «        d¦  «        |d<   t          ¦   «         }	  | j        j	        |fi |¤Žƒ d{V —†}t          ¦   «         }| j         | j
        xx         t          d||z
  z  ¦  «        z  cc<   n)# t          $ r | j         | j        xx         dz  cc<   ‚ w xY w| |_        | j        rk|                      |¦  «        ƒ d{V —† |j        j        x}t$          j        k    r4t%          |¦  «        j        }t+          j        d|› d| j        › d�¦  «        ‚|                      |¦  «         |S )z0Return a new connection configured for the pool.r   NÚconnect_timeoutr†   úconnection left in status z by configure function ú: discarded)r‰   Ú_CONNECTIONS_NUMÚ_resolve_conninfoÚ_resolve_kwargsÚcopyrú   Úroundr   r2   ÚconnectÚ_CONNECTIONS_MSrF   rš   Ú_CONNECTIONS_ERRORSr-   rR   ÚpgconnÚtransaction_statusr   ÚIDLEr:   r±   ÚProgrammingErrorÚ_set_connection_expiry_date)	r`   r<   rC   r3   rŒ   r‹   r�   ÚstatusÚsnames	            rb   Ú_connectzAsyncConnectionPool._connectª  s  è è € àŒ�DÔ)Ð*Ð*Ô*¨aÑ/Ð*Ð*Ñ*Ø×/Ò/Ñ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1ˆØ×+Ò+Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-ˆØð 	?Ø—[’[‘]”]ˆFÝ(+­E°'©N¬N¸AÑ(>Ô(>ˆFÐ$Ñ%Ý‰[Œ[ˆð	IØ6˜Ô.Ô6°xÐJÐJÀ6ÐJÐJÐJÐJÐJÐJÐJÐJˆDõ
 ‘”ˆBØŒK˜Ô,Ð-Ð-Ô-µ°V¸rÀB¹wÑ5GÑ1HÔ1HÑHÐ-Ð-Ñ-Ð-øõ !ð 	ð 	ð 	ØŒK˜Ô0Ð1Ð1Ô1°QÑ6Ð1Ð1Ñ1Øð	øøøð ˆŒ
àŒ?ð 	Ø—/’/ $Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Øœ+Ô8Ð8�Õ=NÔ=SÒSÐSÝ)¨&Ñ1Ô1Ô6�ÝÔ(ð5°ð 5ð 5Øœð5ð 5ð 5ñô ð ð 	×(Ò(¨Ñ.Ô.Ð.Øˆs   ÂC+ Ã+&DÚstrc              ƒ  ót   K  — t          | j        ¦  «        rt          | j        ¦  «        ƒ d{V —†S | j        pdS )zCResolve conninfo (static string, sync callable, or async callable).Nr.   )ÚcallablerC   r)   rx   s    rb   r  z%AsyncConnectionPool._resolve_conninfoË  sG   è è € å�D”MÑ"Ô"ð 	5Ý% d¤mÑ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4Ð4àŒ}Ð" Ð"rc   údict[str, Any]c              ƒ  ó‚   K  — | j         si S t          | j         ¦  «        rt          | j         ¦  «        ƒ d{V —†S | j         S )z?Resolve kwargs (static dict, sync callable, or async callable).N)r3   r-  r)   rx   s    rb   r  z#AsyncConnectionPool._resolve_kwargsÒ  sQ   è è € àŒ{ð 	ØˆIå�D”KÑ Ô ð 	3Ý% d¤kÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2àŒ{Ðrc   rŸ   úAttemptWithBackoff | Nonerµ   c              ƒ  óÈ  K  — t          ¦   «         }|st          | j        ¬¦  «        }	 |                      ¦   «         ƒ d{V —†}�n(# t          $ �r}t
                               d| j        |¦  «         |                     |¦  «        r“t
                               d| j        | j        ¦  «         | j	        4 ƒd{V —† | xj
        dz  c_
        |r| j        rd| _        	 ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   |                      ¦   «         ƒ d{V —† nF|                     |¦  «         |                      t          | ||¬¦  «        |j        ¦  «        ƒ d{V —† Y d}~dS d}~ww xY wt
                               d¦  «         |                      |¦  «        ƒ d{V —† |r¾| j	        4 ƒd{V —† | j
        | j        k     s| j
        | j        k     rb| j        r[| xj
        dz  c_
        t
                               d	| j        | j
        ¦  «         |                      t          | d
¬¦  «        ¦  «         nd| _        	 ddd¦  «        ƒd{V —† dS # 1 ƒd{V —†swxY w Y   dS dS )zïTry to connect and add the connection to the pool.

        If failed, reschedule a new attempt in the future for a few times, then
        give up, decrease the pool connections number and call
        `self.reconnect_failed()`.

        r…   Nzerror connecting in %r: %sz3reconnection attempt in pool %r failed after %s secr   Fr´   z!adding new connection to the poolr³   T)r   r   r@   r*  rš   r}   r  r:   r�   r]   r¶   r¸   rA   rœ   r  r¹   rž   r~   r  r|   r·   rV   r¦   )r`   rŸ   rµ   r    r‹   r  s         rb   Ú_add_connectionz#AsyncConnectionPool._add_connectionÜ  sÒ  è è € õ ‰kŒkˆØð 	IÝ(°Ô1GÐHÑHÔHˆGð	ØŸš™œÐ(Ð(Ð(Ð(Ð(Ð(ˆD‰DøÝ ð 	ñ 	ð 	Ý�NŠNÐ7¸¼ÀBÑGÔGÐGØ×&Ò& sÑ+Ô+ð Ý—’ØIØ”IØÔ*ñô ð ð
  œ:ð .ð .ð .ð .ð .ð .ð .ð .Ø�L”L AÑ%�L”Làð . 4¤=ð .Ø(-˜œÐ-ð	.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .ð
 ×+Ò+Ñ-Ô-Ð-Ð-Ð-Ð-Ð-Ð-Ð-Ð-à×$Ò$ SÑ)Ô)Ð)Ø×(Ò(Ý! $¨¸ÐAÑAÔAÀ7Ä=ñô ð ð ð ð ð ð ð ð ˆFˆFˆFˆFˆFøøøøð'	øøøõ* 	�ŠÐ7Ñ8Ô8Ð8Ø×Ò Ñ%Ô%Ð%Ð%Ð%Ð%Ð%Ð%Ð%Øð 	*Ø”zð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð ”< $¤.Ò0Ð0Ø”L 4¤>Ò1Ð1°d´mÐ1à�L”L AÑ%�L”LÝ—K’KÐ 7¸¼ÀDÄLÑQÔQÐQØ—M’M¥-°¸dÐ"CÑ"CÔ"CÑDÔDÐDÐDà$)�D”MÐ)ð
*ð 
*ð 
*ñ 
*ô 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*øøøð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð	*ð 	*sP   ©A ÁE*ÁA)E%Â9!C-ÃE%Ã-
C7	Ã7E%Ã:C7	Ã;A$E%Å%E*Æ1B
IÉ
IÉIc              ƒ  óF  K  — |                       |¦  «        ƒ d{V —† |rs|j        j        t          j        k    rX| j        | j        xx         dz  cc<   t                               d¦  «         |  	                    t          | ¦  «        ¦  «         dS ns|j        j        t          j        k    rY| j        | j        xx         dz  cc<   t                               d|¦  «         |  	                    t          | ¦  «        ¦  «         dS |j        | j        k    s|j        t!          ¦   «         k    rYt                               d¦  «         |                      |¦  «        ƒ d{V —† |  	                    t          | ¦  «        ¦  «         dS |                      |¦  «        ƒ d{V —† dS )z>
        Return a connection to the pool after usage.
        Nr   z#not serving connection found brokenz discarding closed connection: %szdiscarding expired connection)Ú_reset_connectionr#  r$  r   ÚUNKNOWNr‰   r  r}   r~   r¦   r¹   Ú_RETURNS_BADr  Ú_created_atrÁ   rÿ   r   rÂ   r  rÉ   s      rb   rÈ   z&AsyncConnectionPool._return_connection  sµ  è è € ð ×$Ò$ TÑ*Ô*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Øð 	ØŒ{Ô-Õ1BÔ1JÒJÐJØ”˜DÔ2Ð3Ð3Ô3°qÑ8Ð3Ð3Ñ3å—’ÐAÑBÔBÐBØ—’�m¨DÑ1Ô1Ñ2Ô2Ð2Ø�ð Kð Œ{Ô-Õ1BÔ1JÒJÐJØ”˜DÔ-Ð.Ð.Ô.°!Ñ3Ð.Ð.Ñ.å—’ÐAÀ4ÑHÔHÐHØ—’�m¨DÑ1Ô1Ñ2Ô2Ð2Ø�ð Ô˜tÔ/Ò/Ð/°4´?ÅiÁkÄkÒ3QÐ3QÝ�KŠKÐ7Ñ8Ô8Ð8Ø×(Ò(¨Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.Ø�MŠM�-¨Ñ-Ô-Ñ.Ô.Ð.ØˆFà×Ò Ñ%Ô%Ð%Ð%Ð%Ð%Ð%Ð%Ð%Ð%Ð%rc   c              ƒ  ó`  K  — d|_         | j        r|                      |¦  «        ƒ d{V —† dS | j        4 ƒd{V —† | j        r/|                      |¦  «        ƒ d{V —† 	 ddd¦  «        ƒd{V —† dS | j        r:| j                             ¦   «                              |¦  «        ƒ d{V —†rn^| j        °:| j                              |¦  «         | j        r6t          | j         ¦  «        | j
        k    r| j                             ¦   «          ddd¦  «        ƒd{V —† dS # 1 ƒd{V —†swxY w Y   dS )zì
        Add a connection to the pool.

        The connection can be a fresh one or one already used in the pool.

        If a client is already waiting for a connection pass it on, otherwise
        put it back into the pool
        N)r-   rg   rÂ   r]   rV   r®   Úsetr£   rW   r{   r|   r½   s     rb   r  z AsyncConnectionPool._add_to_pool.  s*  è è € ð ˆŒ
ð Œ<ð 	Ø×(Ò(¨Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.ØˆFð ”:ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð Œ|ð Ø×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Øð	0ð 	0ð 	0ñ 	0ô 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð ”-ð 0ð œ×.Ò.Ñ0Ô0×4Ò4°TÑ:Ô:Ð:Ð:Ð:Ð:Ð:Ð:ð Øð ”-ð 0ð ”
×!Ò! $Ñ'Ô'Ð'ð Ô(ð 0­S°´©_¬_ÀÄÒ-NÐ-NØÔ)×-Ò-Ñ/Ô/Ð/ð-	0ð 	0ð 	0ñ 	0ô 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0øøøð 	0ð 	0ð 	0ð 	0ð 	0ð 	0s   »$DÁ2BDÄ
D'Ä*D'c              ƒ  óÜ  K  — |j         j        x}t          j        k    r�n|t          j        k    rdS |t          j        k    s|t          j        k    r�t                               d|¦  «         	 | 	                    ¦   «         ƒ d{V —† nŸ# t          $ rL}t                               d|j        j        ||¦  «         |                      |¦  «        ƒ d{V —† Y d}~nNd}~ww xY w|t          j        k    r6t                               d|¦  «         |                      |¦  «        ƒ d{V —† | j        r¼	 |                      |¦  «        ƒ d{V —† |j         j        x}t          j        k    r4t          |¦  «        j        }t#          j        d|› d| j        › d�¦  «        ‚dS # t          $ rA}t                               d|¦  «         |                      |¦  «        ƒ d{V —† Y d}~dS d}~ww xY wdS )	z?
        Bring a connection to IDLE state or close it.
        Nz$rolling back returned connection: %sz1rollback failed: %s: %s. Discarding connection %szclosing returned connection: %sr  z by reset function r  zerror resetting connection: %s)r#  r$  r   r%  r5  ÚINTRANSÚINERRORr}   r  Úrollbackrš   ra   rt   rÂ   ÚACTIVErS   r:   r±   r&  )r`   r‹   r(  r  r)  s        rb   r4  z%AsyncConnectionPool._reset_connection^  sr  è è € ð ”kÔ4Ð4ˆFÕ9JÔ9OÒOÐOÙØÕ(Ô0Ò0Ð0àˆFàÕ(Ô0Ò0Ð0°FÕ>OÔ>WÒ4WÐ4Wå�NŠNÐAÀ4ÑHÔHÐHð	3Ø—m’m‘o”oÐ%Ð%Ð%Ð%Ð%Ð%Ð%Ð%øÝ$ð 3ð 3ð 3Ý—’ØGØ”LÔ)ØØñ	ô ð ð ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2øøøøð3øøøð Õ(Ô/Ò/Ð/å�NŠNÐ<¸dÑCÔCÐCØ×(Ò(¨Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.Ð.àŒ;ð 	3ð
3Ø—k’k $Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ø"œkÔ<Ð<�FÕARÔAWÒWÐWÝ-¨fÑ5Ô5Ô:�EÝÔ,ð5°Uð 5ð 5Ø œKð5ð 5ð 5ñô ð ð XÐWøõ %ð 3ð 3ð 3Ý—’Ð?ÀÑDÔDÐDØ×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2øøøøð3øøøð	3ð 	3s2   Á/B
 Â

C ÂACÃC Ä1A+F Æ
G)Æ(6G$Ç$G)c              ƒ  óL   K  — d |_         |                     ¦   «         ƒ d {V —† d S rá   )r-   r€   r½   s     rb   rÂ   z%AsyncConnectionPool._close_connectionˆ  s3   è è € ØˆŒ
Ø�jŠj‰lŒlÐÐÐÐÐÐÐÐÐrc   c              ƒ  óö  K  — d }| j         4 ƒd {V —† | j        }t          | j        ¦  «        | _        | j        | j        k    rF|dk    r@| j        r9| j                             ¦   «         }| xj        dz  c_        | xj        dz  c_        	 d d d ¦  «        ƒd {V —† n# 1 ƒd {V —†swxY w Y   |rJt                               d| j	        | j        || j
        ¦  «         |                      |¦  «        ƒ d {V —† d S d S )Nr   r   zHshrinking pool %r to %s because %s unused connections in the last %s sec)r]   r¯   r{   r-   r¶   r|   r®   r}   r~   r:   r?   rÂ   )r`   Úto_closeÚ
nconns_mins      rb   Ú_shrink_poolz AsyncConnectionPool._shrink_poolŒ  s¢  è è € Ø#ˆà”:ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&àÔ)ˆJÝ" 4¤:™œˆDÔð Œ|˜dœnÒ,Ð,°¸a²°ÀDÄJ°Øœ:×-Ò-Ñ/Ô/�Ø�” Ñ!�”ØÐ Ô  AÑ%Ð Ô Ð ð		&ð 		&ð 		&ñ 		&ô 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&ð 		&øøøð 		&ð 		&ð 		&ð 		&ð ð 		3Ý�KŠKð&à”	Ø”ØØ”ñô ð ð ×(Ò(¨Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2Ð2ð		3ð 		3s   ’A7BÂ
B&Â)B&údict[str, int]c                ó€   •— t          ¦   «                              ¦   «         }t          | j        ¦  «        || j        <   |S rá   )rZ   Ú_get_measuresr{   rV   Ú_REQUESTS_WAITING)r`   Úrvra   s     €rb   rF  z!AsyncConnectionPool._get_measures¥  s4   ø€ Ý‰WŒW×"Ò"Ñ$Ô$ˆÝ%(¨¬Ñ%7Ô%7ˆˆ4Ô!Ñ"Øˆ	rc   )r.   )$rC   r   r2   rD   r3   rE   r4   rF   r5   rG   r6   rH   r7   rI   r8   rI   r9   rI   r:   rJ   r;   rK   r<   rL   r=   rF   r>   rL   r?   rL   r@   rL   rA   rM   rB   rF   ©rd   re   )r0   )r<   rL   rd   re   rá   )r<   r‚   rd   rƒ   )r<   r‚   rd   r   )r”   rL   rd   r   ©r<   rL   rd   r   )r<   r‚   rd   r«   )r‹   r   rd   re   )r‹   r   r—   rK   rd   re   ©r‹   r   rd   rK   )Fr0   )r�   rK   r<   rL   rd   re   )rh   )rd   ré   )rd   r   )rð   rñ   rò   ró   rô   rõ   rd   re   )r4   rF   r5   rG   rd   re   )r	  r
  rd   re   )r	  r
  rž   rL   rd   re   )r  r  rd   re   ©rd   r+  )rd   r.  )F)rŸ   r0  rµ   rK   rd   re   )rd   rD  )6rt   Ú
__module__Ú__qualname__Ú__annotations__r
   rO   r   r   r[   rn   rq   r\   r�   r   rŽ   r‡   r“   r˜   r¢   r™   r¥   rˆ   rÅ   r›   r¼   r6   r_   rÌ   rÒ   rÓ   r€   rk   rï   r÷   rü   r8   Ústaticmethodr   rA   r¦   r  ÚclassmethodrÝ   r*  r  r  r2  rÈ   r  r4  rÂ   rC  rF  Ú__classcell__©ra   s   @rb   r,   r,   .   s_  ø€ € € € € € ØÐÐÑð (*ðPð '+ d¨4°¬9°oÑ&FÔ&FØ*.ØØ#Ø Ø37Ø/3Ø/3ØØ#ØØØ'Ø#Ø#+Ø8<Øð)Pð Pð Pð Pð Pð Pð Pð Pðd>ðð ð ð ð ð ð$	ð	ð 	ð 	ð 	ð:ð :ð :ð :ð :ð@ ðCð Cð Cð Cñ ÔðCð,ð ð ð ð ð:,ð ,ð ,ð ,ð4 ð  ð  ð  ðDð ð ð ð&ð ð ð ð9ð 9ð 9ð 9ð6ð 6ð 6ð 6ð/ð /ð /ð /ð(Kð Kð Kð Kðð ð ð ð-ð -ð -ð -ð -ð.$ð $ð $ð $ð,!ð	!ð 	!ð 	!ð 	!ð"$ð $ð $ð $ðGð Gð Gð Gð'Lð 'Lð 'Lð 'Lð 'LðRð ð ð ðð ð ð ð
ð ð ð ð/ð /ð /ð /ð /ð"!.ð !.ð !.ð !.ðF ð,ð ,ð ,ñ „\ð,ð:9ð 9ð 9ð 9ð%ð %ð %ð %ð2ð 2ð 2ð 2ð ðð ð ñ „[ðð*ð ð ð ð ðB#ð #ð #ð #ðð ð ð ð CHð2*ð 2*ð 2*ð 2*ð 2*ðh&ð &ð &ð &ð<.0ð .0ð .0ð .0ð`(3ð (3ð (3ð (3ðTð ð ð ð3ð 3ð 3ð 3ð2ð ð ð ð ð ð ð ð ð rc   r,   c                  ó6   — e Zd ZdZdZdd„Zdd	„Zdd„Zdd„ZdS )rU   z<A position in a queue for a client waiting for a connection.)r‹   ÚerrorÚ_condrd   re   c                óH   — d | _         d | _        t          ¦   «         | _        d S rá   )r‹   rU  r    rV  rx   s    rb   r[   zWaitingClient.__init__°  s!   € Ø $ˆŒ	Ø+/ˆŒ
õ  ‘\”\ˆŒ
ˆ
ˆ
rc   r<   rL   r   c              ƒ  ór  K  — | j         4 ƒd{V —† | j        s`| j        sY	 | j                              |¦  «        ƒ d{V —†st	          d|d›d�¦  «        | _        n# t
          $ r}|| _        Y d}~nd}~ww xY wddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   | j        r| j        ‚| j        sJ ‚| j        S )z�Wait for a connection to be set and return it.

        Raise an exception if the wait times out or if fail() is called.
        Nr�   r‘   rz   )rV  r‹   rU  r   r   rš   )r`   r<   r  s      rb   r�   zWaitingClient.wait»  s  è è € ð
 ”:ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$Ø”Ið $ ¤ð $ð$Ø!%¤×!8Ò!8¸Ñ!AÔ!AÐAÐAÐAÐAÐAÐAð Ý%0ØP¸wÐPÐPÐPÐPñ&ô &˜œ
øøõ )ð $ð $ð $Ø!#�D”J�J�J�J�J�Jøøøøð$øøøð	$ð 	$ð 	$ñ 	$ô 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$øøøð 	$ð 	$ð 	$ð 	$ð Œ:ð 	Ø”*Ðà”9ÐÐ�9Ø”9Ðs:   �B
 9AÁB
Á
A5Á$A0Á+B
Á0A5Á5B
Â

BÂBr‹   rK   c              ƒ  óô   K  — | j         4 ƒd{V —† | j        s| j        r	 ddd¦  «        ƒd{V —† dS || _        | j                              ¦   «          	 ddd¦  «        ƒd{V —† dS # 1 ƒd{V —†swxY w Y   dS )zÂSignal the client waiting that a connection is ready.

        Return True if the client has "accepted" the connection, False
        otherwise (typically because wait() has timed out).
        NFT©rV  r‹   rU  Ú
notify_allr½   s     rb   r9  zWaitingClient.setÐ  sJ  è è € ð ”:ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ØŒyð ˜DœJð Øð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ˆDŒIØŒJ×!Ò!Ñ#Ô#Ð#Øð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	ó   �A'³!A'Á'
A1Á4A1rU  Ú	Exceptionc              ƒ  óô   K  — | j         4 ƒd{V —† | j        s| j        r	 ddd¦  «        ƒd{V —† dS || _        | j                              ¦   «          	 ddd¦  «        ƒd{V —† dS # 1 ƒd{V —†swxY w Y   dS )zÉSignal the client that, alas, they won't have a connection today.

        Return True if the client has "accepted" the error, False otherwise
        (typically because wait() has timed out).
        NFTrZ  )r`   rU  s     rb   ræ   zWaitingClient.failÞ  sJ  è è € ð ”:ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ØŒyð ˜DœJð Øð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ˆDŒJØŒJ×!Ò!Ñ#Ô#Ð#Øð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	r\  NrI  rJ  rK  )rU  r]  rd   rK   )	rt   rM  rN  Ú__doc__Ú	__slots__r[   r�   r9  ræ   © rc   rb   rU   rU   «  so   € € € € € ØFÐFà*€Ið	"ð 	"ð 	"ð 	"ðð ð ð ð*ð ð ð ðð ð ð ð ð rc   rU   c                  óJ   — e Zd ZdZdd„Zdd„Zdd	„Zdd
„Zedd„¦   «         Z	dS )r
  z8A task to run asynchronously to maintain the pool state.ÚpoolúAsyncConnectionPool[Any]c                ó.   — t          |¦  «        | _        d S rá   )r   rc  ©r`   rc  s     rb   r[   zMaintenanceTask.__init__ð  s   € Ý˜‘I”IˆŒ	ˆ	ˆ	rc   rd   r+  c                ó¢   — |                       ¦   «         }|rt          |j        ¦  «        nd}d| j        j        › d|› dt          | ¦  «        d›d�S )Nz<pool is gone>ú<ú z at 0xÚxú>)rc  Úreprr:   ra   rt   Úid)r`   rc  r:   s      rb   Ú__repr__zMaintenanceTask.__repr__ó  sU   € Ø�yŠy‰{Œ{ˆØ"&Ð<�t�D”I‰ŒˆÐ,<ˆØF�4”>Ô*ÐFÐF¨TÐFÐF½¸D¹¼ÐFÐFÐFÐFÐFrc   re   c              ƒ  ó  K  — |                       ¦   «         }|r|j        rt                               d| ¦  «         dS t                               dt	          ¦   «         | ¦  «         |                      |¦  «        ƒ d{V —† dS )zŽRun the task.

        This usually happens in a worker. Call the concrete _run()
        implementation, if the pool is still alive.
        ztask run discarded: %sNztask running in %s: %s)rc  Úclosedr}   rå   r(   Ú_runrf  s     rb   rÛ   zMaintenanceTask.runø  s†   è è € ð �yŠy‰{Œ{ˆØð 	�t”{ð 	å�LŠLÐ1°4Ñ8Ô8Ð8ØˆFå�ŠÐ-Õ/@Ñ/BÔ/BÀDÑIÔIÐIØ�iŠi˜‰oŒoÐÐÐÐÐÐÐÐÐrc   c              ƒ  ó¨   K  — |                       ¦   «         }|r|j        rt                               d| ¦  «         dS |                     | ¦  «         dS )z±Run the scheduled task

        This function is called by the scheduler task. Use a worker to
        run the task for real in order to free the scheduler immediately.
        ztask tick discarded: %sN)rc  rp  r}   rå   r¦   rf  s     rb   r  zMaintenanceTask.tick  sX   è è € ð �yŠy‰{Œ{ˆØð 	�t”{ð 	å�LŠLÐ2°DÑ9Ô9Ð9ØˆFà�Š�dÑÔÐÐÐrc   c              ƒ  ó
   K  — d S rá   ra  rf  s     rb   rq  zMaintenanceTask._run  s   è è € ØBEÀ#rc   N)rc  rd  rL  rI  ©rc  rd  rd   re   )
rt   rM  rN  r_  r[   rn  rÛ   r  r   rq  ra  rc   rb   r
  r
  í  s‚   € € € € € ØBÐBðð ð ð ðGð Gð Gð Gð
ð ð ð ðð ð ð ð ØEÐEÐEñ „^ØEÐEÐErc   r
  c                  ó   — e Zd ZdZdd„ZdS )	rì   z+Signal the maintenance worker to terminate.rc  rd  rd   re   c              ƒ  ó
   K  — d S rá   ra  rf  s     rb   rq  zStopWorker._run  s   è è € Øˆrc   Nrt  ©rt   rM  rN  r_  rq  ra  rc   rb   rì   rì     s.   € € € € € Ø5Ð5ðð ð ð ð ð rc   rì   c                  ó.   ‡ — e Zd Z	 	 ddˆ fd	„Zdd„Zˆ xZS )r¹   NFrc  rd  rŸ   r0  rµ   rK   c                óf   •— t          ¦   «                              |¦  «         || _        || _        d S rá   )rZ   r[   rŸ   rµ   )r`   rc  rŸ   rµ   ra   s       €rb   r[   zAddConnection.__init__!  s/   ø€ õ 	‰Œ×Ò˜ÑÔÐØˆŒØˆŒˆˆrc   rd   re   c              ƒ  óX   K  — |                      | j        | j        ¬¦  «        ƒ d {V —† d S )Nr´   )r2  rŸ   rµ   rf  s     rb   rq  zAddConnection._run+  s;   è è € Ø×"Ò" 4¤<¸¼Ð"ÑFÔFÐFÐFÐFÐFÐFÐFÐFÐFÐFrc   rp   )rc  rd  rŸ   r0  rµ   rK   rt  )rt   rM  rN  r[   rq  rR  rS  s   @rb   r¹   r¹      sf   ø€ € € € € ð .2Øð	ð ð ð ð ð ð ðGð Gð Gð Gð Gð Gð Gð Grc   r¹   c                  ó,   ‡ — e Zd ZdZdˆ fd„Zdd„Zˆ xZS )r§   z-Clean up and return a connection to the pool.rc  rd  r‹   r   r—   rK   c                óf   •— t          ¦   «                              |¦  «         || _        || _        d S rá   )rZ   r[   r‹   r—   )r`   rc  r‹   r—   ra   s       €rb   r[   zReturnConnection.__init__2  s0   ø€ Ý‰Œ×Ò˜ÑÔÐØˆŒ	Ø(ˆÔÐÐrc   rd   re   c              ƒ  óX   K  — |                      | j        | j        ¬¦  «        ƒ d {V —† d S rÇ   )rÈ   r‹   r—   rf  s     rb   rq  zReturnConnection._run7  s<   è è € Ø×%Ò% d¤i¸dÔ>OÐ%ÑPÔPÐPÐPÐPÐPÐPÐPÐPÐPÐPrc   )rc  rd  r‹   r   r—   rK   rt  ©rt   rM  rN  r_  r[   rq  rR  rS  s   @rb   r§   r§   /  s_   ø€ € € € € Ø7Ð7ð)ð )ð )ð )ð )ð )ð
Qð Qð Qð Qð Qð Qð Qð Qrc   r§   c                  ó   — e Zd ZdZdd„ZdS )	rã   z“If the pool can shrink, remove one connection.

    Re-schedule periodically and also reset the minimum number of connections
    in the pool.
    rc  rd  rd   re   c              ƒ  ó€   K  — |                      | |j        ¦  «        ƒ d {V —† |                     ¦   «         ƒ d {V —† d S rá   )r  r?   rC  rf  s     rb   rq  zShrinkPool._runB  s\   è è € ð × Ò   t¤}Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5Ð5Ø×ÒÑ!Ô!Ð!Ð!Ð!Ð!Ð!Ð!Ð!Ð!Ð!rc   Nrt  rw  ra  rc   rb   rã   rã   ;  s2   € € € € € ðð ð"ð "ð "ð "ð "ð "rc   rã   c                  ó,   ‡ — e Zd ZdZdˆ fd„Zdd„Zˆ xZS )râ   zÒSchedule a task in the pool scheduler.

    This task is a trampoline to allow to use a sync call (pool.run_task)
    to execute an async one (pool.schedule_task). It is pretty much no-op
    in sync code.
    rc  rd  r	  r
  rž   rL   c                óf   •— t          ¦   «                              |¦  «         || _        || _        d S rá   )rZ   r[   r	  rž   )r`   rc  r	  rž   ra   s       €rb   r[   zSchedule.__init__Q  s/   ø€ õ 	‰Œ×Ò˜ÑÔÐØˆŒ	ØˆŒ
ˆ
ˆ
rc   rd   re   c              ƒ  óV   K  — |                      | j        | j        ¦  «        ƒ d {V —† d S rá   )r  r	  rž   rf  s     rb   rq  zSchedule._runX  s8   è è € Ø× Ò  ¤¨D¬JÑ7Ô7Ð7Ð7Ð7Ð7Ð7Ð7Ð7Ð7Ð7rc   )rc  rd  r	  r
  rž   rL   rt  r~  rS  s   @rb   râ   râ   I  s[   ø€ € € € € ðð ðð ð ð ð ð ð8ð 8ð 8ð 8ð 8ð 8ð 8ð 8rc   râ   )Hr_  Ú
__future__r   Úloggingrr   Úabcr   r   Útimer   Útypesr   Útypingr   r	   r
   Úweakrefr   Ú
contextlibr   Úcollectionsr   Úcollections.abcr   Úpsycopgr   r   r±   Ú
psycopg.pqr   r   r   r   r   r   Úbaser   r   r   r   r   Ú_compatr   r   r   Ú_acompatr    r!   r"   r#   r$   r%   r&   r'   r(   r)   Úsched_asyncr*   rÖ   r]  ÚCancelledErrorrš   Ú	getLoggerr}   r,   rU   r
  rì   r¹   r§   rã   râ   ra  rc   rb   ú<module>r–     s¶  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ø Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )à #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (à QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ !Ð !Ð !Ð !Ð !Ð !Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'ð"Ø€N€N€Nð # GÔ$:Ð;Ðð
 
ˆÔ	˜>Ñ	*Ô	*€ðzð zð zð zð z˜' #œ,¨ñ zô zð zðz?ð ?ð ?ð ?ð ?�G˜C”Lñ ?ô ?ð ?ðD)Fð )Fð )Fð )Fð )F�cñ )Fô )Fð )FðXð ð ð ð �ñ ô ð ðGð Gð Gð Gð G�Oñ Gô Gð Gð	Qð 	Qð 	Qð 	Qð 	Q�ñ 	Qô 	Qð 	Qð"ð "ð "ð "ð "�ñ "ô "ð "ð8ð 8ð 8ð 8ð 8ˆñ 8ô 8ð 8ð 8ð 8rc   