Ë
    ¤eh‡6  ã                  ó"  — d dl mZ d dlZd dlmZmZ d dlmZmZm	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 d dlZd d
lmZmZ d dlmZmZ d dlmZ er.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& d dl'm(Z(m)Z) d dl*m+Z+m,Z,  G d„ de«      Z-y)é    )ÚannotationsN)ÚTYPE_CHECKINGÚAny)Ú
export_pngÚ
export_svgÚshow)Úget_screenshot_as_png)Úgridplot)ÚLabel)Ú
Category10)Úfigure)Úas_fill_typeÚas_line_type)Úfilled_to_bokehÚlines_to_bokeh)ÚRenderer)ÚOutputBackendType)ÚGridPlot)ÚPalette)Ú	ArrayLike)Ú	WebDriver)ÚFillTypeÚLineType)Ú
FillReturnÚ
LineReturnc                  óŒ  — e Zd ZU dZded<   ded<   ded<   ded	<   	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd
„Zdd„Zdd„Z	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z		 	 	 	 d 	 	 	 	 	 	 	 	 	 	 	 	 	 d!d„Z
	 	 d"	 	 	 	 	 	 	 	 	 	 	 d#d„Z	 d$ddœ	 	 	 	 	 	 	 d%d„Zddœd&d„Zd'd„Zd(d)d„Z	 	 	 	 d*	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+d„Zy),ÚBokehRenderera  Utility renderer using Bokeh to render a grid of plots over the same (x, y) range.

    Args:
        nrows (int, optional): Number of rows of plots, default ``1``.
        ncols (int, optional): Number of columns of plots, default ``1``.
        figsize (tuple(float, float), optional): Figure size in inches (assuming 100 dpi), default
            ``(9, 9)``.
        show_frame (bool, optional): Whether to show frame and axes ticks, default ``True``.
        want_svg (bool, optional): Whether output is required in SVG format or not, default
            ``False``.

    Warning:
        :class:`~.BokehRenderer`, unlike :class:`~.MplRenderer`, needs to be told in advance if
        output to SVG format will be required later, otherwise it will assume PNG output.
    zlist[figure]Ú_figuresr   Ú_layoutr   Ú_paletteÚboolÚ	_want_svgc                óà  — || _         t        d   | _        dt        j                  |t
        ¬«      z  }||z  }g | _        | j                   rdnd}t        |«      D ]f  }	t        |¬«      }
d|
j                  _
        d|
j                  _
        | j                  j                  |
«       |rŒOd |
_        d|
j                  _
        Œh t        | j                  |d |d   |z  |d	   |z  ¬
«      | _        y )Né
   éd   )ÚdtypeÚsvgÚcanvas)Úoutput_backendFr   é   )ÚncolsÚtoolbar_locationÚwidthÚheight)r"   r   r    ÚnpÚasarrayÚintr   Úranger   ÚxgridÚvisibleÚygridÚappendÚoutline_line_colorÚaxisr
   r   )ÚselfÚnrowsr+   ÚfigsizeÚ
show_frameÚwant_svgÚ
total_sizeÚnfiguresÚbackendÚ_Úfigs              ú[/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/contourpy/util/bokeh_renderer.pyÚ__init__zBokehRenderer.__init__2   s×   € ð "ˆŒÜ" 2™ˆŒàœŸ™ G´3Ô7Ñ7ˆ
à˜‘;ˆØˆŒØ.2¯nªn¡UÀ(ˆÜ�x“ò 	)ˆAÜ¨Ô0ˆCØ %ˆC�I‰IÔØ %ˆC�I‰IÔØ�M‰M× Ñ  Ô%ÚØ)-�Ô&Ø#(�—‘Õ ð	)ô  Ø�M‰M ¸Ø˜Q‘- 5Ñ(°¸A±À%Ñ1GôIˆ�ó    c                óp   — t        |t        «      r%|d   dk(  rt        |dd  «      }| j                  |   }|S )Nr   ÚCr*   )Ú
isinstanceÚstrr1   r    )r9   ÚcolorÚindexs      rC   Ú_convert_colorzBokehRenderer._convert_colorO   s8   € Ü�eœSÔ! e¨A¡h°#¢oÜ˜˜a˜b˜	“NˆEØ—M‘M %Ñ(ˆEØˆrE   c                óD   — t        |t        «      r| j                  |   }|S )N)rH   r1   r   )r9   Úaxs     rC   Ú_get_figurezBokehRenderer._get_figureU   s   € Ü�bœ#ÔØ—‘˜rÑ"ˆBØˆ	rE   c                óÊ   — t        |«      }| j                  |«      }| j                  |«      }t        ||«      \  }}t	        |«      dkD  r|j                  |g|g||d¬«       yy)a  Plot filled contours on a single plot.

        Args:
            filled (sequence of arrays): Filled contour data as returned by
                :meth:`~.ContourGenerator.filled`.
            fill_type (FillType or str): Type of :meth:`~.ContourGenerator.filled` data as returned
                by :attr:`~.ContourGenerator.fill_type`, or a string equivalent.
            ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
            color (str, optional): Color to plot with. May be a string color or the letter ``"C"``
                followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
                ``Category10`` palette. Default ``"C0"``.
            alpha (float, optional): Opacity to plot with, default ``0.7``.
        r   )ÚxsÚysrJ   Ú
fill_alphaÚ
line_widthN)r   rO   rL   r   ÚlenÚmulti_polygons)	r9   ÚfilledÚ	fill_typerN   rJ   ÚalpharB   rQ   rR   s	            rC   rW   zBokehRenderer.filledZ   sl   € ô* ! Ó+ˆ	Ø×Ñ˜rÓ"ˆØ×#Ñ# EÓ*ˆÜ  ¨Ó3‰ˆˆBÜˆr‹7�QŠ;Ø×Ñ 2 $¨B¨4°uÈÐ[\ÐÕ]ð rE   Nc                óH  — | j                  |«      }| j                  ||«      \  }}t        |«      t        |j                  «      z   }	t        |«      t        |j                  «      z   }
||dœ} |j                  |	|
fi |¤Ž |dkD  �räd|dd…dd…f   |dd…dd…f   z   |dd…dd…f   z   |dd…dd…f   z   z  j                  «       }d|dd…dd…f   |dd…dd…f   z   |dd…dd…f   z   |dd…dd…f   z   z  j                  «       } |j                  t        t        j                  |dd…dd…f   j                  «       ||dd…dd…f   j                  «       fd¬«      «      t        t        j                  |dd…dd…f   j                  «       ||dd…dd…f   j                  «       fd¬«      «      fi |¤Ž  |j                  t        t        j                  |dd…dd…f   j                  «       ||dd…dd…f   j                  «       fd¬«      «      t        t        j                  |dd…dd…f   j                  «       ||dd…dd…f   j                  «       fd¬«      «      fi |¤Ž |�5|j                  |j                  «       |j                  «       |d|dd	¬
«       yy)a  Plot quad grid lines on a single plot.

        Args:
            x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
            y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
            ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
            color (str, optional): Color to plot grid lines, default ``"black"``.
            alpha (float, optional): Opacity to plot lines with, default ``0.1``.
            point_color (str, optional): Color to plot grid points or ``None`` if grid points
                should not be plotted, default ``None``.
            quad_as_tri_alpha (float, optional): Opacity to plot ``quad_as_tri`` grid, default
                ``0``.

        Colors may be a string color or the letter ``"C"`` followed by an integer in the range
        ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette.

        Warning:
            ``quad_as_tri_alpha > 0`` plots all quads as though they are unmasked.
        )Ú
line_colorrY   r   g      Ð?Néÿÿÿÿr*   )r8   Úcircleé   )ÚxÚyÚ
fill_colorr[   rY   ÚmarkerÚsize)	rO   Ú_grid_as_2dÚlistÚTÚ
multi_lineÚravelr/   ÚstackÚscatter)r9   r_   r`   rN   rJ   rY   Úpoint_colorÚquad_as_tri_alpharB   rQ   rR   ÚkwargsÚxmidÚymids                 rC   ÚgridzBokehRenderer.gridv   s¾  € ð: ×Ñ˜rÓ"ˆØ×Ñ  1Ó%‰ˆˆ1Ü�!‹W”t˜AŸC™C“yÑ ˆÜ�!‹W”t˜AŸC™C“yÑ ˆØ %°Ñ6ˆØˆ�‰�r˜2Ñ( Ò(Ø˜qÓ à˜!˜C˜R˜C  " ˜H™+¨¨!©"¨c¨r¨c¨'©
Ñ2°Q°s¸°s¸A¹B°w±ZÑ?À!ÀAÁBÈÉÀFÁ)ÑKÑL×SÑSÓUˆDØ˜!˜C˜R˜C  " ˜H™+¨¨!©"¨c¨r¨c¨'©
Ñ2°Q°s¸°s¸A¹B°w±ZÑ?À!ÀAÁBÈÉÀFÁ)ÑKÑL×SÑSÓUˆDØˆC�N‰NÜ”R—X‘X˜q  "  c r c ™{×0Ñ0Ó2°D¸!¸A¹BÀÁ¸F¹)¿/¹/Ó:KÐLÐSTÔUÓVÜ”R—X‘X˜q  "  c r c ™{×0Ñ0Ó2°D¸!¸A¹BÀÁ¸F¹)¿/¹/Ó:KÐLÐSTÔUÓVñð òð ˆC�N‰NÜ”R—X‘X˜q  "  a¡b ™z×/Ñ/Ó1°4¸¸1¹2¸sÀ¸s¸7¹×9IÑ9IÓ9KÐLÐSTÔUÓVÜ”R—X‘X˜q  "  a¡b ™z×/Ñ/Ó1°4¸¸1¹2¸sÀ¸s¸7¹×9IÑ9IÓ9KÐLÐSTÔUÓVñð òð Ð"Ø�K‰KØ—'‘'“)˜qŸw™w›y°UÀtÐSXØ að õ )ð #rE   c                ó¶   — t        |«      }| j                  |«      }| j                  |«      }t        ||«      \  }}	|�|	€J ‚|j	                  ||	|||¬«       yy)a¯  Plot contour lines on a single plot.

        Args:
            lines (sequence of arrays): Contour line data as returned by
                :meth:`~.ContourGenerator.lines`.
            line_type (LineType or str): Type of :meth:`~.ContourGenerator.lines` data as returned
                by :attr:`~.ContourGenerator.line_type`, or a string equivalent.
            ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
            color (str, optional): Color to plot lines. May be a string color or the letter ``"C"``
                followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
                ``Category10`` palette. Default ``"C0"``.
            alpha (float, optional): Opacity to plot lines with, default ``1.0``.
            linewidth (float, optional): Width of lines, default ``1``.

        Note:
            Assumes all lines are open line strips not closed line loops.
        N)r[   Ú
line_alpharT   )r   rO   rL   r   Úline)
r9   ÚlinesÚ	line_typerN   rJ   rY   Ú	linewidthrB   rQ   rR   s
             rC   rt   zBokehRenderer.linesª   sh   € ô4 ! Ó+ˆ	Ø×Ñ˜rÓ"ˆØ×#Ñ# EÓ*ˆÜ  yÓ1‰ˆˆBØˆ>Ø�>Ð!�>Ø�H‰H�R˜¨¸%ÈIˆHÕVð rE   c                ó"  — t         j                  j                  |«      }|t         j                  j                  u ry| j	                  |«      }| j                  |«      }| j                  ||«      \  }}|j                  ||   ||   |dd¬«       y)aÛ  Plot masked out grid points as circles on a single plot.

        Args:
            x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
            y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
            z (masked array of shape (ny, nx): z-values.
            ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
            color (str, optional): Circle color, default ``"black"``.
        Nr]   r$   )ra   rb   rc   )r/   ÚmaÚgetmaskÚnomaskrO   rL   rd   rj   )r9   r_   r`   ÚzrN   rJ   ÚmaskrB   s           rC   r|   zBokehRenderer.maskÌ   s}   € ô" �u‰u�}‰}˜QÓˆØ”2—5‘5—<‘<ÑØØ×Ñ˜rÓ"ˆØ×#Ñ# EÓ*ˆØ×Ñ  1Ó%‰ˆˆ1Ø�‰�A�d‘G˜Q˜t™W°¸xÈbˆÕQrE   )Ú	webdriverc               óÀ   — |r| j                   D ]  }d|_        d|_        Œ | j                  rt	        | j
                  ||¬«       yt        | j
                  ||¬«       y)aÝ  Save plots to SVG or PNG file.

        Args:
            filename (str): Filename to save to.
            transparent (bool, optional): Whether background should be transparent, default
                ``False``.
            webdriver (WebDriver, optional): Selenium WebDriver instance to use to create the image.

                .. versionadded:: 1.1.1

        Warning:
            To output to SVG file, ``want_svg=True`` must have been passed to the constructor.
        N)Úfilenamer}   )r   Úbackground_fill_colorÚborder_fill_colorr"   r   r   r   )r9   r   Útransparentr}   rB   s        rC   ÚsavezBokehRenderer.saveå   sS   € ñ( Ø—}‘}ò -�Ø,0�Ô)Ø(,�Õ%ð-ð �>Š>Ü�t—|‘|¨hÀ)ÖLä�t—|‘|¨hÀ)ÖLrE   c               ó€   — t        | j                  |¬«      }t        j                  «       }|j	                  |d«       |S )a  Save plots to an ``io.BytesIO`` buffer.

        Args:
            webdriver (WebDriver, optional): Selenium WebDriver instance to use to create the image.

                .. versionadded:: 1.1.1

        Return:
            BytesIO: PNG image buffer.
        )ÚdriverÚpng)r	   r   ÚioÚBytesIOrƒ   )r9   r}   ÚimageÚbuffers       rC   Úsave_to_bufferzBokehRenderer.save_to_buffer  s2   € ô & d§l¡l¸9ÔEˆÜ—‘“ˆØ�
‰
�6˜5Ô!ØˆrE   c                ó.   — t        | j                  «       y)z:Show plots in web browser, in usual Bokeh manner.
        N)r   r   )r9   s    rC   r   zBokehRenderer.show  s   € ô 	ˆT�\‰\ÕrE   c                óœ   — | j                  |«      }||_        d|j                  _        |�!| j                  |«      |j                  _        yy)aÌ  Set the title of a single plot.

        Args:
            title (str): Title text.
            ax (int or Bokeh Figure, optional): Which plot to set the title of, default ``0``.
            color (str, optional): Color to set title. May be a string color or the letter ``"C"``
                followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
                ``Category10`` palette. Default ``None`` which is ``black``.
        ÚcenterN)rO   ÚtitleÚalignrL   Ú
text_color)r9   r�   rN   rJ   rB   s        rC   r�   zBokehRenderer.title  sH   € ð ×Ñ˜rÓ"ˆØˆŒ	Ø"ˆ�	‰	ŒØÐØ#'×#6Ñ#6°uÓ#=ˆC�I‰IÕ ð rE   c                óÞ  — | j                  |«      }| j                  |«      }| j                  ||«      \  }}t        j                  |«      }|j
                  \  }	}
|dddœ}t        |	«      D ]F  }t        |
«      D ]6  }t        d	|||f   |||f   |||f   |› d�›dœ|¤Ž}|j                  |«       Œ8 ŒH |r¶t        |	dz
  «      D ]¤  }t        |
dz
  «      D ]‘  }t        j                  |||dz   …||dz   …f   «      }t        j                  |||dz   …||dz   …f   «      }t        j                  |||dz   …||dz   …f   «      }|j                  t        d	||||› d�›dœ|¤Ž«       Œ“ Œ¦ yy)
a­  Show ``z`` values on a single plot.

        Args:
            x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
            y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
            z (array-like of shape (ny, nx): z-values.
            ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
            color (str, optional): Color of added text. May be a string color or the letter ``"C"``
                followed by an integer in the range ``"C0"`` to ``"C9"`` to use a color from the
                ``Category10`` palette. Default ``"green"``.
            fmt (str, optional): Format to display z-values, default ``".1f"``.
            quad_as_tri (bool, optional): Whether to show z-values at the ``quad_as_tri`` centres
                of quads.

        Warning:
            ``quad_as_tri=True`` shows z-values for all quads, even if masked.
        rŽ   Úmiddle)r‘   Ú
text_alignÚtext_baselineÚ )r_   r`   Útextr*   é   N© )
rO   rL   rd   r/   r0   Úshaper2   r   Ú
add_layoutÚmean)r9   r_   r`   r{   rN   rJ   ÚfmtÚquad_as_trirB   ÚnyÚnxrm   ÚjÚiÚlabelÚxxÚyyÚzzs                     rC   Úz_valueszBokehRenderer.z_values(  s   € ð6 ×Ñ˜rÓ"ˆØ×#Ñ# EÓ*ˆØ×Ñ  1Ó%‰ˆˆ1Ü�J‰J�q‹MˆØ—‘‰ˆˆBØ %°XÐPXÑYˆÜ�r“ò 	&ˆAÜ˜2“Yò &�ÜÐV  ! Q $¡¨1¨Q°¨T©7¸A¸aÀ¸d¹GÀSÀEÈÀ6¸?ÑVÈvÑV�Ø—‘˜uÕ%ñ&ð	&ñ Ü˜2˜a™4“[ò T�Ü˜r !™t›ò T�AÜŸ™  1 Q q¡S 5¨!¨A¨a©C¨% <¡Ó1�BÜŸ™  1 Q q¡S 5¨!¨A¨a©C¨% <¡Ó1�BÜŸ™  1 Q q¡S 5¨!¨A¨a©C¨% <¡Ó1�BØ—N‘N¤5Ð#R¨2°¸RÀÀÀP¸v¸JÑ#RÈ6Ñ#RÕSñ	TñTð rE   )r*   r*   )é	   r¨   TF)r:   r1   r+   r1   r;   ztuple[float, float]r<   r!   r=   r!   ÚreturnÚNone)rJ   rI   r©   rI   )rN   úfigure | intr©   r   )r   ÚC0gffffffæ?)rW   r   rX   zFillType | strrN   r«   rJ   rI   rY   Úfloatr©   rª   )r   Úblackgš™™™™™¹?Nr   )r_   r   r`   r   rN   r«   rJ   rI   rY   r­   rk   ú
str | Nonerl   r­   r©   rª   )r   r¬   g      ð?r*   )rt   r   ru   zLineType | strrN   r«   rJ   rI   rY   r­   rv   r­   r©   rª   )r   r®   )r_   r   r`   r   r{   z'ArrayLike | np.ma.MaskedArray[Any, Any]rN   r«   rJ   rI   r©   rª   )F)r   rI   r‚   r!   r}   úWebDriver | Noner©   rª   )r}   r°   r©   z
io.BytesIO)r©   rª   )r   N)r�   rI   rN   r«   rJ   r¯   r©   rª   )r   Úgreenz.1fF)r_   r   r`   r   r{   r   rN   r«   rJ   rI   r�   rI   rž   r!   r©   rª   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rD   rL   rO   rW   rp   rt   r|   rƒ   r‹   r   r�   r§   r™   rE   rC   r   r      s¥  … ñð ÓØÓØÓØƒOð ØØ'-ØØðIàðIð ðIð %ð	Ið
 ðIð ðIð 
óIó:óð ØØð^àð^ð "ð^ð ð	^ð
 ð^ð ð^ð 
ó^ð@ ØØØ"&Ø#$ð2)àð2)ð ð2)ð ð	2)ð
 ð2)ð ð2)ð  ð2)ð !ð2)ð 
ó2)ðp ØØØð Wàð Wð "ð Wð ð	 Wð
 ð Wð ð Wð ð Wð 
ó WðN ØðRàðRð ðRð 3ð	Rð
 ðRð ðRð 
óRð8 "ðMð
 '+ñMàðMð ðMð
 $ðMð 
óMð< ?Cõ ó ô
>ð* ØØØ!ð+Tàð+Tð ð+Tð ð	+Tð
 ð+Tð ð+Tð ð+Tð ð+Tð 
ô+TrE   r   ).Ú
__future__r   r‡   Útypingr   r   Úbokeh.ior   r   r   Úbokeh.io.exportr	   Úbokeh.layoutsr
   Úbokeh.models.annotations.labelsr   Úbokeh.palettesr   Úbokeh.plottingr   Únumpyr/   Úcontourpy.enum_utilr   r   Úcontourpy.util.bokeh_utilr   r   Úcontourpy.util.rendererr   Úbokeh.core.enumsr   Úbokeh.modelsr   r   Únumpy.typingr   Ú#selenium.webdriver.remote.webdriverr   Ú	contourpyr   r   Úcontourpy._contourpyr   r   r   r™   rE   rC   ú<module>rÉ      sW   ðÝ "ã 	ß %ç 1Ñ 1Ý 1Ý "Ý 1Ý %Ý !Û ç :ß EÝ ,áÝ2Ý%Ý&Ý&Ý=ç,ß;ôvT�Hõ vTrE   