o
    NK&hÓ	  ã                   @   sN   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ ddd„Z	d	d
„ Z
dS )é    N)Úgetenv)ÚOS_IS_WINDOWS)Úerror_logger)Ústr_to_boolÚreturnc                  C   s€   t r	t d¡ dS zddl} W n ty   t d¡ Y dS w ttddƒƒ}|r-t d¡ tt	 
¡ | jƒs>t	 |  ¡ ¡ dS dS )z/Use uvloop instead of the default asyncio loop.a$  You are trying to use uvloop, but uvloop is not compatible with your system. You can disable uvloop completely by setting the 'USE_UVLOOP' configuration value to false, or simply not defining it and letting Sanic handle it for you. Sanic will now continue to run using the default event loop.Nr   a  You are trying to use uvloop, but uvloop is not installed in your system. In order to use uvloop you must first install it. Otherwise, you can disable uvloop completely by setting the 'USE_UVLOOP' configuration value to false. Sanic will now continue to run with the default event loop.ÚSANIC_NO_UVLOOPÚnoa1  You are requesting to run Sanic using uvloop, but the install-time 'SANIC_NO_UVLOOP' environment variable (used to opt-out of installing uvloop with Sanic) is set to true. If you want to prevent Sanic from overriding the event loop policy during runtime, set the 'USE_UVLOOP' configuration value to false.)r   r   ÚwarningÚuvloopÚImportErrorr   r   ÚinfoÚ
isinstanceÚasyncioÚget_event_loop_policyÚEventLoopPolicyÚset_event_loop_policy)r
   Úuvloop_install_removed© r   úD/var/www/html/venv/lib/python3.10/site-packages/sanic/server/loop.pyÚtry_use_uvloop
   s*   ÿÿ÷ÿ	ÿr   c                   C   s8   t s	t d¡ dS tt ¡ tjƒst t ¡ ¡ dS dS )zDTry to use the WindowsSelectorEventLoopPolicy instead of the defaultzÑYou are trying to use an event loop policy that is not compatible with your system. You can simply let Sanic handle selecting the best loop for you. Sanic will now continue to run using the default event loop.N)r   r   r	   r   r   r   ÚWindowsSelectorEventLoopPolicyr   r   r   r   r   Útry_windows_loop2   s   ÿ
ÿýr   )r   N)r   Úosr   Úsanic.compatr   Ú	sanic.logr   Úsanic.utilsr   r   r   r   r   r   r   Ú<module>   s    
(