Ë
    ¤eh°   ã                  óL  — d dl mZ d dlmZmZ d dlZd dlmZmZ d dl	Z	d dl
Zd dlZ
d dlZd dlmZ d dlmZ d dlmZ d dlmc mZ erd dlmZ 	 	 	 d	 	 	 	 	 	 	 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(y)$é    )Úannotations)Ú
CollectionÚIteratorN)ÚTYPE_CHECKINGÚcast)ÚMatplotlibColor)Úfind_stack_level)Úis_list_like)ÚColormapc                óp   — t        |t        «      r|S t        |||| ¬«      }t        t	        || ¬«      «      S )a§  
    Get standard colors based on `colormap`, `color_type` or `color` inputs.

    Parameters
    ----------
    num_colors : int
        Minimum number of colors to be returned.
        Ignored if `color` is a dictionary.
    colormap : :py:class:`matplotlib.colors.Colormap`, optional
        Matplotlib colormap.
        When provided, the resulting colors will be derived from the colormap.
    color_type : {"default", "random"}, optional
        Type of colors to derive. Used if provided `color` and `colormap` are None.
        Ignored if either `color` or `colormap` are not None.
    color : dict or str or sequence, optional
        Color(s) to be used for deriving sequence of colors.
        Can be either be a dictionary, or a single color (single color string,
        or sequence of floats representing a single color),
        or a sequence of colors.

    Returns
    -------
    dict or list
        Standard colors. Can either be a mapping if `color` was a dictionary,
        or a list of colors with a length of `num_colors` or more.

    Warns
    -----
    UserWarning
        If both `colormap` and `color` are provided.
        Parameter `color` will override.
    ©ÚcolorÚcolormapÚ
color_typeÚ
num_colors©r   )Ú
isinstanceÚdictÚ_derive_colorsÚlistÚ_cycle_colors)r   r   r   r   Úcolorss        ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/plotting/_matplotlib/style.pyÚget_standard_colorsr      s>   € ôL �%œÔØˆäØØØØô	€Fô ”˜f°Ô<Ó=Ð=ó    c                óš   — | €|�t        ||¬«      S | �,|�t        j                  dt        «       ¬«       t	        | «      S t        ||¬«      S )aa  
    Derive colors from either `colormap`, `color_type` or `color` inputs.

    Get a list of colors either from `colormap`, or from `color`,
    or from `color_type` (if both `colormap` and `color` are None).

    Parameters
    ----------
    color : str or sequence, optional
        Color(s) to be used for deriving sequence of colors.
        Can be either be a single color (single color string, or sequence of floats
        representing a single color), or a sequence of colors.
    colormap : :py:class:`matplotlib.colors.Colormap`, optional
        Matplotlib colormap.
        When provided, the resulting colors will be derived from the colormap.
    color_type : {"default", "random"}, optional
        Type of colors to derive. Used if provided `color` and `colormap` are None.
        Ignored if either `color` or `colormap`` are not None.
    num_colors : int
        Number of colors to be extracted.

    Returns
    -------
    list
        List of colors extracted.

    Warns
    -----
    UserWarning
        If both `colormap` and `color` are provided.
        Parameter `color` will override.
    r   zC'color' and 'colormap' cannot be used simultaneously. Using 'color')Ú
stacklevel)Ú_get_colors_from_colormapÚwarningsÚwarnr	   Ú_get_colors_from_colorÚ_get_colors_from_color_typer   s       r   r   r   P   sW   € ðN €}˜Ð-Ü(¨¸jÔIÐIØ	Ð	ØÐÜ�M‰MØUÜ+Ó-õô & eÓ,Ð,ä*¨:À*ÔMÐMr   c              #  óœ   K  — t        |t        | «      «      }t        j                  t        j                  | «      |«      E d{  –—†  y7 Œ­w)zÈCycle colors until achieving max of `num_colors` or length of `colors`.

    Extra colors will be ignored by matplotlib if there are more colors
    than needed and nothing needs to be done here.
    N)ÚmaxÚlenÚ	itertoolsÚisliceÚcycle)r   r   Ú
max_colorss      r   r   r   „   s7   è ø€ ô �Z¤ V£Ó-€JÜ×Ñ¤	§¡°Ó 7¸ÓD×DÒDús   ‚AAÁA
ÁAc                óz   — t        | «      }t        j                  dd|¬«      D �cg c]
  } ||«      ‘Œ c}S c c}w )zGet colors from colormap.r   é   )Únum)Ú_get_cmap_instanceÚnpÚlinspace)r   r   Úcmapr,   s       r   r   r   Ž   s3   € ô
 ˜hÓ'€DÜ!#§¡¨Q°°zÔ!BÖC˜#‰D��IÒCÐCùÒCs   ¦8c                ór   — t        | t        «      r&| }t        j                  |    } | €t	        d|› d�«      ‚| S )z$Get instance of matplotlib colormap.z	Colormap z is not recognized)r   ÚstrÚmplÚ	colormapsÚ
ValueError)r   r0   s     r   r-   r-   —   s?   € ä�(œCÔ ØˆÜ—=‘= Ñ*ˆØÐÜ˜y¨¨Ð.@ÐAÓBÐBØ€Or   c                óÌ   — t        | «      dk(  rt        d| › �«      ‚t        | «      rt        t        | «      } | gS t        t
        t           | «      } t        t        | «      «      S )z!Get colors from user input color.r   zInvalid color argument: )r%   r5   Ú_is_single_colorr   ÚColorr   r   Ú!_gen_list_of_colors_from_iterable©r   s    r   r!   r!   ¡   s_   € ô ˆ5ƒz�Q‚ÜÐ3°E°7Ð;Ó<Ð<ä˜ÔÜ”U˜EÓ"ˆØˆwˆä”œEÑ" EÓ*€EÜÔ1°%Ó8Ó9Ð9r   c                óT   — t        | t        «      rt        | «      ryt        | «      ryy)a0  Check if `color` is a single color, not a sequence of colors.

    Single color is of these kinds:
        - Named color "red", "C0", "firebrick"
        - Alias "g"
        - Sequence of floats, such as (0.1, 0.2, 0.3) or (0.1, 0.2, 0.3, 0.4).

    See Also
    --------
    _is_single_string_color
    TF)r   r2   Ú_is_single_string_colorÚ_is_floats_colorr:   s    r   r7   r7   °   s'   € ô �%œÔÔ"9¸%Ô"@àä˜ÔØàr   c              #  óT   K  — | D ]  }t        |«      r|–— Œt        d|› �«      ‚ y­w)zS
    Yield colors from string of several letters or from collection of colors.
    zInvalid color N)r7   r5   )r   Úxs     r   r9   r9   Æ   s6   è ø€ ð ò 3ˆÜ˜AÔØ‹Gä˜~¨a¨SÐ1Ó2Ð2ñ	3ùs   ‚&(c                ó’   — t        t        | «      xr2 t        | «      dk(  xs t        | «      dk(  xr t        d„ | D «       «      «      S )zACheck if color comprises a sequence of floats representing color.é   é   c              3  óH   K  — | ]  }t        |t        t        f«      –— Œ y ­w)N)r   ÚintÚfloat)Ú.0r?   s     r   ú	<genexpr>z#_is_floats_color.<locals>.<genexpr>Ö   s   è ø€ Ò;°”
˜1œs¤E˜l×+Ñ;ùs   ‚ ")Úboolr
   r%   Úallr:   s    r   r=   r=   Ñ   sG   € äÜ�UÓò 	<Ü�‹Z˜1‰_Ò/¤ E£
¨a¡ò	<äÑ;°UÔ;Ó;óð r   c                óX   — | dk(  rt        |«      S | dk(  rt        |«      S t        d«      ‚)z&Get colors from user input color type.ÚdefaultÚrandomz/color_type must be either 'default' or 'random')Ú_get_default_colorsÚ_get_random_colorsr5   )r   r   s     r   r"   r"   Ú   s4   € à�YÒÜ" :Ó.Ð.Ø	�xÒ	Ü! *Ó-Ð-äÐJÓKÐKr   c                ó`   — ddl m} |j                  d   D �cg c]  }|d   ‘Œ	 }}|d|  S c c}w )z=Get `num_colors` of default colors from matplotlib rc params.r   Nzaxes.prop_cycler   )Úmatplotlib.pyplotÚpyplotÚrcParams)r   ÚpltÚcr   s       r   rM   rM   ä   s9   € å#à"%§,¡,Ð/@Ñ"AÖB˜Qˆa�‹jÐB€FÐBØ�!�JÐÐùò Cs   ˜+c                óP   — t        | «      D �cg c]  }t        |«      ‘Œ c}S c c}w )z"Get `num_colors` of random colors.)ÚrangeÚ_random_color)r   r,   s     r   rN   rN   ì   s    € ä*/°
Ó*;Ö< 3ŒM˜#ÕÒ<Ð<ùÒ<s   Ž#c                ój   — t        j                  | «      }|j                  d«      j                  «       S )z4Get a random color represented as a list of length 3rA   )ÚcomÚrandom_stateÚrandÚtolist)ÚcolumnÚrss     r   rW   rW   ñ   s+   € ô 
×	Ñ	˜&Ó	!€BØ�7‰7�1‹:×ÑÓÐr   c                ó‚   — t         j                  j                  «       }	 |j                  | «       y# t        $ r Y yw xY w)aƒ  Check if `color` is a single string color.

    Examples of single string colors:
        - 'r'
        - 'g'
        - 'red'
        - 'green'
        - 'C3'
        - 'firebrick'

    Parameters
    ----------
    color : Color
        Color string or sequence of floats.

    Returns
    -------
    bool
        True if `color` looks like a valid color.
        False otherwise.
    TF)Ú
matplotlibr   ÚColorConverterÚto_rgbar5   )r   Úconvs     r   r<   r<   ø   sD   € ô, ×Ñ×+Ñ+Ó-€Dðð 	�‰�UÔð øô ò Ùðús    2 ²	>½>)NrK   N)r   rD   r   zColormap | Noner   r2   r   z3dict[str, Color] | Color | Collection[Color] | None)
r   z Color | Collection[Color] | Noner   zstr | Colormap | Noner   r2   r   rD   Úreturnúlist[Color])r   re   r   rD   rd   úIterator[Color])r   ústr | Colormapr   rD   rd   re   )r   rg   rd   r   )r   úColor | Collection[Color]rd   re   )r   rh   rd   rH   )r   zCollection[Color]rd   rf   )r   r2   r   rD   rd   re   )r   rD   rd   re   )r]   rD   rd   zlist[float])r   r8   rd   rH   ))Ú
__future__r   Úcollections.abcr   r   r&   Útypingr   r   r   r`   r3   Úmatplotlib.colorsÚnumpyr.   Úpandas._typingr   r8   Úpandas.util._exceptionsr	   Úpandas.core.dtypes.commonr
   Úpandas.core.commonÚcoreÚcommonrY   r   r   r   r   r   r-   r!   r7   r9   r=   r"   rM   rN   rW   r<   © r   r   ú<module>ru      s  ðÝ "÷ó ÷ó ã Û Û å 3Ý 4å 2ç  Ð  áÝ*ð
 !%ØØAEð	0>Øð0>àð0>ð ð0>ð ?ó	0>ðf1Nà+ð1Nð $ð1Nð ð	1Nð
 ð1Nð ó1NóhEðDØðDàðDð óDóð:Ø$ð:àó:óó,3óóLó ó=ó
ôr   