a
    þd  ã                   @   s4   d dl Z d dlmZ dd„ Zddd„Zdd	d
„ZdS )é    N)Ú	strtoboolc                 C   s0   | D ]&}t tj |d¡ƒ}|dkr|  S q|S )zQReturns the first positive env value found in the `env_keys` list or the default.éÿÿÿÿr   )ÚintÚosÚenvironÚget)Zenv_keysÚdefaultÚeÚval© r   úe/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/accelerate/utils/environment.pyÚget_int_from_env   s
    
r   Fc                 C   s   t j | t|ƒ¡}t|ƒdkS )zJReturns truthy value for `key` from the env if available else the default.é   )r   r   r   Ústrr   ©Úkeyr   Úvaluer   r   r   Úparse_flag_from_env   s    r   Únoc                 C   s   t j | t|ƒ¡}|S )N)r   r   r   r   r   r   r   r   Úparse_choice_from_env"   s    r   )F)r   )r   Údistutils.utilr   r   r   r   r   r   r   r   Ú<module>   s   	
