
    g                     t    d dl Z d dlmZ d dl d dl ddZ G d de      Z G d de      Zdd	Z	d
 Z
d Zy)    N)PrettyPrinter)*c           
         t        | t              rd\  }}n-t        | t              rd\  }}nt        dt	        |       z        t        |       |k  r| }n"t        | d|       dgz   t        | | d       z   }|dj                  |D cg c]  }t        |       c}      z   |z   }	dj                  t        j                  |	|d|d	z   z  d|d	z   z  
            j                         }
|
S c c}w )a  
    Return a string representation for of a list where list is elided if
    it has more than n elements

    Parameters
    ----------
    v : list
        Input list
    threshold :
        Maximum number of elements to display

    Returns
    -------
    str
    )[])()zInvalid value of type: %sNz...z, 
    )widthinitial_indentsubsequent_indent)
isinstancelisttuple
ValueErrortypelenjoinstrtextwrapwrapstrip)v	threshold	edgeitemsindentr   	open_char
close_chardisp_vev_str	v_wrappeds              I/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/plotly/utils.py_list_repr_elidedr&      s      !T (	:	Au	 (	:4tAw>??
1va
m$w.a
n1EE		6":a3q6":;;jHE		&1*-!VaZ0		
 eg   #;s   C)
c                   ,    e Zd ZdZd Zed        Zd Zy)ElidedWrapperz
    Helper class that wraps values of certain types and produces a custom
    __repr__() that may be elided and is suitable for use during pretty
    printing
    c                 .    || _         || _        || _        y N)r   r   r   )selfr   r   r   s       r%   __init__zElidedWrapper.__init__8   s    "    c                     t        d      }t        | t        t        f      r"t	        |       dkD  rt        | d   t
              sy|rt        | |j                        ryt        | t              ryy)Nnumpyr   TF)
get_moduler   r   r   r   dictndarrayr   )r   r/   s     r%   is_wrappablezElidedWrapper.is_wrappable=   sX    7#a$'CFQJz!A$PT?Uz!U]]33r-   c           
      j   t        d      }t        | j                  t        t        f      r.t        | j                  | j                  | j                        }|S |rt        | j                  |j                        r|j                         } |j                  di t        || j                  dd       | j                  j                         }|j                  d      }dd| j                  z  z   j                  |      } |j                  di | |S t        | j                  t              rlt!        | j                        dkD  r:dt#        | j                  d d	       z   d
z   t#        | j                  dd        z   dz   S | j                  j                         S | j                  j                         S )Nr/   )r   r      P   )r   r   	linewidthr
   r   r      z ... ir	    )r0   r   r   r   r   r&   r   r   r2   get_printoptionsset_printoptionsr1   __repr__splitr   r   r   repr)r+   r/   res	orig_opts	res_liness        r%   r<   zElidedWrapper.__repr__I   sb   7#dfftUm,#$..C Jz$&&%--8 ..0I #E"" yDNNaSUV &&//#C 		$I#++11)<C #E""/Y/J$466{RT$&&"+..84st;MMPSSSvv((66??$$r-   N)__name__
__module____qualname____doc__r,   staticmethodr3   r<   r9   r-   r%   r(   r(   1   s%    #
 	 	#%r-   r(   c                       e Zd ZdZd Zd Zy)ElidedPrettyPrinterzF
    PrettyPrinter subclass that elides long lists/arrays/strings
    c                 d    |j                  dd      | _        t        j                  | g|i | y )Nr      )popr   r   r,   )r+   argskwargss      r%   r,   zElidedPrettyPrinter.__init__t   s,    K5t5d5f5r-   c           	          t         j                  |      r-t        || j                  |      }| j                  ||||||      S t	        j                  | ||||||      S r*   )r(   r3   r   _formatr   )r+   valstreamr   	allowancecontextlevel
elided_vals           r%   rO   zElidedPrettyPrinter._formatx   s^    %%c*&sDNNFCJ<<
FFIwPUVV ((c669gu r-   N)rB   rC   rD   rE   r,   rO   r9   r-   r%   rH   rH   o   s    6r-   rH   c              #      K   t        | t              sy| |f | j                         D ]/  \  }}t        |t              st        |||fz         D ]  }|  1 yw)a  
    General, node-yielding generator.

    Yields (node, path) tuples when it finds values that are dict
    instances.

    A path is a sequence of hashable values that can be used as either keys to
    a mapping (dict) or indices to a sequence (list). A path is always wrt to
    some object. Given an object, a path explains how to get from the top level
    of that object to a nested value in the object.

    :param (dict) node: Part of a dict to be traversed.
    :param (tuple[str]) path: Defines the path of the current node.
    :return: (Generator)

    Example:

        >>> for node, path in node_generator({'a': {'b': 5}}):
        ...     print(node, path)
        {'a': {'b': 5}} ()
        {'b': 5} ('a',)

    N)r   r1   itemsnode_generator)nodepathkeyrP   items        r%   rX   rX      sc     0 dD!
*JJL Sc4 &sDC6M: 
s   >AAc                     |D ]  }| |   } 	 | S )aR  
    Iteratively get on obj for each key in path.

    :param (list|dict) obj: The top-level object.
    :param (tuple[str]|tuple[int]) path: Keys to access parts of obj.

    :return: (*)

    Example:

        >>> figure = {'data': [{'x': [5]}]}
        >>> path = ('data', 0, 'x')
        >>> get_by_path(figure, path)
        [5]
    r9   )objrZ   r[   s      r%   get_by_pathr_      s!       #hJr-   c                    t        | t              rZt        |       D ]J  \  }}t        |t        t        f      rt	        |      | |<   +t        |t
              s<	 t        |      | |<   L | S t        | t              rt        | j                               t        | j                               }}t        ||      D ]f  \  }}t        |t        t        f      rt	        |      | |<   nt        |t
              r	 t        |      | |<   | j                  |      | t        |      <   h | S # t        $ r Y w xY w# t        $ r Y <w xY wr*   )r   r   	enumerater1   decode_unicoder   UnicodeEncodeErrorkeysvaluesziprK   )collnoentryrd   valsr[   rP   s          r%   rb   rb      s#   $"4 	IB%$.)%0ReS)#&u:R	( K 
D$	$))+&T[[](;dD$ 	+HC#d|,*3/S	C% #CDI "XXc]DSN	+ K .  * s$   D$5D4$	D10D14	E ?E )rJ   r5   r   r6   )r9   )r   pprintr   _plotly_utils.utils_plotly_utils.data_utilsr&   objectr(   rH   rX   r_   rb   r9   r-   r%   <module>ro      s@       ! &&R;%F ;%|- (B*r-   