
    A>iM!                       S SK Jr  S SKJrJrJr  S SKrS SKJrJ	r	J
r
  S SKrS SKrS SKrS SKrS SKJr  S SKJr  S SKJr  \(       a  S SKJr  \
  S         SS
 jj5       r\
  SS	S.         SS jjj5       r\
  SS	S.         SS jjj5       r  SSS.         SS jjjr          SS jrSS jr      S S jrS!S jr    S"S jrS#S jrS$S jr S#S jr!S%S jr"S&S jr#g)'    )annotations)
CollectionIteratorSequenceN)TYPE_CHECKINGcastoverload)MatplotlibColor)find_stack_level)is_list_like)Colormap.c                   g N 
num_colorscolormap
color_typecolors       `/var/www/html/land-tabula/venv/lib/python3.13/site-packages/pandas/plotting/_matplotlib/style.pyget_standard_colorsr      s         r   c                   g r   r   r   s       r   r   r   '   s     r   c                   g r   r   r   s       r   r   r   1   s     &)r   c               l    [        U[        5      (       a  U$ [        UUUU S9n[        [	        X@S95      $ )a7  
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                    U c  Ub	  [        XS9$ U b+  Ub  [        R                  " S[        5       S9  [	        U 5      $ [        X#S9$ )a  
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   sS    N }-(II		MMU+- &e,,*:MMr   c              #     #    [        U[        U 5      5      n[        R                  " [        R                  " U 5      U5       Sh  vN   g N7f)zCycle 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#      s6      ZV-J	 7DDDs   AAAAc                z    [        U 5      n[        R                  " SSUS9 Vs/ s H
  o2" U5      PM     sn$ s  snf )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                ~    [        U [        5      (       a'  U n[        R                  U    n U c  [	        SU S35      eU $ )z$Get instance of matplotlib colormap.z	Colormap z is not recognized)r   strmpl	colormaps
ValueError)r   r9   s     r   r6   r6      sB    (C  ==*y.@ABBOr   c                    [        U 5      S:X  a  [        SU  35      e[        U 5      (       a  [        [        U 5      n U /$ [        [
        [           U 5      n [        [        U 5      5      $ )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*      sb     5zQ3E7;<<UE"wE"E*E1%899r   c                r    [        U [        5      (       a  [        U 5      (       a  g[        U 5      (       a  gg)a  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@      s0     %"9%"@"@r   c              #  b   #    U  H%  n[        U5      (       a  Uv   M  [        SU 35      e   g7f)zK
Yield colors from string of several letters or from collection of colors.
zInvalid color N)r@   r>   )r   xs     r   rB   rB      s3      AG~aS122	 s   -/c                    [        [        U 5      =(       a<    [        U 5      S:H  =(       d    [        U 5      S:H  =(       a    [        S U  5       5      5      $ )zACheck if color comprises a sequence of floats representing color.      c              3  N   #    U  H  n[        U[        [        45      v   M     g 7fr   )r   intfloat).0rG   s     r   	<genexpr>#_is_floats_color.<locals>.<genexpr>   s     ;U
1sEl++Us   #%)boolr   r.   allr   s    r   rE   rE      sG    U 	<Z1_/E
a	<;U;; r   c           	     X   U S:X  aQ  [         R                  S   n[        R                  " U[	        U[        U5      5      5       Vs/ s H  nUS   PM
     sn$ U S:X  a>  [        R                  R                  U5      R                  US45      R                  5       $ [        S5      es  snf )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   rU   default_rngtolistr>   )r   r   
prop_cyclecs       r   r+   r+      s    Y\\"34
 %%j#j#j/2RS
S gJS
 	
 
x	yy$$Z077QHOOQQJKK
s   B'c                    [         R                  R                  5       n UR                  U 5        g! [         a     gf = f)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]returnrb   )
r   rL   r   ra   r   r;   r   zColor | Sequence[Color] | Nonerc   list[Color])
r   rL   r   ra   r   r;   r   z1dict[str, Color] | Color | Sequence[Color] | Nonerc   zdict[str, Color] | list[Color])NrT   )
r   z Color | Collection[Color] | Noner   zstr | Colormap | Noner   r;   r   rL   rc   rd   )r$   rd   r   rL   rc   Iterator[Color])r   str | Colormapr   rL   rc   rd   )r   rf   rc   r   )r   Color | Collection[Color]rc   rd   )r   rg   rc   rQ   )r   zCollection[Color]rc   re   )r   r;   r   rL   rc   rd   )r   rA   rc   rQ   )$
__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>rp      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   