
    c.                         d dl mZmZ d dlZd dlmZ d dlT d dlT ddZ G d	 d
e	          Z
 G d de          ZddZd Zd ZdS )    )absolute_importdivisionN)PrettyPrinter)*      P   c           
          t          | t                    rd\  }}n:t          | t                    rd\  }}nt          dt	          |           z            t          |           |k    r| }n4t          | d|                   dgz   t          | | d                   z   }|d                    d |D                       z   |z   }d                    t          j        ||d	|d
z   z  d	|d
z   z                      	                                }	|	S )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, c                 ,    g | ]}t          |          S  )str).0es     ,lib/python3.11/site-packages/plotly/utils.py
<listcomp>z%_list_repr_elided.<locals>.<listcomp>&   s    ":":":a3q66":":":    
    )widthinitial_indentsubsequent_indent)

isinstancelisttuple
ValueErrortypelenjointextwrapwrapstrip)
v	threshold	edgeitemsindentr   	open_char
close_chardisp_vv_str	v_wrappeds
             r   _list_repr_elidedr0   
   s/     !T @ (	::	Au		 @ (	::4tAww>???
1vv Fa

m$$w.a
n1E1EE		":":6":":":;;;jHE		&1*-!VaZ0		
 	
 	
  egg  r   c                   4    e Zd ZdZd Zed             Zd ZdS )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                 0    || _         || _        || _        d S N)r'   r*   r(   )selfr'   r(   r*   s       r   __init__zElidedWrapper.__init__:   s    "r   c                    t          d          }t          | t          t          f          r0t	          |           dk    rt          | d         t
                    sdS |rt          | |j                  rdS t          | t                    rdS dS )Nnumpyr   TF)
get_moduler   r   r   r"   dictndarrayr   )r'   r8   s     r   is_wrappablezElidedWrapper.is_wrappable?   s    7##a$'' 	CFFQJ 	z!A$PT?U?U 	4 	z!U]33 	43 	45r   c           
      T   t          d          }t          | j        t          t          f          r#t          | j        | j        | j                  }|S |rt          | j        |j                  r|	                                } |j
        di t          || j        dd           | j                                        }|                    d          }dd| j        z  z                       |          } |j
        di | |S t          | j        t                    rst!          | j                  dk    rBdt#          | j        d d	                   z   d
z   t#          | j        dd                    z   dz   S | j                                        S | j                                        S )Nr8   )r(   r*   r   r	   )r(   r)   	linewidthr   r   r      z ... ir   r   )r9   r   r'   r   r   r0   r(   r*   r;   get_printoptionsset_printoptionsr:   __repr__splitr#   r   r"   repr)r5   r8   res	orig_opts	res_liness        r   rB   zElidedWrapper.__repr__K   s   7##dftUm,, !	%#$.  C J 	%z$&%-88 	% ..00I #E"  yDNaSUVVV   &//##C 		$I#++11)<<C #E"//Y///J$$ 	%46{{R )T$&"+...84stt;M;MMPSSSv(((6??$$$r   N)__name__
__module____qualname____doc__r6   staticmethodr<   rB   r   r   r   r2   r2   3   sW         # # #
 	 	 \	#% #% #% #% #%r   r2   c                       e Zd ZdZd Zd ZdS )ElidedPrettyPrinterzF
    PrettyPrinter subclass that elides long lists/arrays/strings
    c                 f    |                     dd          | _        t          j        | g|R i | d S )Nr(   r   )popr(   r   r6   )r5   argskwargss      r   r6   zElidedPrettyPrinter.__init__v   s>    K55t5d555f55555r   c           	          t                               |          r0t          || j        |          }|                     ||||||          S t	          j        | ||||||          S r4   )r2   r<   r(   _formatr   )r5   valstreamr*   	allowancecontextlevel
elided_vals           r   rT   zElidedPrettyPrinter._formatz   sl    %%c** 	&sDNFCCJ<<
FFIwPUVVV (c669gu  r   N)rH   rI   rJ   rK   r6   rT   r   r   r   rN   rN   q   s<         6 6 6    r   rN   r   c              #      K   t          | t                    sdS | |fV  |                                 D ]5\  }}t          |t                    rt          |||fz             D ]}|V  6dS )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   r:   itemsnode_generator)nodepathkeyrU   items        r   r]   r]      s      0 dD!! 
*JJLL  Sc4   	&sDC6M::  



 r   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]
    r   )objr_   r`   s      r   get_by_pathrd      s#        #hJr   c                     t          | t                    r~t          |           D ]m\  }}t          |t          t          f          rt	          |          | |<   4t          |t
                    r$	 t          |          | |<   ]# t          $ r Y iw xY wnnt          | t                    rt          |                                           t          |                                           }}t          ||          D ]\  }}t          |t          t          f          rt	          |          | |<   n9t          |t
                    r$	 t          |          | |<   n# t          $ r Y nw xY w| 
                    |          | t          |          <   | S r4   )r   r   	enumerater:   decode_unicoder   UnicodeEncodeErrorkeysvaluesziprP   )collnoentryri   valsr`   rU   s          r   rg   rg      s   $ +"4 	 	IB%$.. )%00ReS)) #&u::R-   		 
D$		 
+$))++&&T[[]](;(;dD$ 	+ 	+HC#d|,, *3//S		C%%  #CDII)   D!XXc]]DSNNKs$   /B
BBE
E%$E%)r   r   r   r	   )r   )
__future__r   r   r$   pprintr   _plotly_utils.utils_plotly_utils.data_utilsr0   objectr2   rN   r]   rd   rg   r   r   r   <module>ru      s    0 0 0 0 0 0 0 0              ! ! ! ! & & & && & & &R;% ;% ;% ;% ;%F ;% ;% ;%|    -   (   B  *    r   