
    :"rih                     2    d dl Z ddlmZ d Z G d d      Zy)    N   )
exceptionsc                 B     t        j                          fd       }|S )z@A decorator to add a sanity check to ConnectionResource methods.c                 R    | j                  j                          | g|i |S N)_check_conn_validity__name__)selfargskwargsmeths      \/var/www/fortnox.pascalinesoft.com/venv/lib/python3.12/site-packages/asyncpg/connresource.py_checkzguarded.<locals>._check   s*    !!$--0D*4*6**    )	functoolswraps)r   r   s   ` r   guardedr      s'     __T+ + Mr   c                       e Zd ZdZd Zd Zy)ConnectionResource)_connection_con_release_ctrc                 4    || _         |j                  | _        y r   )r   _pool_release_ctrr   )r
   
connections     r   __init__zConnectionResource.__init__   s    % * < <r   c                 f   | j                   j                  }|| j                  k7  r9t        j                  dj                  | j                  j                  |            | j                   j                         r9t        j                  dj                  | j                  j                  |            y )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J J
 %%'++66<fNN++Y789 9 (r   N)r	   
__module____qualname__	__slots__r   r    r   r   r   r      s    3I=9r   r   )r    r   r   r   r&   r   r   <module>r(      s     9 9r   