o
    îÇhV6  ã                   @   s@  d dl Z d dlZd dlZd dlmZ d dlZd dlZd dl	m
Z
 d dlmZ dd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Z d-d.„ Z!d/d0„ Z"d1d2„ Z#d3d4„ Z$d5d6„ Z%d7d8„ Z&d9d:„ Z'd;d<„ Z(d=d>„ Z)d?d@„ Z*dS )Aé    N)ÚPath)Úsubprocess_run_for_testing)Úpyplotc              
   C   s¾   t  d¡ ttjƒjd d }| ¡ st  d¡ ttjƒ 	¡ }| d }| 
|d¡ ttjt|ƒt|ƒgdd | 	d¡}||kr]d	 tj| d	¡| d	¡d
dddd¡}t  d| ¡ d S d S )NÚblacké   ztools/boilerplate.pyzboilerplate.py not foundz	pyplot.pyzutf-8T)ÚcheckÚ
zfound pyplot.pyzexpected pyplot.pyr   Ú )ÚfromfileÚtofileÚnÚlinetermzøpyplot.py is not up-to-date. Please run 'python tools/boilerplate.py' to update pyplot.py. This needs to be done from an environment where your current working copy is installed (e.g. 'pip install -e'd). Here is a diff of unexpected differences:
%s)ÚpytestÚimportorskipr   ÚmplÚ__file__ÚparentsÚexistsÚskipÚpltÚ	read_textÚ
write_textr   ÚsysÚ
executableÚstrÚjoinÚdifflibÚunified_diffÚsplitÚfail)Útmp_pathÚ
gen_scriptÚorig_contentsÚplt_fileÚnew_contentsÚdiff_msg© r&   úp/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/matplotlib/tests/test_pyplot.pyÚtest_pyplot_up_to_date   s6   

þ
üÿüÿùr(   c                 C   sä   t j t jdd¡t j t jd¡ddd„ƒƒ}t |¡ddd„ƒ}|d ƒ |d d |d d d	 |d d d
 | r9J ‚t t j	¡ |d d W d   ƒ n1 sOw   Y  t t j	¡ |d d ƒ W d   ƒ d S 1 skw   Y  d S )NÚoldÚnewÚkwoc                 S   ó   d S ©Nr&   ©r*   r+   r&   r&   r'   Úfunc.   s   z1test_copy_docstring_and_deprecators.<locals>.funcc                 S   r,   r-   r&   r.   r&   r&   r'   Úwrapper_func3   s   z9test_copy_docstring_and_deprecators.<locals>.wrapper_func)r*   )r+   r.   )r)   r-   )
r   Ú_apiÚrename_parameterÚ__version__Úmake_keyword_onlyr   Ú_copy_docstring_and_deprecatorsr   ÚwarnsÚMatplotlibDeprecationWarning)Úrecwarnr/   r0   r&   r&   r'   Ú#test_copy_docstring_and_deprecators-   s    
ÿ"ÿr9   c                  C   sd   t  ¡ \} }t  d¡ | ¡ rJ ‚t  d¡ | ¡ sJ ‚t  ¡  | ¡ r&J ‚t  ¡  | ¡ s0J ‚d S )NFT)r   ÚsubplotsÚboxÚget_frame_on)ÚfigÚaxr&   r&   r'   Útest_pyplot_boxB   s   

r?   c                   C   s   t  g d¢g d¢¡ d S )N)é   r   é   )r   Ú	stackplotr&   r&   r&   r'   Útest_stackplot_smokeN   s   rC   c                   C   sr   t  t¡ tjdd W d   ƒ n1 sw   Y  t  t¡ tjdd W d   ƒ d S 1 s2w   Y  d S )Nr@   )Únrows)Úncols)r   ÚraisesÚ	TypeErrorr   Úsubplotr&   r&   r&   r'   Útest_nrows_errorS   s   ÿ"ÿrI   c                   C   s¬   t  ¡  t ¡ s
J ‚t  ¡  t ¡ rJ ‚W d   ƒ n1 sw   Y  t ¡ s*J ‚t  ¡  t ¡ r4J ‚t  ¡  t ¡ r?J ‚W d   ƒ n1 sIw   Y  t ¡ rTJ ‚d S r-   )r   Úionr   Úis_interactiveÚioffr&   r&   r&   r'   Ú	test_ioffZ   ó   
ÿ
ÿrM   c                   C   s¬   t  ¡  t ¡ r
J ‚t  ¡  t ¡ sJ ‚W d   ƒ n1 sw   Y  t ¡ r*J ‚t  ¡  t ¡ s4J ‚t  ¡  t ¡ s?J ‚W d   ƒ n1 sIw   Y  t ¡ sTJ ‚d S r-   )r   rL   r   rK   rJ   r&   r&   r&   r'   Útest_ionh   rN   rO   c                	   C   sd  t  ¡  t  ¡ . t ¡ rJ ‚t  ¡  t ¡ sJ ‚W d   ƒ n1 s$w   Y  t ¡ r/J ‚W d   ƒ n1 s9w   Y  t ¡ sDJ ‚t  ¡ " t  ¡  t ¡ rTJ ‚W d   ƒ n1 s^w   Y  W d   ƒ n1 smw   Y  t ¡ sxJ ‚t  ¡  t  ¡  W d   ƒ n1 s‹w   Y  t ¡ s–J ‚t  ¡  t  ¡ . t ¡ s¥J ‚t  ¡  t ¡ r°J ‚W d   ƒ n1 sºw   Y  t ¡ sÅJ ‚W d   ƒ n1 sÏw   Y  t ¡ rÚJ ‚t  ¡ " t  ¡  t ¡ sêJ ‚W d   ƒ n1 sôw   Y  W d   ƒ n	1 sw   Y  t ¡ rJ ‚t  ¡  t  ¡  W d   ƒ n	1 s$w   Y  t ¡ r0J ‚d S r-   )r   rJ   rL   r   rK   r&   r&   r&   r'   Útest_nested_ion_ioffv   sP   

ÿü

ÿ€ÿ

ÿ

ÿü

ÿ€ÿ

ÿrP   c               
   C   sH   zt  d¡ W d S  ty# }  zt| ƒdksJ ‚W Y d } ~ d S d } ~ ww )Ngš™™™™™ñ?zQclose() argument must be a Figure, an int, a string, or None, not <class 'float'>)r   ÚcloserG   r   )Úer&   r&   r'   Ú
test_close¢   s   €ÿrS   c                  C   s^   t  d¡} | t  ¡ u sJ ‚t  d¡}|t  ¡ u sJ ‚t  d¡}| t  ¡ u s'J ‚| |u s-J ‚d S )Néy   éz   )r   rH   Úgca©Úax1Úax2Úax3r&   r&   r'   Útest_subplot_reuseª   s   


r[   c                  C   sÆ   t  ¡  t  ¡ } t  ¡ }| d usJ ‚|| usJ ‚t  ¡  t  ¡  t jdd} t jdd}| d us2J ‚|| us8J ‚t  ¡  t  ¡  t jdd} t  ¡ }| d usPJ ‚|jdksWJ ‚|| us]J ‚t  ¡  d S )NÚpolar©Ú
projectionÚrectilinear)r   ÚfigureÚaxesrQ   Úname©r>   rX   r&   r&   r'   Útest_axes_kwargs´   s&   rd   c                  C   sê   t  ¡ } t  ddd¡}t  ddd¡}t  ddd¡}t jddddd}t jddddd}|d us1J ‚||u s7J ‚||us=J ‚||usCJ ‚||u sIJ ‚|| jv sPJ ‚|| jv sWJ ‚|| jv s^J ‚|jdkseJ ‚|jdkslJ ‚|jdkssJ ‚d S )Nr@   r   r\   r]   r_   )r   r`   rH   ra   rb   )r=   r>   rX   rY   rZ   Úax4r&   r&   r'   Útest_subplot_replace_projectionÍ   s"   rf   c                  C   s`   t jddd} t jddd}| |u sJ ‚|  ¡  t jddd}| |us%J ‚| t  ¡ jvs.J ‚d S )Nr\   r   )r^   Útheta_offsetr@   )r   rH   ÚremoveÚgcfra   rW   r&   r&   r'   Útest_subplot_kwarg_collisionå   s   rj   c                  C   s<   t  ¡  t  ¡ } t  ¡ }| d usJ ‚|| u sJ ‚t  ¡  d S r-   )r   r`   rV   rQ   rc   r&   r&   r'   Útest_gcaï   s   rk   c                  C   s¾   t  d¡} | t  ¡ u sJ ‚| t  d¡u sJ ‚|  ¡  t jddd}|t  ¡ u s)J ‚| t  ¡ jvs2J ‚|t  d¡u s;J ‚| ¡  t jddd}|t  ¡ u sNJ ‚||usTJ ‚|t  ¡ jvs]J ‚d S )Néo   r\   r]   r_   )r   rH   rV   rh   ri   ra   rW   r&   r&   r'   Útest_subplot_projection_reuseù   s   
rm   c                  C   sˆ   t jddd} t jddd}t jdddd}| |u sJ ‚| |u s"J ‚tjtdd t jddd	d}W d   ƒ d S 1 s=w   Y  d S )
Nrl   r\   r]   T)r\   )r\   r^   zpolar=True, yet projection='3d'©ÚmatchÚ3d)r   rH   r   rF   Ú
ValueErrorrW   r&   r&   r'   Ú test_subplot_polar_normalization  s   ÿ"þrr   c                  C   s~   t ƒ } t ¡ }|  |¡ d}|D ] }| ¡  tj|d}|t ¡ u s$J ‚|j|ks+J ‚|  |¡ qt| ƒdt|ƒ ks=J ‚d S )N)ÚaitoffÚhammerÚlambertÚ	mollweider\   r_   rp   r]   r@   )Úsetr   rH   Úaddrh   rb   Úlen)Úcreated_axesr>   ÚprojectionsÚprojr&   r&   r'   Útest_subplot_change_projection  s   
r}   c                  C   sX   t  ddd¡\} t| tjjƒsJ ‚t  ddd¡\}t|tjjƒs"J ‚| j|ju s*J ‚d S )Ng        g      ð?Úrog…ëQ¸ù?ç      à?Úbo)r   r\   Ú
isinstancer   ÚlinesÚLine2Dra   )Úln1Úln2r&   r&   r'   Útest_polar_second_call.  s
   r†   c                  C   sz   t  g d¢¡} t jg d¢d}tj |j ¡ | j ¡ ¡ t  g d¢¡} t jg d¢g d¢d}tj |j ¡ | j ¡ ¡ d S )N)çš™™™™™É?r‡   r   r   )Úposition)çš™™™™™¹?r‰   çš™™™™™é?rŠ   )r   ra   ÚnpÚtestingÚassert_allcloseÚbboxÚ
get_points)ÚaxrefÚaxtestr&   r&   r'   Útest_fallback_position8  s   ÿÿr’   c                  C   sX   t  ¡ } |  d¡}t  ¡  t  ¡ | ksJ ‚t  |d ¡}t  ¡ | ks$J ‚|| ks*J ‚d S )Nr   r@   )r   r`   Ú
subfiguresri   )Úfig1ÚsubfigsÚcurrentr&   r&   r'   Ú%test_set_current_figure_via_subfigureF  s   
r—   c                  C   sd   t  ¡ } |  d¡}|d jddd}|d jddd t  ¡ |ks#J ‚t  |¡ t  ¡ |ks0J ‚d S )Nr   r   r@   T)Úsqueeze)r   r`   r“   r:   rV   Úsca)r=   r•   r>   r&   r&   r'   Ú"test_set_current_axes_on_subfigureR  s   

rš   c                  C   s,   t  d¡} tjj| jddd d¡dd d S )NÚIPythonz--pylabz-cú;)zimport matplotlib.pyplot as pltz<assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHONé<   )Útimeout)r   r   r   rŒ   Úsubprocess_run_helperÚstart_ipythonr   )r›   r&   r&   r'   Útest_pylab_integration^  s   

ør¡   c                  C   sŠ   t tƒjd } |  ¡ st d¡ dd„ }|  ¡  d¡}t||ƒƒ}tt	 
¡ ƒ}| |¡}|r5td|›ƒ‚| |¡}|rCtd|›ƒ‚dS )	z6Test that pyplot_summary lists all the plot functions.z#../../../doc/api/pyplot_summary.rstz#Documentation sources not availablec                 S   sZ   g }d}| D ]$}|s|  d¡rd}q|r|  d¡rq|d  ¡ s#d}q| | ¡ ¡ q|S )ae  
        Return a list of all the functions that are mentioned in the
        autosummary blocks contained in *lines*.

        An autosummary block looks like this::

            .. autosummary::
               :toctree: _as_gen
               :template: autosummary.rst
               :nosignatures:

               plot
               plot_date

        Fz.. autosummary::Tz   :r   )Ú
startswithÚisspaceÚappendÚstrip)r‚   Ú	functionsÚin_autosummaryÚliner&   r&   r'   Úextract_documented_functionsr  s   
€z=test_doc_pyplot_summary.<locals>.extract_documented_functionsr   zsThe following pyplot functions are not listed in the documentation. Please add them to doc/api/pyplot_summary.rst: z•The following functions are listed in the pyplot documentation, but they do not exist in pyplot. Please remove them from doc/api/pyplot_summary.rst: N)r   r   Úparentr   r   r   r   r   rw   r   Ú_get_pyplot_commandsÚ
differenceÚAssertionError)Úpyplot_docsr©   r‚   Údoc_functionsÚplot_commandsÚmissingÚextrar&   r&   r'   Útest_doc_pyplot_summaryl  s,   
!
þÿ
þÿÿr³   c                  C   sÆ   t  ¡  t  t dd¡¡ t jdd\} }t |tjg tjdk¡s$J ‚|g ks*J ‚t j	ddgdd	gdd
 t  
¡ }|jdd} |jdd}t | t ddg¡k¡sTJ ‚dd„ |D ƒdd	gksaJ ‚d S )Nr@   é
   T)Úminor)Údtypeg      @g      @ÚaÚb)ÚticksÚlabelsrµ   c                 S   s   g | ]}|  ¡ ‘qS r&   )Úget_text)Ú.0Úlr&   r&   r'   Ú
<listcomp>°  s    z$test_minor_ticks.<locals>.<listcomp>)r   r`   Úplotr‹   ÚarangeÚxticksÚallÚarrayÚfloat64ÚyticksrV   Ú
get_yticksÚget_yticklabels)Útick_posÚtick_labelsr>   r&   r&   r'   Útest_minor_ticks¤  s   rÊ   c                  C   sn   t  d¡ t  ¡ } t  ¡ } tt  ¡ ƒdksJ ‚t  d¡ tt  ¡ ƒdks&J ‚t  d¡ tt  ¡ ƒdks5J ‚d S )NÚaggr   Úsvg)r   Úswitch_backendr`   ry   Úget_fignums)r=   r&   r&   r'   Útest_switch_backend_no_close³  s   


rÏ   c                 C   s
   d| _ d S )NT)Ú_test_was_here)r`   r&   r&   r'   Úfigure_hook_example¾  s   
rÑ   c                  C   sJ   ddgi} t  | ¡ t ¡ }W d   ƒ n1 sw   Y  |js#J ‚d S )Nzfigure.hooksz0matplotlib.tests.test_pyplot:figure_hook_example)r   Ú
rc_contextr   r`   rÐ   )Útest_rcr=   r&   r&   r'   Útest_figure_hookÂ  s   ÿ
ÿrÔ   c                  C   sÀ   t jddd} tjtdd t jdt ddg¡d}W d   ƒ n1 s%w   Y  tjtdd t j| t dd	g¡d W d   ƒ n1 sHw   Y  | |u sSJ ‚t  d¡}| |u s^J ‚d S )
Nr@   )r@   r   )Úfigsizez)Ignoring specified arguments in this callrn   rA   é   é   é   )r   r`   r   r6   ÚUserWarningr‹   rÃ   )r=   Úfig2Úfig3r&   r&   r'   Útest_multiple_same_figure_callsÍ  s   ÿÿ
rÜ   c                  C   sF   t  ¡ } tjtdd t  d¡}W d   ƒ d S 1 sw   Y  d S )Nzcloses all existing figuresrn   rÂ   )r   r`   r   r6   rÙ   )r”   rÚ   r&   r&   r'   Útest_close_all_warningØ  s   "ÿrÝ   c                  C   s,   t  ¡ } ddgddgg}t j|| jd d S )Nr   r@   r   )Úfignum)r   r`   ÚmatshowÚnumber)r=   Úarrr&   r&   r'   Útest_matshowà  s   râ   )+r   Únumpyr‹   r   Úpathlibr   r   Ú
matplotlibr   Úmatplotlib.testingr   r   r   r(   r9   r?   rC   rI   rM   rO   rP   rS   r[   rd   rf   rj   rk   rm   rr   r}   r†   r’   r—   rš   r¡   r³   rÊ   rÏ   rÑ   rÔ   rÜ   rÝ   râ   r&   r&   r&   r'   Ú<module>   sL    ,



8