rL idZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZmZddlmZmZdd lmZdd lmZdd lmZmZddlZdd lmZdd lmZddZ ejBjEdddddddejFdddeegddejFdddeg dZ$ejBjEddd gd!Z%y)"z Test output reproducibility. N)pyplot)get_sample_data)PathCollection) BboxImage)AnchoredOffsetboxAuxTransformBox)Circle PathPatch)Path)subprocess_run_for_testing)needs_ghostscript needs_usetex)TextPath)IdentityTransformmhipc v tj|tjjd|dt j }d|vr|j ddd}td}|j|dgdzd|j|d gdzd |j|d gdzd |j|d gdzd|j|dgdzdd|vr|j ddd }|jtddtdd|jtdddgd ztddz}|jgdd}t||D]\} } | j| d|vrgdgdgdg} |j ddd j| dgdgdgdg} |j ddd j| dgdgdgdg} |j dddj| dd|vr{Gd d!t} |j d"#} | jd gg}|jt!d$d%&|j#d \}}t j$t'd'}t)d(d)d*+}| ||d,-}t+t-}|j/|t1d.|d/d01}|j/|t3j4j7}|xj8d zc_|xj8d zc_t3j:j7}|j8ddd2|_t3j<||}t3j>dj7}|xj8d3zc_|j#d d d/d/4\}}||fD]}|\}}tA|gdd5d6d7d89}|j||jB|jE|t|dd5d6d7d89}|j||jB|jG||jId:d g|jKd:d gtd}|j ddd}|j|||jMd;|jOd;|jQd;tStTjVdNasdf)z svg.hashsaltz text.usetexm D)markerx^Hvh)bottom)g?g@g @g@)-+r\*oO.i)rrr)rrr)rrrnearest) interpolation)rrrbilinear)rrrbicubicpc8eZdZdZfdZfdZdfd ZxZS)+_save_figure..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. ct||fi|t|jdd|_|jj |y)N)normorigin)super__init__rget_window_extent bbox_imageset_data)selfpathr9kwargs __class__s g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/tests/test_determinism.pyr7z4_save_figure..PathClippedImagePatch.__init__HsA 00"+**d#D((4c$t|dy)zSimply ignore facecolor.noneN)r6 set_facecolor)r;colorr>s r?rCz9_save_figure..PathClippedImagePatch.set_facecolorNs%f-r@c|jj|j|j|jj |t ||yN)r9 set_clip_path_path get_transformdrawr6)r;rendererr>s r?rJz0_save_figure..PathClippedImagePatch.drawRsB--djj$:L:L:NO$$X. X&r@rF)__name__ __module__ __qualname____doc__r7rCrJ __classcell__)r>s@r?PathClippedImagePatchr2@s  5  . ' 'r@rQpolar) projection)rrgioT?)radiuszgrace_hopper.jpg)rrz!?)sizek)ecz upper leftTg?)locchildframeon borderpadg@)sharexshareyblueredgffffff?r')lw edgecolor facecoloralphahatchzA string $1+2+\sigma$buffer)format)-mplusercParamsupdatepltfigure add_subplotrangeplotbar set_xtickszip set_hatchimshowr rGr subplotsimreadrrrr add_artistrr unit_rectangledeepcopyvertices unit_circlemake_compound_pathunit_regular_starr transDataadd_collection add_patchset_xlimset_ylim set_title set_xlabel set_ylabelgetattrsysstdoutsavefig)objectsfmtusetexfigax1rax2barspatternsrspatternArQpxpimgarr text_pathr0 offsetboxaoexteriorinterior clip_pathstarrow1row2row collectionpatchaxrs r? _save_figurersGGCLLLGH **,C g~ooaA& "I QC"HS) QC"HS) QC"HS) QC"HS) QC"HS) g~ooaA&a U1a[1a aS1WU1a[AB +,<h/ #LC MM' " # g~  9 - 1a '''C  9 - 1a '''D  9 - 1a '''C g~ 'I '2___ 0yy1# 6&89\\!_ cjj);<=VT4 !)SS 9#$5$78 Q    z *dqFe$'s4E    3== 9 MM% LL"a ! LL"a ! " aA Aq !BGGAqMLL)*MM*+MM*+ SZZ3:: 6FKKsK#r@zobjects, fmt, usetex)pdfF)rrF)r"rF)r+rF)rrF)rpsFrT)marks)r0svgF)rrFrcDtdDcgc]M}ttjddd|d|d|dgitj ddd d d d j O}}|d dD]2}|dk(r!|r||dk7stjd)||dk(r2Jycc}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, ) 946684800AggSOURCE_DATE_EPOCH MPLBACKENDFT)envtextcapture_outputcheckrNrrz+failed, maybe due to ghostscript timestamps) rqr r executableosenvironrpytestskip)rrr_plotsr0s r?test_determinism_checkrsHq   # ^^T4$Kr#6(!= >&2::&K$&t4  9 :@  @ E 12Y! $;6E!H} IJa= = ! sABz fmt, string)rs!/CreationDate (D:20000101000000Z))rs(%%CreationDate: Sat Jan 01 00:00:00 2000cttjddd|dgitjddddd d j }||vsJy ) 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. rrzMfrom matplotlib.tests.test_determinism import _save_figure; _save_figure('', rrrrTF)rrrrN)r rrrrr)rstringbufs r?"test_determinism_source_date_epochrsl0 % t  G1 & ' "rzz "   "26U$  P QWPV  S==r@)&rOrrr matplotlibrjrrnmatplotlib.cbookrmatplotlib.collectionsrmatplotlib.imagermatplotlib.offsetboxrrmatplotlib.patchesr r matplotlib.pathr matplotlib.testingr matplotlib.testing._markersr rmatplotlib.testing.comparematplotlib.textrmatplotlib.transformsrrmark parametrizeparamrrr@r?rs $,1&C0 9G!$3r$j D$|5F&G I VUD = !!>5 <   r@