
    
3j!                        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                 6   [         R                  " U5        [         R                  R                  SUS.5        S nS nS nS n[	        U 5      S-   n[
        R                  " SS	U-  4S
9n[        UR                  USS9R                  5      n	UR                  SS9  SU ;   a  U" [        U	5      5        SU ;   a  U" [        U	5      5        SU ;   a  U" [        U	5      5        SU ;   a  U" [        U	5      5        [        S5      n
[        U	5      R                  5       nUR                  X5        UR                  S5        UR!                  S5        UR#                  S5        [%        [&        R(                  S[&        R(                  5      nUR+                  XS9  g )Nasdf)zsvg.hashsaltztext.usetexc                    U R                  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  g )N
      D)marker   x   ^   H   v)add_subplotrangeplot)figaxr   s      [/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/tests/test_determinism.pyplot_markers"_save_figure.<locals>.plot_markers   s    __"I
A38C(
A38C(
A38C(
A38C(
A38C(    c           	      8   U R                  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[	        X#5       H  u  pEUR                  U5        M     g )Nr   r      r   bottom)g      ?g      @g      @g      @)-+r   \*oO.)r!   barr"   
set_xtickszip	set_hatch)r$   ax2barspatternsr5   patterns         r&   
plot_hatch _save_figure.<locals>.plot_hatch'   s    ooaU1a[1aaS1WU1a[AB+,</LCMM'" 0r)   c                     U R                  SSSSS9n/ SQ/ SQ/ SQ/nUS   R                  US	S
9  / SQ/ SQ/ SQ/nUS   R                  USS
9  / SQ/ SQ/ SQ/nUS   R                  USS
9  g )Nr   r   T)sharexsharey)r   r   r   )r   r   r   )r   r   r   r   nearest)interpolation)r   r   r   bilinear)r   r   r   r   bicubic)subplotsimshow)r$   axsAs      r&   
plot_image _save_figure.<locals>.plot_image2   sx    ll1aTl:	9-Aay1	9-Aaz2	9-Aay1r)   c                     " S S[         5      nU R                  SS5      nUS   R                  SS9nUR                  S//5      nUR	                  [        S	S
S95        US   R                  5       n[        R                  " [        S5      5      n[        SSSS9nU" XvSS9n[        [        5       5      n	U	R                  U5        [        SU	SSS9n
UR                  U
5        [        R                  " 5       R!                  5       nU=R"                  S-  sl        U=R"                  S-  sl        [        R$                  " 5       R!                  5       nUR"                  S S S2   Ul        [        R&                  " X5      n[        R(                  " S5      R!                  5       nU=R"                  S-  sl        US   R+                  SSSS[-        SSS9S9u  nnUU4 H  nUu  nn[/        U/SSSS S!S"9nUR	                  UUR0                  5        UR3                  U5        [        USSSS S!S"9nUR	                  UUR0                  5        UR5                  U5        UR7                  S#S/5        UR9                  S#S/5        M     g )$Nc                   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>.plot_paths.<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pathrV   kwargs	__class__s       r&   rT   H_save_figure.<locals>.plot_paths.<locals>.PathClippedImagePatch.__init__F   sA     00"+**d#D((4r)   c                 $   > [         TU ]  S5        g)zSimply ignore facecolor.noneN)rS   set_facecolor)rX   colorr[   s     r&   r_   M_save_figure.<locals>.plot_paths.<locals>.PathClippedImagePatch.set_facecolorL   s    %f-r)   c                    > U R                   R                  U R                  U R                  5       5        U R                   R	                  U5        [
        TU ]  U5        g N)rV   set_clip_path_pathget_transformdrawrS   )rX   rendererr[   s     r&   rg   D_save_figure.<locals>.plot_paths.<locals>.PathClippedImagePatch.drawP   sB    --djj$:L:L:NO$$X.X&r)   )rV   rc   )
__name__
__module____qualname____firstlineno____doc__rT   r_   rg   __static_attributes____classcell__)r[   s   @r&   PathClippedImagePatchrN   >   s    5.' 'r)   rq   r   r   r   polar)
projectionr   )r   r   gioT?)radiuszgrace_hopper.jpg)r   r   z!?   )sizek)ecz
upper leftTg?)locchildframeon	borderpadr   r+   g@)hspacewspace)r@   rA   gridspec_kwr   blueredgffffff?r1   )lw	edgecolor	facecoloralphahatch)r
   
subfiguresr!   rG   rd   r	   pltimreadr   r   r   r   
add_artistr   r   unit_rectangledeepcopyverticesunit_circlemake_compound_pathunit_regular_starrF   dictr   	transDataadd_collection	add_patchset_xlimset_ylim)r$   rq   subfigspxpimgr%   arr	text_pathp	offsetboxaoexteriorinterior	clip_pathstarrow1row2rowax1r9   
collectionpatchs                         r&   
plot_paths _save_figure.<locals>.plot_paths<   sW   	'I 	'0 ..A& QZ##w#7yy1#6&89 QZ##%jj);<=VT4	!)S9#$5$78	Q<y$),.
b &&(113QQ##%..0$--dd3++H?	%%a(113qz**1aT7;1Q7O + Qt$<CHC'127s#OJ$$Y>z*dqFe$'s4E	3==9MM% LL"a!LL"a!  r)   r      r   )figsizeF)squeezeg333333?r,   mhir   r   zA string $1+2+\sigma$buffer)format)mplusercParamsupdatelenr   figureiterr   flatsubplots_adjustnextr"   r!   r#   	set_title
set_xlabel
set_ylabelgetattrsysstdoutsavefig)objectsfmtusetexr'   r=   rJ   r   nfigsr$   r   r   r%   r   s                r&   _save_figurer      sK   GGCLLLGH)	#2F"P L1E
**aU^
,C3>>%>7<<=Gt$
g~T']#
g~4=!
g~4=!
g~4=!aA	g	"	"	$BGGAMLL)*MM*+MM*+SZZ3::6FKKK#r)   zobjects, fmt, usetex) pdfF)r   r   F)r   r   F)r   r   F)r   r   F)r   psFr   T)marks)r   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 the same graph three times and check 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)	r"   r   r   
executableosenvironr   pytestskip)r   r   r   _plotsr   s         r&   test_determinism_checkr      s    D 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)al  
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    2 %	t G1
&	'"rzz " "26U$P
 QWPV  ==r)   )&rn   r   r   r   
matplotlibr   r   r   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    r)   r&   <module>r      s    
 
   $ , 1 & C 0   9 G ! $ 3A$H VT4>O/PQVUD=!!< 5
 	<		r)   