ó
    ­[j5  ã                  óœ   • S SK Jr  S SKrS SKrS SKJrJrJr  S SKJ	r	  S SK
r
S SKrS SKr
\" S5      r\	" S5      r        S	S jrS
S jrg)é    )ÚannotationsN)ÚTypeVarÚCallableÚ	Awaitable)Ú	ParamSpecÚT_RetvalÚT_ParamSpecc             �  ó  #   • [         R                  " 5       S:X  a"  [        R                  " U /UQ70 UD6I S h  v•N $ [        R                  R                  [        R                  " U /UQ70 UD65      I S h  v•N $  NC N7f)NÚasyncio)ÚsniffioÚcurrent_async_libraryr   Ú	to_threadÚanyioÚrun_syncÚ	functoolsÚpartial)ÚfuncÚargsÚkwargss      ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/landingai_ade/_utils/_sync.pyr   r      st   é € ô ×$Ò$Ó&¨)Ó3Ü×&Ò& tÐ=¨dÒ=°fÑ=×=Ð=ä—‘×)Ñ)Ü×Ò˜$Ð0 Ò0¨Ñ0ó÷ ð ñ >ñùs!   ‚7B¹A=º>BÁ8A?Á9BÁ?Bc                ó   ^ • SU 4S jjnU$ )a#  
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               Ÿ  ó>   >#   • [        T/U Q70 UD6I S h  v•N $  N7f)N)r   )r   r   Úfunctions     €r   ÚwrapperÚasyncify.<locals>.wrapper7   s!   øé € Ü˜xÐ9¨$Ò9°&Ñ9×9Ð9Ñ9ùs   ƒ–—)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!   