
    h                        S r SSKrSSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJrJr  SSKJrJr  SS	KJr  SS
KJr  SSKJrJr  SSKrSSKJr  SSKJr  SS jr \RB                  RE                  SSSSSSS\RF                  " SSS\\/S9SS\RF                  " SSS\S9/
5      S 5       r$\RB                  RE                  SSS /5      S! 5       r%g)"z
Test output reproducibility.
    N)pyplot)get_sample_data)PathCollection)	BboxImage)AnchoredOffsetboxAuxTransformBox)Circle	PathPatch)Path)subprocess_run_for_testing)needs_ghostscriptneeds_usetex)TextPath)IdentityTransformmhipc           
      &
   [         R                  " U5        [         R                  R                  SUS.5        [        R
                  " 5       nSU ;   a  UR                  SSS5      n[        S5      nUR                  US/S-  SS9  UR                  US	/S-  S
S9  UR                  US/S-  SS9  UR                  US/S-  SS9  UR                  US/S-  SS9  SU ;   a  UR                  SSS	5      nUR                  [        SS5      [        SS5      5      UR                  [        SS5      S/S-  [        SS5      S9-   nUR                  / SQ5        Sn[        Xx5       H  u  pU	R                  U
5        M     SU ;   a  / SQ/ SQ/ SQ/nUR                  SSS5      R                  USS9  / SQ/ SQ/ SQ/nUR                  SSS5      R                  USS9  / SQ/ SQ/ SQ/nUR                  SSS5      R                  USS9  SU ;   Gah   " S  S![        5      nUR                  S"S#9nUR                  S	//5      nUR                  [!        S$S%S&95        UR#                  S	5      u  pF[        R$                  " ['        S'5      5      n[)        S(S)S*S+9nU" UUS,S-9n[+        [-        5       5      nUR/                  U5        [1        S.US/S0S19nUR/                  U5        [2        R4                  " 5       R7                  5       nU=R8                  S-  sl        U=R8                  S	-  sl        [2        R:                  " 5       R7                  5       nUR8                  S S S22   Ul        [2        R<                  " UU5      n[2        R>                  " S5      R7                  5       nU=R8                  S3-  sl        UR#                  S	S	S/S/S49u  nnUU4 H  nUu  pF[A        U/SS5S6S7S8S99nUR                  UURB                  5        URE                  U5        [        USS5S6S7S8S99nUR                  UURB                  5        URG                  U5        URI                  S:S/5        URK                  S:S/5        M     [        S5      nUR                  SSS5      nUR                  XU5        URM                  S;5        URO                  S;5        URQ                  S;5        [S        [T        RV                  S<[T        RV                  5      nURY                  UUS=9  g )>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   bicubicpc                   H   ^  \ rS rSrSrU 4S jrU 4S jrSU 4S jjrSrU =r	$ )+_save_figure.<locals>.PathClippedImagePatch@   z
The given image is used to draw the face of the patch. Internally,
it uses BboxImage whose clippath set to the path of the patch.

FIXME : The result is currently dpi dependent.
c                    > [         TU ]  " U40 UD6  [        U R                  S S S9U l        U R                  R                  U5        g )N)normorigin)super__init__r   get_window_extent
bbox_imageset_data)selfpathr:   kwargs	__class__s       S/var/www/html/env/lib/python3.13/site-packages/matplotlib/tests/test_determinism.pyr8   4_save_figure.<locals>.PathClippedImagePatch.__init__H   sA     00"+**d#D((4    c                 $   > [         TU ]  S5        g)zSimply ignore facecolor.noneN)r7   set_facecolor)r<   colorr?   s     r@   rE   9_save_figure.<locals>.PathClippedImagePatch.set_facecolorN   s    %f-rB   c                    > U R                   R                  U R                  U R                  5       5        U R                   R	                  U5        [
        TU ]  U5        g N)r:   set_clip_path_pathget_transformdrawr7   )r<   rendererr?   s     r@   rM   0_save_figure.<locals>.PathClippedImagePatch.drawR   sB    --djj$:L:L:NO$$X.X&rB   )r:   rI   )
__name__
__module____qualname____firstlineno____doc__r8   rE   rM   __static_attributes____classcell__)r?   s   @r@   PathClippedImagePatchr2   @   s    5.' 'rB   rW   polar)
projection)r   r   gioT?)radiuszgrace_hopper.jpg)r   r   z!?   )sizek)ecz
upper leftTg?)locchildframeon	borderpadg@)sharexshareyblueredgffffff?r'   )lw	edgecolor	facecoloralphahatchzA string $1+2+\sigma$buffer)format)-mplusercParamsupdatepltfigureadd_subplotrangeplotbar
set_xtickszip	set_hatchimshowr
   rJ   r	   subplotsimreadr   r   r   r   
add_artistr   r   unit_rectangledeepcopyverticesunit_circlemake_compound_pathunit_regular_starr   	transDataadd_collection	add_patchset_xlimset_ylim	set_title
set_xlabel
set_ylabelgetattrsysstdoutsavefig)objectsfmtusetexfigax1r   ax2barspatternsry   patternArW   pxpimgarr	text_pathr0   	offsetboxaoexteriorinterior	clip_pathstarrow1row2row
collectionpatchaxr   s                                  r@   _save_figurer      s   GGCLLLGH
**,C
g~ooaA&"IQC"HS)QC"HS)QC"HS)QC"HS)QC"HS)
g~ooaA&aU1a[1aaS1WU1a[AB+,</LCMM'" 0 g~	9-1a '''C	9-1a '''D	9-1a '''C
g~	'I 	'2 ___0yy1#6&89 \\!_
jj);<=VT4	!)SS9#$5$78	Q<y$),.r &&(113QQ##%..0$--dd3++Hh?	%%a(113||Aqd|Ct$<CHC'127s#OJ$$Y>z*dqFe$'s4E	3==9MM% LL"a!LL"a!   	aA	Aq	!BGGAMLL)*MM*+MM*+SZZ3::6FKKsK#rB   zobjects, fmt, usetex) pdfF)r   r   F)r"   r   F)r+   r   F)r   r   F)r   psFr   T)marks)r0   svgF)r   r   Fr   c                 ^   [        S5       Vs/ s HM  n[        [        R                  SSSU < SU< SU S3/0 [        R
                  ESSS	.ES
SSS9R                  PMO     nnUSS  H<  nUS:X  a)  U(       a"  XTS   :w  a  [        R                  " S5        M0  M2  XTS   :X  a  M<   e   gs  snf )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, and 'p' for paths.
fmt : {"pdf", "ps", "svg"}
    Output format.
r   -R-czHfrom matplotlib.tests.test_determinism import _save_figure;_save_figure(z, )	946684800AggSOURCE_DATE_EPOCH
MPLBACKENDFT)envtextcapture_outputcheckr   Nr   r   z+failed, maybe due to ghostscript timestamps)	rw   r   r   
executableosenvironr   pytestskip)r   r   r   _plotsr0   s         r@   test_determinism_checkr      s    H q	 A 	#^^T4$Kr#6(!=>&2:: &K$&t4	9 :@	@  
 	 12Y$;6!H}IJ  a= = 	s   AB*zfmt, string)r   s!   /CreationDate (D:20000101000000Z))r   s(   %%CreationDate: Sat Jan 01 00:00:00 2000c                     [        [        R                  SSSU < S3/0 [        R                  ESSS.ESS	SS
9R
                  nX;   d   eg)ak  
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.
r   r   zMfrom matplotlib.tests.test_determinism import _save_figure; _save_figure('', r   r   r   r   TF)r   r   r   r   N)r   r   r   r   r   r   )r   stringbufs      r@   "test_determinism_source_date_epochr      sj    0 %	t G1
&	'"rzz " "26U$P
 QWPV  ==rB   )&rT   r   r   r   
matplotlibrp   r   rt   matplotlib.cbookr   matplotlib.collectionsr   matplotlib.imager   matplotlib.offsetboxr   r   matplotlib.patchesr	   r
   matplotlib.pathr   matplotlib.testingr   matplotlib.testing._markersr   r   matplotlib.testing.comparematplotlib.textr   matplotlib.transformsr   r   markparametrizeparamr   r    rB   r@   <module>r      s    
 
   $ , 1 & C 0   9 G ! $ 3r$j D$|5F&G	IVUD=!!> 5
 	<		rB   