a
    ü
þdê2  ã                   @   s0  d dl Z 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S );é    N)ÚPath)Úpyplot)ÚMatplotlibDeprecationWarningc              
   C   s´   t tjƒjd d }| ¡ s&t d¡ t tjƒ ¡ }|  	d¡}| 
|d¡ tjtjt|ƒt|ƒgdd | d¡}||kr°d 	tj| d¡| d¡d	d
ddd¡}t d| ¡ d S )Né   ztools/boilerplate.pyzboilerplate.py not foundz	pyplot.pyzutf-8T)ÚcheckÚ
zfound pyplot.pyzexpected pyplot.pyr   Ú )ÚfromfileÚtofileÚnZ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)r   ÚmplÚ__file__ÚparentsÚexistsÚpytestÚskipÚpltÚ	read_textÚjoinÚ
write_textÚ
subprocessÚrunÚsysÚ
executableÚstrÚdifflibZunified_diffÚsplitZfail)ÚtmpdirZ
gen_scriptZorig_contentsZplt_fileZnew_contentsZdiff_msg© r   úe/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/matplotlib/tests/test_pyplot.pyÚtest_pyplot_up_to_date   s0    

ÿ
üÿüÿr    c                 C   sÚ   t j ddd¡t j dd¡ddd„ƒƒ}t |¡ddd„ƒ}|d ƒ |d d	 |d d d
 |d d d | rnJ ‚t t¡ |d d W d   ƒ n1 s˜0    Y  t t¡ |d d ƒ W d   ƒ n1 sÌ0    Y  d S )Nz	(version)ÚoldÚnewÚkwoc                 S   s   d S ©Nr   ©r"   r#   r   r   r   Úfunc,   s    z1test_copy_docstring_and_deprecators.<locals>.funcc                 S   s   d S r$   r   r%   r   r   r   Úwrapper_func1   s    z9test_copy_docstring_and_deprecators.<locals>.wrapper_func)r"   )r#   r%   )r!   )N)N)	r   Z_apiZrename_parameterZmake_keyword_onlyr   Z_copy_docstring_and_deprecatorsr   Úwarnsr   )Zrecwarnr&   r'   r   r   r   Ú#test_copy_docstring_and_deprecators+   s    
(r)   c                  C   sd   t  ¡ \} }t  d¡ | ¡ r"J ‚t  d¡ | ¡ s8J ‚t  ¡  | ¡ rLJ ‚t  ¡  | ¡ s`J ‚d S )NFT)r   ÚsubplotsZboxZget_frame_on)ÚfigÚaxr   r   r   Útest_pyplot_box@   s    

r-   c                   C   s   t  g d¢g d¢¡ d S )N)é   r   é   )r   Z	stackplotr   r   r   r   Útest_stackplot_smokeL   s    r0   c                   C   sp   t  t¡ tjdd W d   ƒ n1 s,0    Y  t  t¡ tjdd W d   ƒ n1 sb0    Y  d S )Nr.   )Znrows)Zncols)r   ÚraisesÚ	TypeErrorr   Úsubplotr   r   r   r   Útest_nrows_errorQ   s    *r4   c                   C   s¬   t  ¡  t ¡ sJ ‚t  ¡  t ¡ r*J ‚W d   ƒ n1 s>0    Y  t ¡ sTJ ‚t  ¡  t ¡ rhJ ‚t  ¡  t ¡ r~J ‚W d   ƒ n1 s’0    Y  t ¡ r¨J ‚d S r$   )r   Úionr   Úis_interactiveÚioffr   r   r   r   Ú	test_ioffX   s    
*
*r8   c                   C   s¬   t  ¡  t ¡ rJ ‚t  ¡  t ¡ s*J ‚W d   ƒ n1 s>0    Y  t ¡ rTJ ‚t  ¡  t ¡ shJ ‚t  ¡  t ¡ s~J ‚W d   ƒ n1 s’0    Y  t ¡ s¨J ‚d S r$   )r   r7   r   r6   r5   r   r   r   r   Útest_ionf   s    
*
*r9   c                	   C   sx  t  ¡  t  ¡ \ t ¡ rJ ‚t  ¡  t ¡ s4J ‚W d   ƒ n1 sH0    Y  t ¡ r^J ‚W d   ƒ n1 sr0    Y  t ¡ sˆJ ‚t  ¡ D t  ¡  t ¡ r¨J ‚W d   ƒ n1 s¼0    Y  W d   ƒ n1 sÚ0    Y  t ¡ sðJ ‚t  ¡  t  ¡  W d   ƒ n1 s0    Y  t ¡ s0J ‚t  ¡  t  ¡ d t ¡ sPJ ‚t  ¡  t ¡ rhJ ‚W d   ƒ n1 s~0    Y  t ¡ s–J ‚W d   ƒ n1 s¬0    Y  t ¡ rÄJ ‚t  ¡ H t  ¡  t ¡ sæJ ‚W d   ƒ n1 sü0    Y  W d   ƒ n1 s0    Y  t ¡ r4J ‚t  ¡  t  ¡  W d   ƒ n1 s\0    Y  t ¡ rtJ ‚d S r$   )r   r5   r7   r   r6   r   r   r   r   Útest_nested_ion_iofft   s8    

**

H
(

..

N
(r:   c               
   C   sH   zt  d¡ W n4 tyB }  zt| ƒdks.J ‚W Y d } ~ n
d } ~ 0 0 d S )Ngš™™™™™ñ?zQclose() argument must be a Figure, an int, a string, or None, not <class 'float'>)r   Úcloser2   r   )Úer   r   r   Ú
test_close    s    r=   c                  C   s^   t  d¡} | t  ¡ u sJ ‚t  d¡}|t  ¡ u s4J ‚t  d¡}| t  ¡ u sNJ ‚| |u sZJ ‚d S )Néy   éz   )r   r3   Úgca©Úax1Úax2Úax3r   r   r   Útest_subplot_reuse¨   s    


rE   c                  C   sÆ   t  ¡  t  ¡ } t  ¡ }| d us$J ‚|| us0J ‚t  ¡  t  ¡  t jdd} t jdd}| d usdJ ‚|| uspJ ‚t  ¡  t  ¡  t jdd} t  ¡ }| d us J ‚|jdks®J ‚|| usºJ ‚t  ¡  d S )NÚpolar©Ú
projectionÚrectilinear)r   ÚfigureÚaxesr;   Úname©r,   rB   r   r   r   Útest_axes_kwargs²   s&    rN   c                  C   s  t  ¡ } t  ddd¡}t  ddd¡}t  ddd¡}t t¡" t jddddd}W d   ƒ n1 sd0    Y  t jddddd}|d usŒJ ‚||u s˜J ‚||us¤J ‚||us°J ‚||u s¼J ‚|| jvsÊJ ‚|| jv sØJ ‚|| jv sæJ ‚|jdksôJ ‚|jdksJ ‚|jdksJ ‚d S )Nr.   r   rF   rG   rI   )r   rJ   r3   r   r(   r   rK   rL   )r+   r,   rB   rC   rD   Zax4r   r   r   Útest_subplot_replace_projectionË   s$    0rO   c                  C   s`   t jddd} t jddd}| |u s(J ‚|  ¡  t jddd}| |usJJ ‚| t  ¡ jvs\J ‚d S )NrF   r   )rH   Ztheta_offsetr.   )r   r3   ÚremoveÚgcfrK   rA   r   r   r   Útest_subplot_kwarg_collisionä   s    rR   c                  C   s<   t  ¡  t  ¡ } t  ¡ }| d us$J ‚|| u s0J ‚t  ¡  d S r$   )r   rJ   r@   r;   rM   r   r   r   Útest_gcaî   s    rS   c                  C   s¾   t  d¡} | t  ¡ u sJ ‚| t  d¡u s,J ‚|  ¡  t jddd}|t  ¡ u sRJ ‚| t  ¡ jvsdJ ‚|t  d¡u svJ ‚| ¡  t jddd}|t  ¡ u sœJ ‚||us¨J ‚|t  ¡ jvsºJ ‚d S )Néo   rF   rG   rI   )r   r3   r@   rP   rQ   rK   rA   r   r   r   Útest_subplot_projection_reuseø   s    
rU   c                  C   s†   t jddd} t jddd}t jdddd}| |u s8J ‚| |u sDJ ‚tjtdd  t jddd	d}W d   ƒ n1 sx0    Y  d S )
NrT   rF   rG   T)rF   )rF   rH   zpolar=True, yet projection='3d')ÚmatchÚ3d)r   r3   r   r1   Ú
ValueErrorrA   r   r   r   Ú test_subplot_polar_normalization  s    ÿrY   c                  C   s~   t ƒ } t ¡ }|  |¡ d}|D ]@}| ¡  tj|d}|t ¡ u sHJ ‚|j|ksVJ ‚|  |¡ q t| ƒdt|ƒ kszJ ‚d S )N)ZaitoffZhammerZlambertZ	mollweiderF   rI   rW   rG   r.   )Úsetr   r3   ÚaddrP   rL   Úlen)Zcreated_axesr,   ZprojectionsZ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ƒsDJ ‚| j|ju sTJ ‚d S )Ng        g      ð?Úrog…ëQ¸ù?ç      à?Zbo)r   rF   Ú
isinstancer   ÚlinesZLine2DrK   )Zln1Zln2r   r   r   Útest_polar_second_call-  s
    rb   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)çš™™™™™É?rc   r_   r_   )Úposition)çš™™™™™¹?re   çš™™™™™é?rf   )r   rK   ÚnpÚtestingZassert_allcloseZbboxZ
get_points)ZaxrefZaxtestr   r   r   Útest_fallback_position7  s    ÿÿri   c                  C   sX   t  ¡ } |  d¡}t  ¡  t  ¡ | ks*J ‚t  |d ¡}t  ¡ | ksHJ ‚|| ksTJ ‚d S )Nr   r.   )r   rJ   Ú
subfiguresrQ   )Zfig1ÚsubfigsÚcurrentr   r   r   Ú%test_set_current_figure_via_subfigureE  s    
rm   c                  C   sd   t  ¡ } |  d¡}|d jddd}|d jddd t  ¡ |ksFJ ‚t  |¡ t  ¡ |ks`J ‚d S )Nr   r   r.   T)Zsqueeze)r   rJ   rj   r*   r@   Zsca)r+   rk   r,   r   r   r   Ú"test_set_current_axes_on_subfigureQ  s    

rn   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   Zimportorskipr   rh   Zsubprocess_run_helperZstart_ipythonr   )ro   r   r   r   Útest_pylab_integration]  s    
ørs   c                  C   sŠ   t tƒjd } |  ¡ s t d¡ dd„ }|  ¡  d¡}t||ƒƒ}tt	 
¡ ƒ}| |¡}|rjtd|›ƒ‚| |¡}|r†t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 ]H}|s$|  d¡rTd}q|r|  d¡r4q|d  ¡ sFd}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)ra   Z	functionsZin_autosummaryÚliner   r   r   Úextract_documented_functionsq  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   rZ   r   Z_get_pyplot_commandsÚ
differenceÚAssertionError)Zpyplot_docsry   ra   Zdoc_functionsZplot_commandsÚmissingÚextrar   r   r   Útest_doc_pyplot_summaryk  s*    
!
þÿ
þÿr   c                  C   sÆ   t  ¡  t  t dd¡¡ t jdd\} }t |tjg tjdk¡sHJ ‚|g ksTJ ‚t j	ddgdd	gdd
 t  
¡ }|jdd} |jdd}t | t ddg¡k¡s¨J ‚dd„ |D ƒdd	gksÂJ ‚d S )Nr.   é
   T)Úminor)Zdtypeg      @g      @ÚaÚb)ZticksÚlabelsr   c                 S   s   g | ]}|  ¡ ‘qS r   )Zget_text)Ú.0Úlr   r   r   Ú
<listcomp>¯  ó    z$test_minor_ticks.<locals>.<listcomp>)r   rJ   Zplotrg   ZarangeZxticksÚallÚarrayÚfloat64Zyticksr@   Z
get_yticksZget_yticklabels)Ztick_posZ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sLJ ‚t  d¡ tt  ¡ ƒdksjJ ‚d S )NZaggr   Úsvgr   )r   Zswitch_backendrJ   r\   Zget_fignums)r+   r   r   r   Útest_switch_backend_no_close²  s    


rŽ   c                 C   s
   d| _ d S )NT)Ú_test_was_here)rJ   r   r   r   Úfigure_hook_example½  s    r   c                  C   sJ   ddgi} t  | ¡ t ¡ }W d   ƒ n1 s20    Y  |jsFJ ‚d S )Nzfigure.hooksz0matplotlib.tests.test_pyplot:figure_hook_example)r   Z
rc_contextr   rJ   r   )Ztest_rcr+   r   r   r   Útest_figure_hookÁ  s
    ÿ&r‘   ))r   Únumpyrg   r   r   Úpathlibr   r   Z
matplotlibr   r   r   Zmatplotlib._apir   r    r)   r-   r0   r4   r8   r9   r:   r=   rE   rN   rO   rR   rS   rU   rY   r]   rb   ri   rm   rn   rs   r   rŒ   rŽ   r   r‘   r   r   r   r   Ú<module>   sF   ,



8