
    6Dh>!                         S SK Jr  S SKJr  S SKJrJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJr  S rS rS rS rS rS	 rS
 r    SS jrSS jrg)    )Sequence)
exceptions)DEFAULT_PLOTLY_COLORSPLOTLY_SCALEScolor_parsercolorscale_to_colorscolorscale_to_scaleconvert_to_RGB_255find_intermediate_color
hex_to_rgb	label_rgbn_colorsunconvert_from_RGB_255unlabel_rgbvalidate_colorsvalidate_colors_dictvalidate_colorscalevalidate_scale_valuesc                 Z    [        U [        5      =(       a    [        U [        5      (       + $ N)
isinstancer   str)objs    M/var/www/html/env/lib/python3.13/site-packages/plotly/figure_factory/utils.pyis_sequencer      s    c8$AZS-A)AA    c                 (  ^ SSK Jm  [        U S   T5      (       a1  [        U4S jU  5       5      (       d  [        R
                  " S5      eg[        U S   [        5      (       a.  [        S U  5       5      (       d  [        R
                  " S5      egg)z
Validates if a list contains all numbers or all strings

:raises: (PlotlyError) If there are any two items in the list whose
    types differ
r   Numberc              3   <   >#    U  H  n[        UT5      v   M     g 7fr   r   .0itemr   s     r   	<genexpr>!validate_index.<locals>.<genexpr>&   s     C
:dF++
   z^Error in indexing column. Make sure all entries of each column are all numbers or all strings.c              3   B   #    U  H  n[        U[        5      v   M     g 7fr   r   r   r#   r$   s     r   r%   r&   /   s     @ZT:dC((Z   Nnumbersr   r   allr   PlotlyErrorr   )
index_valsr   s    @r   validate_indexr1      s     *Q-((C
CCC((  D 
JqM3	'	'@Z@@@((  A 
(r   c                 >  ^ SSK Jm  U  H  n[        US   T5      (       a2  [        U4S jU 5       5      (       d  [        R
                  " S5      eMI  [        US   [        5      (       d  Mc  [        S U 5       5      (       a  M|  [        R
                  " S5      e   g)z
Validates all strings or numbers in each dataframe column

:raises: (PlotlyError) If there are any two items in any list whose
    types differ
r   r   c              3   <   >#    U  H  n[        UT5      v   M     g 7fr   r!   r"   s     r   r%   %validate_dataframe.<locals>.<genexpr>C   s     CFDz$//Fr'   zWError in dataframe. Make sure all entries of each column are either numbers or strings.c              3   B   #    U  H  n[        U[        5      v   M     g 7fr   r)   r*   s     r   r%   r4   K   s     @z$,,r+   Nr,   )arrayvectorr   s     @r   validate_dataframer8   8   s     fQi((CFCCC ,,*  D q	3''@@@@ ,,*  r   c                     ^ [        U S   5      m[        U4S jU  5       5      (       a  [        R                  " S5      eg)z
Validates that data lists or ndarrays are the same length.

:raises: (PlotlyError) If any data lists are not the same length.
r   c              3   @   >#    U  H  n[        U5      T:g  v   M     g 7fr   )len)r#   lstlengths     r   r%   (validate_equal_length.<locals>.<genexpr>[   s     
.#3s8vs   z<Oops! Your data lists or ndarrays should be the same length.N)r;   anyr   r/   )argsr=   s    @r   validate_equal_lengthrA   T   s>     a\F

.
...$$M
 	
 /r   c                      U R                  5        H&  u  p US::  a  [        SR                  X5      5      eM(     g! [         a&    [        R
                  " SR                  X5      5      ef = f)z
Validates that all values given in key/val pairs are positive.

Accepts kwargs to improve Exception messages.

:raises: (PlotlyError) If any value is < 0 or raises.
r   z{} must be > 0, got {}z{} must be a number, got {}N)items
ValueErrorformat	TypeErrorr   r/   )kwargskeyvals      r   validate_positive_scalarsrJ   a   so     LLN	Yax !9!@!@!JKK  #  	Y(()F)M)Mc)WXX	Ys	    <0A,c                      U  VVs/ s H  o  H  o"PM     M     snn$ s  snnf ! [          a    [        R                  " S5      ef = f)z
Uses list comprehension to flatten array

:param (array): An iterable to flatten
:raises (PlotlyError): If iterable is not nested.
:rtype (list): The flattened list.
z\Your data array could not be flattened! Make sure your data is entered as lists or ndarrays!)rF   r   r/   )r6   sublistr$   s      r   flattenrM   q   sN    
$)>EgdgE>>> 
$$,
 	

s   % % % !Ac                    [        U 5      n[        U [        5      (       d+  [        U [        5      (       d  [        R
                  " S5      eU  H.  n[        U[        5      (       d  M  [        R
                  " S5      e   [        US-
  5       H&  nX   XS-      :  d  M  [        R
                  " S5      e   / nUR                  [        S5      U S   /5        [        US-
  5       H?  n/ nUR                  X   5        UR                  XS-      5        UR                  U5        MA     UR                  XS-
     [        S5      /5        U$ )a  
Returns a list of intervals for categorical colormaps

Accepts a list or tuple of sequentially increasing numbers and returns
a list representation of the mathematical intervals with these numbers
as endpoints. For example, [1, 6] returns [[-inf, 1], [1, 6], [6, inf]]

:raises: (PlotlyError) If input is not a list or tuple
:raises: (PlotlyError) If the input contains a string
:raises: (PlotlyError) If any number does not increase after the
    previous one in the sequence
zZThe intervals_endpts argument must be a list or tuple of a sequence of increasing numbers.   z-infr   inf)
r;   r   tuplelistr   r/   r   rangeappendfloat)endptsr=   r$   k	intervalsintervals         r   endpts_to_intervalsrZ      s:    [Fv'':ft+E+E$$%
 	
 dC  ((   6A:91u%((   	%-34vz"AHOOFI&OOFq5M*X&	 # 	&!,eEl;<r   c                 j   SUS-
  U-  -
  U-  nU(       d:  Sn	Sn
US:X  a  US-
  X-   -  SU-  -   nSnSnOdUS:X  a  US-
  X-   -  SU-  -   nSnS	nOIUS:X  a  Sn	S
n
US-
  X-   -  SU-  -   nSnSnO*US:X  a$  Sn
US-
  X-   -  SU-  -   nU(       a  SnSn	OSnSn	Sn[        WW	W
WWSSSU [        SUS9S9
nU$ )a  
Returns annotation dict for label of n labels of a 1xn or nx1 subplot.

:param (str) text: the text for a label.
:param (int) lane: the label number for text. From 1 to n inclusive.
:param (int) num_of_lanes: the number 'n' of rows or columns in subplot.
:param (float) subplot_spacing: the value for the horizontal_spacing and
    vertical_spacing params in your plotly.tools.make_subplots() call.
:param (str) row_col: choose whether labels are placed along rows or
    columns.
:param (bool) flipped: flips text by 90 degrees. Text is printed
    horizontally if set to True and row_col='row', or if False and
    row_col='col'.
:param (bool) right_side: only applicable if row_col is set to 'row'.
:param (str) text_color: color of the text.
rO   centermiddlecolg      ?g{Gz?r   rowZ   bottomg      ?i  leftg{GzrightFpaper   )sizecolor)
	textanglexanchoryanchorxy	showarrowxrefyreftextfont)dict)rp   lanenum_of_lanessubplot_spacingrow_colflipped
right_side
text_colorlri   rj   rk   rl   rh   annotation_dicts                  r   annotation_dict_for_labelr|      s3   4 
lQ/1	1lCAea12S1W<AAIa12S1W<AAIeGGa12S1W<AAIGa12S1W<A !I

r,O r   c                     [        U 5      S:  a  [        R                  " S5      e[        U 5      S-
  S-  S-   U-   S-   US-  -   nUR                  " U 6 $ )z
Returns an English listing of objects seperated by commas ','

For example, ['foo', 'bar', 'baz'] becomes 'foo, bar and baz'
if the conjunction 'and' is selected.
   z1Your list or tuple must contain at least 2 items.z{}, z{} z {}.)r;   r   r/   rE   )iterableconjperiodtemplates       r   list_of_optionsr      sb     8}q$$?
 	
 H!V+e3d:UBVc\QH??H%%r   N)r^   TTz#0f0f0f)andT)collections.abcr   plotlyr   plotly.colorsr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r1   r8   rA   rJ   rM   rZ   r|   r    r   r   <module>r      sd    $     (B88

Y 
$2t DN&r   