o
    ýÑÐbŒ  ã                   @   sl   d dl Z d dlZd dlZd dlmZmZ d dlmZ ddd„Zded ddfd	d
„Z	de j
ddfdd„ZdS )é    N)ÚAnyÚIterable)ÚerrÚreturnc                  C   s,   zddl } |  ¡  W dS  ty   Y dS w )zÀIf our environment has uvloop installed we use it.

    This is called only from command-line entry points to avoid
    interfering with the parent process if Black is used as a library.

    r   N)ÚuvloopÚinstallÚImportError)r   © r	   úP/var/www/secure340b-portal/env/lib/python3.10/site-packages/black/concurrency.pyÚmaybe_install_uvloop	   s   ÿr   Útaskszasyncio.Task[Any]c                 C   s   t dƒ | D ]}| ¡  qdS )zFasyncio signal handler that cancels all `tasks` and reports to stderr.zAborted!N)r   Úcancel)r   Útaskr	   r	   r
   r      s   
ÿr   Úloopc              	   C   sÌ   zUt jdd… dkrtj}ntjj}dd„ || ƒD ƒ}|s/W t d¡}| tj¡ |  	¡  dS |D ]}| 
¡  q1|  tj|| ddœŽ¡ W t d¡}| tj¡ |  	¡  dS t d¡}| tj¡ |  	¡  w )	zFCancel all pending tasks on `loop`, wait for them, and close the loop.Né   )é   é   c                 S   s   g | ]}|  ¡ s|‘qS r	   )Údone)Ú.0r   r	   r	   r
   Ú
<listcomp>'   s    zshutdown.<locals>.<listcomp>zconcurrent.futuresT)r   Úreturn_exceptions)ÚsysÚversion_infoÚasyncioÚ	all_tasksÚTaskÚloggingÚ	getLoggerÚsetLevelÚCRITICALÚcloser   Úrun_until_completeÚgather)r   r   Ú	to_cancelZ	cf_loggerr   r	   r	   r
   Úshutdown   s*   
õ
ÿ

þ
r$   )r   N)r   r   r   Útypingr   r   Zblack.outputr   r   r   ÚAbstractEventLoopr$   r	   r	   r	   r
   Ú<module>   s    
