
    Ng                     T   d 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 ddl	m
Z
mZ ddlmZ dd	Zej                            d
dddddd ej        dddee
g          d ej        ddde          g	          d             Zej                            dddg          d             ZdS )z
Test output reproducibility.
    N)pyplot)needs_ghostscriptneeds_usetex)subprocess_run_for_testingmhipdfFc           	      X   t          j        |           t           j                            d|d           t	          j                    }d| v r|                    ddd          }t          d          }|                    |dgdz  d           |                    |d	gdz  d
           |                    |dgdz  d           |                    |dgdz  d           |                    |dgdz  d           d| v r|                    ddd	          }|	                    t          dd          t          dd                    |	                    t          dd          dgdz  t          dd                    z   }|
                    g d           d}t          ||          D ]\  }	}
|	                    |
           d| v rg dg dg dg}|                    ddd                              |d           g dg dg dg}|                    ddd                              |d           g dg dg dg}|                    ddd                              |d           t          d          }|                    ddd          }|                    ||           |                    d           |                    d           |                    d           t#          t$          j        d t$          j                  }|                    ||!           d S )"Nasdf)zsvg.hashsaltztext.usetexm      
   D)marker   x   ^   H   vh)bottom)g      ?g      @g      @g      @)-+r   \*oO.i)r   r   r   )r   r   r   )r   r   r   nearest)interpolation)r   r   r   bilinear)r   r   r   bicubiczA string $1+2+\sigma$buffer)format)mplusercParamsupdatepltfigureadd_subplotrangeplotbar
set_xtickszip	set_hatchimshow	set_title
set_xlabel
set_ylabelgetattrsysstdoutsavefig)objectsfmtusetexfigax1r   ax2barspatternsr2   patternAaxr<   s                 ]/var/www/html/ai-engine/env/lib/python3.11/site-packages/matplotlib/tests/test_determinism.py_save_figurerJ      s    GCLLLLGGHHH
*,,C
g~~ooaA&&"IIQC"HS)))QC"HS)))QC"HS)))QC"HS)))QC"HS)))
g~~ooaA&&aU1a[[11aaS1WU1a[[AAB+++,,,<h// 	# 	#LCMM'""""
g~~YY			999-1a  '''CCCYY			999-1a  '''DDDYY			999-1a  '''CCCaA	Aq	!	!BGGAqMMMLL)***MM*+++MM*+++SZ3:66FKKsK#####    zobjects, fmt, usetex) r   F)r   r   F)r   r   F)r"   r   F)r   r   F)r   psFrM   T)marks)r   svgFrO   c                       fdt          d          D             }|dd         D ]9}dk    r#r!||d         k    rt          j        d           +||d         k    sJ :dS )a?  
    Output three times the same graphs and checks that the outputs are exactly
    the same.

    Parameters
    ----------
    objects : str
        Objects to be included in the test document: 'm' for markers, 'h' for
        hatch patterns, 'i' for images.
    fmt : {"pdf", "ps", "svg"}
        Output format.
    c                     g | ]D}t          t          j        d dddd dgi t          j        ddddd	d	
          j        ES )-R-czHfrom matplotlib.tests.test_determinism import _save_figure;_save_figure(z, )	946684800AggSOURCE_DATE_EPOCH
MPLBACKENDFT)envtextcapture_outputcheckr   r;   
executableosenvironr<   ).0_r?   r>   r@   s     rI   
<listcomp>z*test_determinism_check.<locals>.<listcomp>[   s     	 	 	  	#^T4=$= =*-= =39= = =>&2: &K$& & &t4	9 	9 	9 :@	 	 	rK   r   r   NrM   r   z+failed, maybe due to ghostscript timestamps)r0   pytestskip)r>   r?   r@   plotsps   ```  rI   test_determinism_checkri   @   s    6	 	 	 	 	 	 q	 	 	E 122Y ! !$;;6;E!H}}IJJJa=====! !rK   zfmt, string)r   s!   /CreationDate (D:20000101000000Z))rM   s(   %%CreationDate: Sat Jan 01 00:00:00 2000c                     t          t          j        ddd| dgi t          j        ddddd	d
          j        }||v sJ dS )a  
    Test SOURCE_DATE_EPOCH support. Output a document with the environment
    variable SOURCE_DATE_EPOCH set to 2000-01-01 00:00 UTC and check that the
    document contains the timestamp that corresponds to this date (given as an
    argument).

    Parameters
    ----------
    fmt : {"pdf", "ps", "svg"}
        Output format.
    string : bytes
        Timestamp string for 2000-01-01 00:00 UTC.
    rR   rS   zMfrom matplotlib.tests.test_determinism import _save_figure; _save_figure('', rT   rU   rV   rW   TF)rZ   r\   r[   r]   Nr^   )r?   stringbufs      rI   "test_determinism_source_date_epochrm   m   s    0 %	t
& 
& 
& 
&	'"rz " " " "26U$P P P
 QW  S======rK   )__doc__r`   r;   re   
matplotlibr)   matplotlib.testing.comparer   r-   matplotlib.testing._markersr   r   matplotlib.testingr   rJ   markparametrizeparamri   rm    rK   rI   <module>rw      sl    
			 



      ! ! ! ! $ $ $ $ $ $ G G G G G G G G 9 9 9 9 9 9,$ ,$ ,$ ,$^ 4l4E%F	H 	H 	HUE4|<<< ! ! !> 5
 	<	 	 	 	  rK   