a
    
d                     @   s   d dl Zd dlZd dlmZ d dlmZ edZdd Z	e
d dgdd	ggejZeejd
 ZeejZed Zed Zed Zg 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S )    N)io)expected_warningszmatplotlib.pyplotc                   C   s   t   d S )N)r   Zreset_plugins r   r   i/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/skimage/io/tests/test_mpl_imshow.pysetup
   s    r   @               i  
   )z'tight_layout : falling back to Agg|\A\Zz&tight_layout: falling back to Agg|\A\Zznp.asscalar|\A\Zz+The figure layout has changed to tight|\A\Zc                 C   s   t |   S )a  Return the number of subplots in the figure containing an ``AxesImage``.

    Parameters
    ----------
    ax_im : matplotlib.pyplot.AxesImage object
        The input ``AxesImage``.

    Returns
    -------
    n : int
        The number of subplots in the corresponding figure.

    Notes
    -----
    This function is intended to check whether a colorbar was drawn, in
    which case two subplots are expected. For standard imshows, one
    subplot is expected.
    )lenZ
get_figureZget_axesax_imr   r   r   
n_subplots!   s    r   c                  C   s   t   ttdg  tt} W d    n1 s60    Y  | jjdksPJ | 	 dks`J t
| dkspJ | jd u s~J d S )NCObject type is marked|\A\Zgray)r   r      )pltfigurer   imshow_expected_warningsr   imshowim8cmapnameget_climr   colorbarr   r   r   r   
test_uint87   s    (r   c                  C   s   t   ttdg  tt} W d    n1 s60    Y  | jjdksPJ | 	 dks`J t
| dkspJ | jd u s~J d S )Nr   r   )r   i  r   )r   r   r   r   r   r   im16r   r   r   r   r   r   r   r   r   test_uint16B   s    (r   c                  C   s   t   ttdg  tt} W d    n1 s60    Y  | jjdksPJ | 	 dks`J t
| dkspJ | jd u s~J d S )Nr   r   )r   r   r   )r   r   r   r   r   r   imfr   r   r   r   r   r   r   r   r   
test_floatM   s    (r!   c                  C   sf   t tdg  tt} W d    n1 s.0    Y  |  t t fksTJ | jd usbJ d S )N+Low image data range|CObject type is marked)	r   r   r   r   im_lor   minmaxr   r   r   r   r   test_low_data_rangeX   s    (r&   c                  C   s~   t   ttdg  tt} W d    n1 s60    Y  |  t t	 fks\J t
| dkslJ | jd uszJ d S )Nz,out of standard range|CObject type is marked   )r   r   r   r   r   r   im_hir   r$   r%   r   r   r   r   r   r   test_outside_standard_rangea   s    (r)   c                  C   s~   t   ttdg  tt} W d    n1 s60    Y  |  t t	 fks\J t
| dkslJ | jd uszJ d S )Nr"   r'   )r   r   r   r   r   r   im64r   r$   r%   r   r   r   r   r   r   test_nonstandard_typeo   s    (r+   c                  C   s   t   tddgddgg} ttdg  t| }W d    n1 sL0    Y  | dksfJ t	|dksvJ |j
d usJ d S )N      gɿg?g?r   )r,   g      ?r'   )r   r   nparrayr   r   r   r   r   r   r   )Z	im_signedr   r   r   r   test_signed_image}   s    (r/   )numpyr-   ZpytestZskimager   Zskimage._shared._warningsr   Zimportorskipr   r   r.   Zuint8r   ZastypeZuint16r   Zuint64r*   r    r#   r(   r   r   r   r   r!   r&   r)   r+   r/   r   r   r   r   <module>   s(   
	