o
    $i                     @   s   d Z ddlZddlZddlmZ ddlmZ zddlZW n ey'   dZY nw dd Z	dd Z
d	efd
dZeddded	efddZedddd ZdS )zj
This file should only be imported from Python 3.
It will raise SyntaxError when importing from Python 2.
    N)	lru_cache)env_boolc                   C   s   t rtddrt  S t S )zKConstruct a new event loop. Ray will use uvloop if it exists and is enabledRAY_USE_UVLOOPT)uvloopr   new_event_loopasyncio r   r   V/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/_private/async_compat.pyget_new_event_loop   s   r
   c                   C   s    t rtddrt   dS 	 dS )zSInstalls uvloop as event-loop implementation for asyncio (if available and enabled)r   TN)r   r   installr   r   r   r	   try_install_uvloop   s   r   returnc                 C   s   t | p	t | S )zBReturn True if the function is an async or async generator method.)inspectiscoroutinefunctionisasyncgenfunctionfuncr   r   r	   is_async_func!   s   r   i   )maxsizeclsc                 C   s   t tj| tddkS )z/Return True if the class has any async methods.)	predicater   )lenr   
getmembersr   )r   r   r   r	   has_async_methods&   s   r   c                    s   t  r S  fdd}|S )z-Wrap a blocking function in an async functionc                     s    | i |S )Nr   )argskwargsr   r   r	   wrapper3   s   zsync_to_async.<locals>.wrapper)r   )r   r   r   r   r	   sync_to_async,   s   r   )__doc__r   r   	functoolsr   ray._private.ray_constantsr   r   ImportErrorr
   r   boolr   objectr   r   r   r   r   r	   <module>   s"    