a
    ñ»j  ã                   @   sL   d Z ddlZddlZddlmZ G dd„ deƒZdd„ Zdd	„ Zd
d„ Z	dS )zUtility functions for xauth.é    N)ÚEasyProcessc                   @   s   e Zd ZdZdS )ÚNotFoundErrorzError when xauth was not found.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú<E:\soccer\ml_env\Lib\site-packages\sbvirtualdisplay/xauth.pyr      s   r   c                  C   sB   z$t ddgƒ} d| _d| _|  ¡  W n ty8   Y dS 0 dS dS )z3
    Return whether or not xauth is installed.
    Úxauthz-VFTN)r   Zenable_stdout_logZenable_stderr_logÚcallÚ	Exception)Úpr   r   r	   Úis_installed   s    r   c                  C   s   t  d¡} t | ¡ ¡ S )z6
    Generate a cookie string suitable for xauth.
    é   )ÚosÚurandomÚhashlibÚmd5Ú	hexdigest)Údatar   r   r	   Úgenerate_mcookie   s    
r   c                  G   s   t dgt| ƒ ƒ ¡  dS )z)
    Call xauth with the given args.
    r
   N)r   Úlistr   )Úargsr   r   r	   r   $   s    r   )
r   r   r   Zsbvirtualdisplay.easyprocessr   r   r   r   r   r   r   r   r   r	   Ú<module>   s   