Ë
    ¨eh  ã                   ó¼  — d 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	 ddl
mZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZmZ ddlZddlmZ ddlmZ dd„Z ejB                  jE                  ddddddd ejF                  dddeeg¬«      dd ejF                  ddde¬«      g
«      d„ «       Z$ejB                  jE                  ddd g«      d!„ «       Z%y)"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           	      óv
  — t        j                  |«       t         j                  j                  d|dœ«       t	        j
                  «       }d| v r–|j                  ddd«      }t        d«      }|j                  |dgdz  d¬«       |j                  |d	gdz  d
¬«       |j                  |dgdz  d¬«       |j                  |dgdz  d¬«       |j                  |dgdz  d¬«       d| v r |j                  ddd	«      }|j                  t        dd«      t        dd«      «      |j                  t        dd«      dgdz  t        dd«      ¬«      z   }|j                  g d¢«       d}t        ||«      D ]  \  }	}
|	j                  |
«       Œ d| v r�g d¢g d¢g d¢g}|j                  ddd«      j                  |d¬«       g d¢g d¢g d¢g}|j                  ddd«      j                  |d¬«       g d¢g d¢g d¢g}|j                  ddd«      j                  |d¬«       d| v �r{ G d „ d!t        «      }|j                  d"¬#«      }|j                  d	gg«      }|j                  t!        d$d%¬&«      «       |j#                  d	«      \  }}t	        j$                  t'        d'«      «      }t)        d(d)d*¬+«      } |||d,¬-«      }t+        t-        «       «      }|j/                  |«       t1        d.|d/d0¬1«      }|j/                  |«       t3        j4                  «       j7                  «       }|xj8                  dz  c_        |xj8                  d	z  c_        t3        j:                  «       j7                  «       }|j8                  d d d2…   |_        t3        j<                  ||«      }t3        j>                  d«      j7                  «       }|xj8                  d3z  c_        |j#                  d	d	d/d/¬4«      \  }}||fD ]ª  }|\  }}tA        |gdd5d6d7d8¬9«      }|j                  ||jB                  «       |jE                  |«       t        |dd5d6d7d8¬9«      }|j                  ||jB                  «       |jG                  |«       |jI                  d:dg«       |jK                  d:dg«       Œ¬ t        d«      }|j                  ddd«      }|j                  ||«       |jM                  d;«       |jO                  d;«       |jQ                  d;«       tS        tT        jV                  d<tT        jV                  «      }|jY                  ||¬=«       y )>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                   ó8   ‡ — e Zd ZdZˆ fd„Zˆ fd„Zdˆ fd„	Zˆ xZS )ú+_save_figure.<locals>.PathClippedImagePatchzã
            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        ‰| �  |fi |¤Ž t        | j                  d d ¬«      | _        | j                  j                  |«       y )N)ÚnormÚorigin)ÚsuperÚ__init__r   Úget_window_extentÚ
bbox_imageÚset_data)ÚselfÚpathr9   ÚkwargsÚ	__class__s       €ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/matplotlib/tests/test_determinism.pyr7   z4_save_figure.<locals>.PathClippedImagePatch.__init__H   sA   ø€ Ü‘Ñ  Ñ0¨Ò0Ü"+Ø×*Ñ*°¸dô#D�”à—‘×(Ñ(¨Õ4ó    c                 ó$   •— t         ‰| �  d«       y)zSimply ignore facecolor.ÚnoneN)r6   Úset_facecolor)r;   Úcolorr>   s     €r?   rC   z9_save_figure.<locals>.PathClippedImagePatch.set_facecolorN   s   ø€ ä‘Ñ% fÕ-r@   c                 óÂ   •— | j                   j                  | j                  | j                  «       «       | j                   j	                  |«       t
        ‰| �  |«       y ©N)r9   Úset_clip_pathÚ_pathÚget_transformÚdrawr6   )r;   Úrendererr>   s     €r?   rJ   z0_save_figure.<locals>.PathClippedImagePatch.drawR   sB   ø€ à—‘×-Ñ-¨d¯j©j¸$×:LÑ:LÓ:NÔOØ—‘×$Ñ$ XÔ.Ü‘‘˜XÕ&r@   rF   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r7   rC   rJ   Ú__classcell__)r>   s   @r?   ÚPathClippedImagePatchr2   @   s   ø„ ñô5ô.÷'ñ 'r@   rQ   Úpolar)Ú
projection)r   r   gioð…ÉTÕ?)Úradiuszgrace_hopper.jpg)r   r   z!?é–   )ÚsizeÚk)Úecz
upper leftTgš™™™™™É?)ÚlocÚchildÚframeonÚ	borderpadéÿÿÿÿgÍÌÌÌÌÌ@)ÚsharexÚshareyÚblueÚredgffffffæ?r'   )ÚlwÚ	edgecolorÚ	facecolorÚalphaÚhatchéýÿÿÿzA string $1+2+\sigma$Úbuffer)Úformat)-ÚmplÚuseÚrcParamsÚupdateÚpltÚfigureÚadd_subplotÚrangeÚplotÚbarÚ
set_xticksÚzipÚ	set_hatchÚimshowr
   rG   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Úpatternsrs   ÚpatternÚArQ   ÚpxÚpimgÚarrÚ	text_pathr0   Ú	offsetboxÚaoÚexteriorÚinteriorÚ	clip_pathÚstarÚrow1Úrow2ÚrowÚ
collectionÚpatchÚaxr‹   s                                  r?   Ú_save_figurer§      s™  € Ü‡G�GˆC„LÜ‡L�L×Ñ¨ÀÑGÔHä
�*‰*‹,€Cà
ˆg�~à�o‰o˜a  AÓ&ˆÜ�"‹IˆØ�‰��Q�C˜"‘H SˆÔ)Ø�‰��Q�C˜"‘H SˆÔ)Ø�‰��Q�C˜"‘H SˆÔ)Ø�‰��Q�C˜"‘H SˆÔ)Ø�‰��Q�C˜"‘H SˆÔ)à
ˆg�~à�o‰o˜a  AÓ&ˆØ—‘œ˜a ›¤U¨1¨a£[Ó1Ø—‘œ˜a › a S¨1¡W´U¸1¸a³[�ÓAñBˆà�‰Ò+Ô,à<ˆÜ  hÓ/ò 	#‰LˆC�Ø�M‰M˜'Õ"ð	#ð ˆg�~âš	¢9Ð-ˆØ�‰˜˜1˜aÓ ×'Ñ'¨¸Ð'ÔCÚš	¢9Ð-ˆØ�‰˜˜1˜aÓ ×'Ñ'¨¸Ð'ÔDÚš	¢9Ð-ˆØ�‰˜˜1˜aÓ ×'Ñ'¨¸Ð'ÔCà
ˆg‚~ô	'¤Iô 	'ð2 �_‰_¨ˆ_Ó0ˆØ�y‰y˜1˜#˜ÓˆØ×Ñœ6 &°Ô8Ô9ð —\‘\ !“_‰
ˆˆcÜ�j‰jœÐ);Ó<Ó=ˆÜ˜V T°Ô4ˆ	Ù! )¨S°SÔ9ˆÜ#Ô$5Ó$7Ó8ˆ	Ø×Ñ˜QÔÜ <°yÈ$Ø),ô.ˆà�‰�rÔô ×&Ñ&Ó(×1Ñ1Ó3ˆØ×Ò˜QÑÕØ×Ò˜QÑÕÜ×#Ñ#Ó%×.Ñ.Ó0ˆØ$×-Ñ-©d°¨dÑ3ˆÔÜ×+Ñ+¨H°hÓ?ˆ	ä×%Ñ% aÓ(×1Ñ1Ó3ˆØ�Š˜Ñ�à—|‘| A q°¸d�|ÓC‰ˆˆtØ˜$�<ò 	"ˆCØ‰HˆC�Ü'¨¨°1ÀØ27¸sÈ#ôOˆJà×$Ñ$ Y°·±Ô>Ø×Ñ˜zÔ*ä˜d q°FÀeØ$'¨sô4ˆEà×Ñ 	¨3¯=©=Ô9Ø�M‰M˜%Ô à�L‰L˜"˜a˜Ô!Ø�L‰L˜"˜a˜Õ!ð	"ô 	ˆa‹€AØ	�‰˜˜A˜qÓ	!€BØ‡G�GˆAˆq„MØ‡L�LÐ)Ô*Ø‡M�MÐ*Ô+Ø‡M�MÐ*Ô+ä”S—Z‘Z ¬3¯:©:Ó6€FØ‡K�K�˜s€KÕ#r@   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                 óD  — t        d«      D �cg c]M  }t        t        j                  ddd| ›d|›d|› d�gi t        j
                  ¥ddd	œ¥d
dd¬«      j                  ‘ŒO }}|dd D ]2  }|dk(  r!|r||d   k7  sŒt        j                  d«       Œ)||d   k(  rŒ2J ‚ yc c}w )aR  
    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)	rq   r   rŠ   Ú
executableÚosÚenvironr‹   ÚpytestÚskip)r�   rŽ   r�   Ú_Úplotsr0   s         r?   Útest_determinism_checkrÁ   Ž   sÖ   € ôH �q“ö	ð ô 	#Ü�^‰^˜T 4ðØ$˜K r¨#¨°°6°(¸!ð=ð>ð&”2—:‘:ð &°KØ$ò&à t°4ô	9÷ :@¹ñ	@ð	€Eð 	ð �1�2ˆYò !ˆØ�$Š;™6Ø�E˜!‘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                 óš   — t        t        j                  ddd| ›d�gi t        j                  ¥dddœ¥dd	d¬
«      j
                  }||v sJ ‚y)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.
    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Å   ¼   sl   € ô0 %Ü	�‰˜˜tðØ ˜G 1ð
&ð	'ð"Œr�z‰zð "°Ø ò"Ø26¸UÈ$ôP÷
 QWÑPVð ð �S‰=Ð‰=r@   )&rO   r»   rŠ   r½   Ú
matplotlibrj   r   rn   Ú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ór$ðj ‡�×ÑØØØØØØØØˆ�‰Ø�D˜$ |Ð5FÐ&Gô	IàØØˆ�‰�V˜U D°Ô=ðóñ!óð!ð> ‡�×ÑØØ5ð
 	<ðó	ñó	ñr@   