Ë
    ýÿæiM!  ã                  ó¼  — d dl mZ d dlmZmZmZ d dlZd dlmZ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 erd dlmZ e
	 	 d	 	 	 	 	 	 	 	 	 dd
„«       Ze
	 	 dd	dœ	 	 	 	 	 	 	 	 	 dd„«       Ze
	 	 dd	dœ	 	 	 	 	 	 	 	 	 dd„«       Z	 	 dd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#y)'é    )Úannotations)Ú
CollectionÚIteratorÚSequenceN)ÚTYPE_CHECKINGÚcastÚoverload)ÚMatplotlibColor)Úfind_stack_level)Úis_list_like)ÚColormap.c                ó   — y ©N© ©Ú
num_colorsÚcolormapÚ
color_typeÚcolors       úv/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/pandas/plotting/_matplotlib/style.pyÚget_standard_colorsr      s   € ð ó    ©r   c                ó   — y r   r   r   s       r   r   r   '   s   € ð r   c                ó   — y r   r   r   s       r   r   r   1   s   € ð &)r   c               ó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.
    ©r   r   r   r   ©r   )Ú
isinstanceÚdictÚ_derive_colorsÚlistÚ_cycle_colors)r   r   r   r   Úcolorss        r   r   r   ;   s>   € ôN �%œÔØˆäØØØØô	€Fô ”˜f°Ô<Ó=Ð=r   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!   o   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   Úcmapr5   s       r   r'   r'   ­   s9   € ô
 ˜hÓ'€DÜ!#§¡¨Q°°zÕ!BÓCÑ!B˜#‰D��IÐ!BÑ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   r9   s     r   r6   r6   ¶   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.   r>   Ú_is_single_colorr   ÚColorr   r"   Ú!_gen_list_of_colors_from_iterabler   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   r;   Ú_is_single_string_colorÚ_is_floats_colorr   s    r   r@   r@   Ï   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)r@   r>   )r   Úxs     r   rB   rB   å   s1   è ø€ ó ˆÜ˜AÔØ‹Gä˜~¨a¨SÐ1Ó2Ð2ñ	 ù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r   )r   ÚintÚfloat)Ú.0rG   s     r   Ú	<genexpr>z#_is_floats_color.<locals>.<genexpr>õ   s   è ø€ Ð;±U°”
˜1œs¤E˜l×+±Uùs   ‚ ")Úboolr   r.   Úallr   s    r   rE   rE   ð   sG   € äÜ�UÓò 	<Ü�‹Z˜1‰_Ò/¤ E£
¨a¡ò	<äÑ;±UÓ;Ó;óð r   c           	     óL  — | dk(  rMt         j                  d   }t        j                  |t	        |t        |«      «      «      D �cg c]  }|d   ‘Œ	 c}S | dk(  r>t        j                  j                  |«      j                  |df«      j                  «       S t        d«      ‚c c}w )z&Get colors from user input color type.Údefaultzaxes.prop_cycler   ÚrandomrI   z/color_type must be either 'default' or 'random')r<   ÚrcParamsr/   r0   Úminr.   r7   rT   Údefault_rngÚtolistr>   )r   r   Ú
prop_cycleÚcs       r   r+   r+   ù   sŸ   € à�YÒÜ—\‘\Ð"3Ñ4ˆ
ô ×%Ñ% j´#°jÄ#ÀjÃ/Ó2RÔSó
áS�ð ˆg‹JØSñ
ð 	
ð 
�xÒ	Ü�y‰y×$Ñ$ ZÓ0×7Ñ7¸ÀQ¸ÓH×OÑOÓQÐQäÐJÓKÐKùò
s   ÁB!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_rgbar>   )r   Úconvs     r   rD   rD     sD   € ô, ×Ñ×+Ñ+Ó-€Dðð 	�‰�UÔð øô ò Ùðús    2 ²	>½>)..)
r   rL   r   úColormap | Noner   r;   r   údict[str, Color]Úreturnra   )
r   rL   r   r`   r   r;   r   zColor | Sequence[Color] | Nonerb   úlist[Color])
r   rL   r   r`   r   r;   r   z1dict[str, Color] | Color | Sequence[Color] | Nonerb   zdict[str, Color] | list[Color])NrS   )
r   z Color | Collection[Color] | Noner   zstr | Colormap | Noner   r;   r   rL   rb   rc   )r$   rc   r   rL   rb   úIterator[Color])r   ústr | Colormapr   rL   rb   rc   )r   re   rb   r   )r   úColor | Collection[Color]rb   rc   )r   rf   rb   rP   )r   zCollection[Color]rb   rd   )r   r;   r   rL   rb   rc   )r   rA   rb   rP   )$Ú
__future__r   Úcollections.abcr   r   r   r/   Útypingr   r   r	   r(   r\   r<   Úmatplotlib.colorsÚnumpyr7   Úpandas._typingr
   rA   Úpandas.util._exceptionsr   Úpandas.core.dtypes.commonr   r   r   r!   r#   r'   r6   r*   r@   rB   rE   r+   rD   r   r   r   Ú<module>ro      s  ðÝ "÷ñ ó
 ÷ñ ó
 ã Û Û å 3Ý 4å 2áÝ*ð 
ð !$ØðØðàðð ðð
 ðð òó 
ðð 
ð !$Øðð
 -0ñØðàðð ðð
 *ðð òó 
ðð 
ð !$Øð)ð
 @Cñ)Øð)àð)ð ð)ð
 =ð)ð $ò)ó 
ð)ð !%Øð1>ð
 @Dñ1>Øð1>àð1>ð ð1>ð
 =ð1>ð $ó1>ðh1Nà+ð1Nð $ð1Nð ð	1Nð
 ð1Nð ó1NóhEðDØðDàðDð óDóð:Ø$ð:àó:óó,3óóLôr   