
    ,iy                    |    U d dl mZ d dlmZmZmZ ddlmZmZ erddl	m
Z
 edeg df   f   Zdaded	<   dd
ZddZy)    )annotations)TYPE_CHECKINGUnionCallable   )ClientNotRegisteredErrorClientAlreadyRegisteredErrorPrismar   NzRegisteredClient | None_registered_clientc           	         ddl m} t        
t               t	        | |      s t        |       st        d| d| d|  d      | ay)zRegister a client instance to be retrieved by `get_client()`

    This function _must_ only be called once, preferrably as soon as possible
    to avoid any potentially confusing errors with threads or processes.
    r   r
   NzExpected either a z' instance or a function that returns a z	 but got z	 instead.)clientr   r   r	   
isinstancecallable	TypeError)r   r   s     U/var/www/html/langgraph-service/venv/lib/python3.12/site-packages/prisma/_registry.pyregisterr      s\      %*,,ff%hv.> (OPVxW`ag`hhqr
 	
      c                     ddl m}  t        }|t               dt	        ||       r|S  |       }t	        ||       st        d| d|  d      |S )zGet the registered client instance

    Raises errors.ClientNotRegisteredError() if no client instance has been registered.
    r   r
   NzRegistered function returned z instead of a z
 instance.)r   r   r   r   r   r   )r   
registeredr   s      r   
get_clientr   $   s_    
 #J&(d2*f%\Fff%7x~fXU_`aaMr   )r   RegisteredClientreturnNone)r   r   )
__future__r   typingr   r   r   errorsr   r	   r   r   r   r   __annotations__r   r    r   r   <module>r       sH    " 1 1 J 8BL#99: .2 + 2 *r   