
    ^=i5                        d dl mZ d dlZd dlZd dlmZmZmZ d dlm	Z	 d dl
Z
d dlZd dlZ
 ed      Z e	d      Z	 	 	 	 	 	 	 	 d	dZd
dZy)    )annotationsN)TypeVarCallable	Awaitable)	ParamSpecT_RetvalT_ParamSpecc                  K   t        j                         dk(  r!t        j                  | g|i | d {   S t        j                  j                  t        j                  | g|i |       d {   S 7 B7 w)Nasyncio)sniffiocurrent_async_libraryr   	to_threadanyiorun_sync	functoolspartial)funcargskwargss      N/home/rose/Desktop/poly/venv/lib/python3.12/site-packages/groq/_utils/_sync.pyr   r      sv      $$&)3&&t=d=f===))$000   >s!   4A=A9=A=4A;5A=;A=c                     d fd}|S )ac  
    Take a blocking function and create an async one that receives the same
    positional and keyword arguments.

    Usage:

    ```python
    def blocking_func(arg1, arg2, kwarg1=None):
        # blocking code
        return result


    result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
    ```

    ## Arguments

    `function`: a blocking regular callable (e.g. a function)

    ## Return

    An async function that takes the same positional and keyword arguments as the
    original one, that when called runs the same original function in a thread worker
    and returns the result.
    c                 >   K   t        g| i | d {   S 7 w)N)r   )r   r   functions     r   wrapperzasyncify.<locals>.wrapper7   s"     x9$9&9999s   )r   T_ParamSpec.argsr   T_ParamSpec.kwargsreturnr    )r   r   s   ` r   asyncifyr      s    6: N    )r   Callable[T_ParamSpec, T_Retval]r   r   r   r   r   r   )r   r!   r   z*Callable[T_ParamSpec, Awaitable[T_Retval]])
__future__r   r   r   typingr   r   r   typing_extensionsr   r   r   anyio.to_threadr   r	   r   r   r   r    r   <module>r&      s^    "   / / '   :&
)5EQcr    