o
    tBhu                     @   s   d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl	Z	ddl
Zddl
mZ eeZdd Zdd	 Zd
d Zdd Zdd Zdd ZdS )z
Helper functions for testing.
    )Path)TemporaryDirectoryN)_apic                   C   s"   dt jd< dt jd< dt jd< d S )NzDejaVu Sanszfont.familynoneztext.hinting   ztext.hinting_factormplrcParams r
   r
   r/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/matplotlib/testing/__init__.pyset_font_settings_for_testing   s   

r   c                   C   s   dt jd< d S )N
matplotlibzsvg.hashsaltr   r
   r
   r
   r   set_reproducibility_for_testing   s   r   c                   C   s   z	t t jd W n# t jy,   z	t t jd W n t jy)   td Y nw Y nw td t	  t
  W d    n1 sEw   Y  t  t  d S )Nzen_US.UTF-8zEnglish_United States.1252zPCould not set locale to English/United States. Some date-related tests may fail.Agg)locale	setlocaleLC_ALLError_logwarningr   user   'suppress_matplotlib_deprecation_warning
rcdefaultsr   r   r
   r
   r
   r   setup   s$   



r   c             
   O   s^   | j }| j}tjtjdd| d| d| dg|i tjddi||dtjtjdd	}|S )
a  
    Run a function in a sub-process

    Parameters
    ----------
    func : function
        The function to be run.  It must be in a module that is importable.

    *args : str
        Any additional command line arguments to be passed in
        the first argument to subprocess.run

    **extra_env : Dict[str, str]
        Any additional envromental variables to be set for
        the subprocess.

    z-cz
from z import 
z()
SOURCE_DATE_EPOCH0T)envtimeoutcheckstdoutstderruniversal_newlines)	__name__
__module__
subprocessrunsys
executableosenvironPIPE)funcr   args	extra_envtargetmoduleprocr
   r
   r   subprocess_run_helper5   s8   r2   c              
   C   s   t  :}t|d}|d ztj| dt|g|tjtjd W n ttjfy3   Y W d   dS w 	 W d   dS 1 s@w   Y  dS )z
    Check if a given TeX system + pgf is available

    Parameters
    ----------
    texsystem : str
        The executable name to check
    ztest.texz
            \documentclass{minimal}
            \usepackage{pgf}
            \begin{document}
            \typeout{pgfversion=\pgfversion}
            \makeatletter
            \@@end
        z-halt-on-error)cwdr    r!   NFT)	r   r   
write_textr%   
check_callstrDEVNULLOSErrorCalledProcessError)	texsystemtmpdirtex_pathr
   r
   r   _check_for_pgf]   s   	


$r=   c                 C   s   t tj|  dS )Nz.sty)boolr   dvireadfind_tex_file)packager
   r
   r   _has_tex_packagey   s   rB   )__doc__pathlibr   tempfiler   r   loggingr)   r%   r'   r   r   r   	getLoggerr#   r   r   r   r   r2   r=   rB   r
   r
   r
   r   <module>   s"    
(