
    ۇehh                     :    d dl Z ddlmZ d Z G d d          ZdS )    N   )
exceptionsc                 F     t          j                    fd            }|S )z@A decorator to add a sanity check to ConnectionResource methods.c                 P    |                      j                    | g|R i |S N)_check_conn_validity__name__)selfargskwargsmeths      F/var/www/api/venv/lib/python3.11/site-packages/asyncpg/connresource.py_checkzguarded.<locals>._check   s9    !!$-000tD*4***6***    )	functoolswraps)r   r   s   ` r   guardedr      s:     _T+ + + + + Mr   c                       e Zd ZdZd Zd ZdS )ConnectionResource)_connection_con_release_ctrc                 ,    || _         |j        | _        d S r   )r   _pool_release_ctrr   )r
   
connections     r   __init__zConnectionResource.__init__   s    % * <r   c                 .   | j         j        }|| j        k    r2t          j        d                    | j        j        |                    | j                                         r2t          j        d                    | j        j        |                    d S )NzQcannot call {}.{}(): the underlying connection has been released back to the poolz8cannot call {}.{}(): the underlying connection is closed)	r   r   r   r   InterfaceErrorformat	__class__r	   	is_closed)r
   	meth_namecon_release_ctrs      r   r   z'ConnectionResource._check_conn_validity    s    *<d333+$fT^%<iHHJ J J
 %%'' 	9+66<fN+Y78 789 9 9	9 	9r   N)r	   
__module____qualname__	__slots__r   r    r   r   r   r      s7        3I= = =9 9 9 9 9r   r   )r    r   r   r   r&   r   r   <module>r(      sf               9 9 9 9 9 9 9 9 9 9r   