U
    ƒIÀdŒ  ã                   @   s.  U d dl Z d dl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mZm	Z	m
Z
mZ d dlmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZm Z  d d	l!m"Z" zd dl#Z$e%e$d
ƒZ&W n e'k
�r   dZ&Y nX ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: e�ržddl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZA eeBdœdd„ZCeed dœdd„ZDeEeBdœdd„ZFe Gdg ¡ZHeEeBdœd d!„ZId�eed# d$eBeBeeJ eeJ eeJ eBe eKdf d%œ
d&d'„ZLeEe eMeeMd(f f eBd)œd*d+„ZNd‚ed# d$eBeBeeJ eeJ eeJ eBdd,œ	d-d.„ZOG d/d0„ d0e5ƒZPeeef eeKeKeKf d1œd2d3„ZQd4eeKeKeKf d1œd5d6„ZRejSd7d8„ eeRe
eQed9d8„ ed:d8„ eTd;d8„ ed<d8„ eUd=d8„ eVd>d8„ e	d?d8„ eWd@d8„ eXdAd8„ edBd8„ iZYeeMeegeeKeKeKf f f eZdC< eXeY [¡ ƒZ\eTejSeefZ]eeBdœdDdE„Z^eG dFdG„ dGƒƒZ_eG dHdI„ dIƒƒZ`eeBdœdJdK„ZadƒeeeJ eeJ eeJ e_dLœdMdN„ZbdOdPdddddQœeeJeJeeJ eeJ eeJ eBeKdRœdSdT„ZcddUdddddVœeed# eBeeJ eeJ eeJ eBddWœdXdY„ZdeedZk�r*G d[d\„ d\ƒZfd d]lmgZg G d^d_„ d_egƒZhe
eJƒZid`eida< ddbdcddded`dfdgdhdihgeUddjdkhƒe
eVdldmdndodpdqgiƒedmdrdsdtdtdugƒdvehdwdxdydzd{d|gƒefƒ d}œZjejda  kej¡ d d~llmmZm G dd€„ d€ƒZnemePenƒ ƒƒ dS )„é    N)Úarray)ÚCounterÚUserDictÚUserListÚdefaultdictÚdeque)Ú	dataclassÚfieldsÚis_dataclass)Úisclass)Úislice)ÚMappingProxyType)ÚTYPE_CHECKINGÚAnyÚCallableÚDefaultDictÚDictÚIterableÚListÚOptionalÚSequenceÚSetÚTupleÚUnion)ÚRichReprResultZibFé   ©Úget_console)Ú	loop_last)Ú	pick_bool)ÚRichRenderable©Úcell_len)ÚReprHighlighter)ÚJupyterMixinÚJupyterRenderable)ÚMeasurement)ÚText)ÚConsoleÚConsoleOptionsÚHighlighterTypeÚJustifyMethodÚOverflowMethodÚRenderResult©ÚobjÚreturnc                 C   s   t ot t| ƒ¡S )z1Check if an object was created with attrs module.)Ú
_has_attrsÚ_attr_moduleÚhasÚtype©r/   © r6   úP/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/pip/_vendor/rich/pretty.pyÚ_is_attr_object:   s    r8   z_attr_module.Attribute[Any]c                 C   s   t rt t| ƒ¡S g S )zGet fields for an attrs object.)r1   r2   r	   r4   r5   r6   r6   r7   Ú_get_attr_fields?   s    r9   c                 C   s.   z| j jjtjkW S  tk
r(   Y dS X dS )zÙCheck if an instance of a dataclass contains the default repr.

    Args:
        obj (object): A dataclass instance.

    Returns:
        bool: True if the default repr is used, False if there is a custom repr.
    FN)Ú__repr__Ú__code__Úco_filenameÚdataclassesÚ__file__Ú	Exceptionr5   r6   r6   r7   Ú_is_dataclass_reprD   s    r@   Ú_dummy_namedtuplec              	   C   sB   d}zt  | j¡}W n ttfk
r,   Y nX t  tj¡}||kS )zÍCheck if an instance of namedtuple contains the default repr

    Args:
        obj (object): A namedtuple

    Returns:
        bool: True if the default repr is used, False if there's a custom repr.
    N)ÚinspectÚgetfiler:   ÚOSErrorÚ	TypeErrorrA   )r/   Úobj_fileÚdefault_repr_filer6   r6   r7   Ú_has_default_namedtuple_reprX   s    	rH   Úignorer(   r,   )
ÚvalueÚconsoleÚoverflowÚcropÚindent_guidesÚ
max_lengthÚ
max_stringÚ	max_depthÚ
expand_allr0   c	                 C   s”   ddl m}	 t| tƒs| d kr"d S |p*tƒ }| ¡ �L}
t| |	ƒrH| ¡  |jt| tƒrZ| nt	| ||||||dd�|ddd� W 5 Q R X |
 
¡  d¡S )	Nr   )ÚConsoleRenderableé   )rL   rN   rO   rP   rQ   rR   ÚmarginTÚ )rM   Únew_line_startÚendÚ
)rK   rS   Ú_safe_isinstancer%   r   ÚcaptureÚlineÚprintr    ÚPrettyÚgetÚrstrip)rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   r[   r6   r6   r7   Ú_ipy_display_hookl   s2    


ÿø
ñra   .)r/   Úclass_or_tupler0   c                 C   s(   zt | |ƒW S  tk
r"   Y dS X dS )zFisinstance can fail in rare cases, for example types with no __class__FN)Ú
isinstancer?   )r/   rb   r6   r6   r7   rZ   š   s    rZ   )	rK   rL   rM   rN   rO   rP   rQ   rR   r0   c              	      sž   ddl m‰ ˆ pˆƒ ‰ ˆ dk	s"t‚tddœ‡ ‡‡‡‡‡‡‡fdd„}dtƒ kr”tƒ }	ddlm}
 G ‡‡‡‡‡‡‡fd	d
„d
|
ƒ}|ƒ }||	jj	d< n|t
_dS )aù  Install automatic pretty printing in the Python REPL.

    Args:
        console (Console, optional): Console instance or ``None`` to use global console. Defaults to None.
        overflow (Optional[OverflowMethod], optional): Overflow method. Defaults to "ignore".
        crop (Optional[bool], optional): Enable cropping of long lines. Defaults to False.
        indent_guides (bool, optional): Enable indentation guides. Defaults to False.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
        max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
        expand_all (bool, optional): Expand all containers. Defaults to False.
        max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.
    r   r   N©rJ   r0   c              
      sR   | dk	rNˆ dk	st ‚dt_ˆ jt| tƒr,| nt| ˆˆˆˆˆˆd�ˆd� | t_dS )z?Replacement sys.displayhook which prettifies objects with Rich.N)rL   rN   rO   rP   rQ   rR   )rM   )ÚAssertionErrorÚbuiltinsÚ_r]   rZ   r    r^   )rJ   )rK   rM   rR   rN   rQ   rO   rP   rL   r6   r7   Údisplay_hookÁ   s$    ÿù	ôzinstall.<locals>.display_hookÚget_ipython)ÚBaseFormatterc                       s:   e Zd ZU dZeed< eedœ‡ ‡‡‡‡‡‡fdd„ZdS )zinstall.<locals>.RichFormatterTÚpprintrd   c              
      s,   | j r t|ˆƒ ˆˆˆˆˆˆ d�S t|ƒS d S )N)rK   rL   rN   rO   rP   rQ   rR   )rk   ra   Úrepr)ÚselfrJ   ©rR   r   rN   rQ   rO   rP   rL   r6   r7   Ú__call__Ý   s    øz'install.<locals>.RichFormatter.__call__N)Ú__name__Ú
__module__Ú__qualname__rk   ÚboolÚ__annotations__r   ro   r6   rn   r6   r7   ÚRichFormatterÚ   s   
ru   z
text/plain)Úpip._vendor.richr   re   r   Úglobalsri   ÚIPython.core.formattersrj   Údisplay_formatterÚ
formattersÚsysÚdisplayhook)rK   rL   rM   rN   rO   rP   rQ   rR   rh   Úiprj   ru   Úrich_formatterr6   )	rK   rM   rR   r   rN   rQ   rO   rP   rL   r7   Úinstall¤   s    
"
 r   c                   @   s”   e Zd ZdZdddddddddddddœeed eed ed	 ee eee ee ee eeedd
œdd„Zddddœdd„Z	ddddœdd„Z
dS )r^   ak  A rich renderable that pretty prints an object.

    Args:
        _object (Any): An object to pretty print.
        highlighter (HighlighterType, optional): Highlighter object to apply to result, or None for ReprHighlighter. Defaults to None.
        indent_size (int, optional): Number of spaces in indent. Defaults to 4.
        justify (JustifyMethod, optional): Justify method, or None for default. Defaults to None.
        overflow (OverflowMethod, optional): Overflow method, or None for default. Defaults to None.
        no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to False.
        indent_guides (bool, optional): Enable indentation guides. Defaults to False.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
        max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
        expand_all (bool, optional): Expand all containers. Defaults to False.
        margin (int, optional): Subtrace a margin from width to force containers to expand earlier. Defaults to 0.
        insert_line (bool, optional): Insert a new line if the output has multiple new lines. Defaults to False.
    Né   Fr   )Úindent_sizeÚjustifyrL   Úno_wraprN   rO   rP   rQ   rR   rU   Úinsert_liner*   r+   r,   )Ú_objectÚhighlighterr�   r‚   rL   rƒ   rN   rO   rP   rQ   rR   rU   r„   r0   c                C   sX   || _ |ptƒ | _|| _|| _|| _|| _|| _|| _|	| _	|
| _
|| _|| _|| _d S ©N)r…   r#   r†   r�   r‚   rL   rƒ   rN   rO   rP   rQ   rR   rU   r„   )rm   r…   r†   r�   r‚   rL   rƒ   rN   rO   rP   rQ   rR   rU   r„   r6   r6   r7   Ú__init__  s    zPretty.__init__r(   r)   r-   )rK   Úoptionsr0   c              	   c   s¸   t | j|j| j | j| j| j| j| jd�}t	j
|| jp:|j| jpD|jt| j|jƒdd�}|rf|  |¡nt	t| jƒ› d�dd�}| jrš|jsš|j| jdd�}| jr®d|kr®d	V  |V  d S )
N©Ú	max_widthr�   rO   rP   rQ   rR   Úpretty)r‚   rL   rƒ   Ústylez.__repr__ returned empty stringz
dim italic)r�   zrepr.indentrY   rV   )Úpretty_reprr…   r‹   rU   r�   rO   rP   rQ   rR   r'   Ú	from_ansir‚   rL   r   rƒ   r†   r4   rN   Ú
ascii_onlyÚwith_indent_guidesr„   )rm   rK   r‰   Ú
pretty_strÚpretty_textr6   r6   r7   Ú__rich_console__&  s>    
ù	

û	ÿþý ÿzPretty.__rich_console__r&   c              	   C   sL   t | j|j| j| j| j| j| jd�}|r>tdd„ | 	¡ D ƒƒnd}t
||ƒS )NrŠ   c                 s   s   | ]}t |ƒV  qd S r‡   r!   ©Ú.0r\   r6   r6   r7   Ú	<genexpr>V  s     z*Pretty.__rich_measure__.<locals>.<genexpr>r   )rŽ   r…   r‹   r�   rO   rP   rQ   rR   ÚmaxÚ
splitlinesr&   )rm   rK   r‰   r’   Ú
text_widthr6   r6   r7   Ú__rich_measure__I  s    ù
ÿzPretty.__rich_measure__)N)rp   rq   rr   Ú__doc__r   r   Úintrs   rˆ   r”   r›   r6   r6   r6   r7   r^   ó   sL    ýñð  þ$ þr^   )r…   r0   c                 C   s   d| j ›d�dd| j ›d�fS )Nzdefaultdict(z, {ú})z, {}))Údefault_factory©r…   r6   r6   r7   Ú_get_braces_for_defaultdict[  s    ýr¡   z
array[Any]c                 C   s   d| j ›d�dd| j ›d�fS )Nzarray(z, [ú])ú))Útypecoder    r6   r6   r7   Ú_get_braces_for_arrayc  s    r¥   c                 C   s   dS )N)z	environ({rž   zenviron({})r6   r    r6   r6   r7   Ú<lambda>h  ó    r¦   c                 C   s   dS )N)z	Counter({rž   z	Counter()r6   r    r6   r6   r7   r¦   k  r§   c                 C   s   dS )N)zdeque([r¢   zdeque()r6   r    r6   r6   r7   r¦   l  r§   c                 C   s   dS ©N)Ú{Ú}z{}r6   r    r6   r6   r7   r¦   m  r§   c                 C   s   dS r¨   r6   r    r6   r6   r7   r¦   n  r§   c                 C   s   dS )N)zfrozenset({rž   zfrozenset()r6   r    r6   r6   r7   r¦   o  r§   c                 C   s   dS ©N)ú[ú]z[]r6   r    r6   r6   r7   r¦   p  r§   c                 C   s   dS r«   r6   r    r6   r6   r7   r¦   q  r§   c                 C   s   dS )N)r©   rª   zset()r6   r    r6   r6   r7   r¦   r  r§   c                 C   s   dS )N)ú(r£   ú()r6   r    r6   r6   r7   r¦   s  r§   c                 C   s   dS )N)zmappingproxy({rž   zmappingproxy({})r6   r    r6   r6   r7   r¦   t  r§   Ú_BRACESc                 C   s.   t | tƒs$t| ƒs$t| dƒs$t| ƒo,t| ƒ S )z3Check if an object may be expanded by pretty print.Ú__rich_repr__)rZ   Ú_CONTAINERSr
   Úhasattrr8   r   r5   r6   r6   r7   Úis_expandablez  s    
ÿþüûr´   c                   @   sæ   e Zd ZU dZdZeed< dZeed< dZeed< dZ	eed< dZ
eed< dZeed	< dZeed
< dZeed< dZeed   ed< dZeed< dZeed< ee dœdd„Zeeedœdd„Zedœdd„Zdeeeedœdd„ZdS ) ÚNodez4A node in a repr tree. May be atomic or a container.rV   Úkey_reprÚ
value_reprÚ
open_braceÚclose_braceÚemptyFÚlastÚis_tupleÚis_namedtupleNÚchildrenz: Úkey_separatorz, Ú	separator©r0   c                 c   s²   | j r| j V  | jV  | jr&| jV  nˆ| jdk	r®| jr¦| jV  | jrt| jstt| jƒdkrt| jd  ¡ E dH  dV  n(| jD ] }| ¡ E dH  |j	sz| j
V  qz| jV  n| jV  dS )zGenerate tokens for this node.Nr   r   ú,)r¶   r¿   r·   r¾   r¸   r¼   r½   ÚlenÚiter_tokensr»   rÀ   r¹   rº   )rm   Úchildr6   r6   r7   rÄ   ”  s"    




zNode.iter_tokens)Ústart_lengthrO   r0   c                 C   s0   |}|   ¡ D ]}|t|ƒ7 }||kr dS qdS )a*  Check the length fits within a limit.

        Args:
            start_length (int): Starting length of the line (indent, prefix, suffix).
            max_length (int): Maximum length.

        Returns:
            bool: True if the node can be rendered within max length, otherwise False.
        FT)rÄ   r"   )rm   rÆ   rO   Útotal_lengthÚtokenr6   r6   r7   Úcheck_lengthª  s    
zNode.check_lengthc                 C   s   d  |  ¡ ¡}|S ©NrV   )ÚjoinrÄ   )rm   Ú	repr_textr6   r6   r7   Ú__str__»  s    zNode.__str__éP   r€   )r‹   r�   rR   r0   c                 C   sx   t | dd�g}d}|t|ƒk r`|| }|jrV|jsV|s@| |¡sV| |¡|||d …< |d7 }qd dd„ |D ƒ¡}|S )al  Render the node to a pretty repr.

        Args:
            max_width (int, optional): Maximum width of the repr. Defaults to 80.
            indent_size (int, optional): Size of indents. Defaults to 4.
            expand_all (bool, optional): Expand all levels. Defaults to False.

        Returns:
            str: A repr string of the original object.
        T)ÚnodeÚis_rootr   r   rY   c                 s   s   | ]}t |ƒV  qd S r‡   )Ústrr•   r6   r6   r7   r—   Õ  s     zNode.render.<locals>.<genexpr>)Ú_LinerÃ   Ú
expandableÚexpandedrÉ   ÚexpandrË   )rm   r‹   r�   rR   ÚlinesÚline_nor\   Úrepr_strr6   r6   r7   Úrender¿  s    
zNode.render)rÎ   r€   F)rp   rq   rr   rœ   r¶   rÑ   rt   r·   r¸   r¹   rº   r»   rs   r¼   r½   r¾   r   r   r¿   rÀ   r   rÄ   r�   rÉ   rÍ   rÙ   r6   r6   r6   r7   rµ   „  s0   
     ÿ  þrµ   c                   @   s¾   e Zd ZU dZdZed  ed< dZeed< dZ	ee
 ed< dZeed< dZeed	< dZeed
< dZeed< dZeed< eedœdd„ƒZeedœdd„Zeed  dœdd„Zedœdd„ZdS )rÒ   zA line in repr output.NÚparentFrÐ   rÏ   rV   ÚtextÚsuffixÚ
whitespacerÔ   r»   rÁ   c                 C   s   t | jdk	o| jjƒS )z"Check if the line may be expanded.N)rs   rÏ   r¾   ©rm   r6   r6   r7   rÓ   æ  s    z_Line.expandable)rO   r0   c                 C   s:   t | jƒt| jƒ t| jƒ }| jdk	s,t‚| j ||¡S )z4Check this line fits within a given number of cells.N)rÃ   rÝ   r"   rÛ   rÜ   rÏ   re   rÉ   )rm   rO   rÆ   r6   r6   r7   rÉ   ë  s    ÿz_Line.check_length)r�   r0   c                 c   sØ   | j }|dk	st‚| j}|js"t‚|jrJt|j› |j› |j› �|d�V }nt|j|d�V }| jd|  }|jozt	|jƒdk}t
|jƒD ]4\}}|r–dn|j}	t||||	|o®| d�}
|
V  q†t|j|| j| jd�V  dS )z6Expand this line by adding children on their own line.N)rÛ   rÝ   ú r   rÂ   )rÚ   rÏ   rÝ   rÜ   r»   )rÛ   rÝ   rÜ   r»   )rÏ   re   rÝ   r¾   r¶   rÒ   r¿   r¸   r¼   rÃ   r   rÀ   r¹   rÜ   r»   )rm   r�   rÏ   rÝ   Únew_lineÚchild_whitespaceÚtuple_of_oner»   rÅ   rÀ   r\   r6   r6   r7   rÕ   ó  s8    
þ
ûüz_Line.expandc                 C   sH   | j r | j› | j› | jpd› �S | j› | j› | jp4d› | j ¡ › �S d S rÊ   )r»   rÝ   rÛ   rÏ   rÜ   r`   rÞ   r6   r6   r7   rÍ     s    "ÿz_Line.__str__)rp   rq   rr   rœ   rÚ   r   rt   rÐ   rs   rÏ   rµ   rÛ   rÑ   rÜ   rÝ   rÔ   r»   ÚpropertyrÓ   r�   rÉ   r   rÕ   rÍ   r6   r6   r6   r7   rÒ   Ù  s   
!rÒ   c                 C   s<   zt | ddƒ}W n tk
r&   Y dS X t| tƒo:t|tƒS )aX  Checks if an object is most likely a namedtuple. It is possible
    to craft an object that passes this check and isn't a namedtuple, but
    there is only a minuscule chance of this happening unintentionally.

    Args:
        obj (Any): The object to test

    Returns:
        bool: True if the object is a namedtuple. False otherwise.
    Ú_fieldsNF)Úgetattrr?   rc   Útuple)r/   r	   r6   r6   r7   Ú_is_namedtuple  s
    rç   )r…   rO   rP   rQ   r0   c              	      s\   t tdœ‡fdd„‰tƒ ‰ˆj‰ˆj‰dt tttdœ‡ ‡‡‡‡‡‡fdd„‰ ˆ | d	d
�}|S )a`  Traverse object and generate a tree.

    Args:
        _object (Any): Object to be traversed.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
            Defaults to None.
        max_depth (int, optional): Maximum depth of data structures, or None for no maximum.
            Defaults to None.

    Returns:
        Node: The root of a tree structure which can be used to render a pretty repr.
    r.   c              
      sŠ   ˆ dk	rFt | ttfƒrFt| ƒˆ krFt| ƒˆ  }| dˆ … ›d|› �}n@zt| ƒ}W n2 tk
r„ } zdt|ƒ›d�}W 5 d}~X Y nX |S )z0Get repr string for an object, but catch errors.Nú+z<repr-error ú>)rZ   ÚbytesrÑ   rÃ   rl   r?   )r/   Ú	truncatedÚobj_reprÚerror)rP   r6   r7   Úto_reprE  s    ÿþ
ý"ztraverse.<locals>.to_reprFr   )r/   ÚrootÚdepthr0   c           "         s°  t ˆƒ}|ˆkrtdd�S tˆƒ}ˆdk	o0|ˆk}tttttttf f  dœdd„}ztˆdƒ}W n t	k
r|   d}Y nX d}|sºztˆd	ƒr¢t
ˆƒs¢ˆ ¡ }W n t	k
r¸   Y nX |dk	�rˆ|ƒ tˆjd
dƒ}	t||ƒƒ}
ˆjj}|
�rÜg }|j}|�r0|	�rtd|› d�d�}nt|› d�d�}nª|	�rRtd|› d�d||dd�}nt|› d�d||d�}t|
ƒD ]h\}}t|tƒ�r¸|\}}ˆ||d d�}||_||_d|_||ƒ nˆ||d d�}||_||ƒ �qpn&t|	�rðd|› d�n|› d�g |d�}ˆ|ƒ �nˆtˆƒ�r*|�s*ˆ|ƒ g }|j}tˆƒ‰ ˆ �r|�rZtˆjj› d�d�}nªtˆjj› d�d||d�}tttttttgtf  f  dœ‡ ‡fdd„}t|ƒ ƒD ]T\}\}}}|�rÖtt||ƒƒd�}nˆ||d d�}||_||_d|_||ƒ �q®ntˆjj› d�g |d�}ˆ|ƒ �nltˆƒ�rtˆtƒ�s|�stˆƒ�rˆ|ƒ g }|j}|�r~tˆjj› d�d�}n|tˆjj› d�d||ˆjj› d�d�}tdd„ tˆƒD ƒƒD ]>\}}ˆtˆ|jƒ|d d�}|j|_||_d|_||ƒ �qºˆ|ƒ �n�tˆƒ�r¾t ˆƒ�r¾ˆ|ƒ ˆjj}|�rBt|› d�d�}npg }|j}t|› d�d||› d�d�}tˆ !¡  "¡ ƒD ]8\}\}}ˆ||d d�}||_||_d|_||ƒ �qxˆ|ƒ �nØtˆt#ƒ�r†t#D ]}tˆ|ƒ�rÎ|} �qì�qÎˆ|ƒ t$| ˆƒ\}}}|�r$t|› d|› �d�}�nX|j%tˆƒj%k�rJtˆˆƒ|d �}�n2ˆ�rng }t||||d�}|j}t&ˆƒ}|d }tˆt'ƒ�rìt(ˆ "¡ ƒ}ˆdk	�r¦t)|ˆƒ}t*|ƒD ]:\} \}}ˆ||d d�}ˆ|ƒ|_| |k|_||ƒ �q®nRt(ˆƒ}!ˆdk	�rt)|!ˆƒ}!t*|!ƒD ],\} }ˆ||d d�}| |k|_||ƒ �qˆdk	�r||ˆk�r||td!|ˆ › �d"d �ƒ nt|g |d#�}ˆ|ƒ ntˆˆƒ|d �}tˆtƒ|_+tˆƒ|_,|S )$zWalk the object depth first.z...)r·   N)Ú	rich_argsr0   c                 s   s‚   | D ]x}t |tƒrvt|ƒdkr>|\}}}||kr2q||fV  q|t|ƒdkr^|\}}||fV  q|t|ƒdkr||d V  q|V  qd S )Né   é   r   r   )rZ   ræ   rÃ   )rñ   ÚargÚkeyrÅ   Údefaultr6   r6   r7   Úiter_rich_argse  s    

z3traverse.<locals>._traverse.<locals>.iter_rich_argsÚ,awehoi234_wdfjwljet234_234wdfoijsdfmmnxpi492Fr±   Úangularú<z...>z(...)rß   ré   )r¸   r¹   r¾   r»   rÀ   r®   r£   )r¸   r¹   r¾   r»   r   )rð   ú=r¯   )r·   r¾   r»   rÁ   c                  3   st   ˆ D ]j} | j rztˆ| jƒ}W n0 tk
rN } z| j|dfV  W 5 d}~X Y qX | j|t| j ƒrf| j ndfV  qdS )z$Iterate over attr fields and values.N)rl   rå   Únamer?   Úcallable)ÚattrrJ   rí   ©Úattr_fieldsr/   r6   r7   Ú
iter_attrsÇ  s     ýz/traverse.<locals>._traverse.<locals>.iter_attrs)r¸   r¹   r¾   r»   rº   c                 s   s   | ]}|j r|V  qd S r‡   )rl   )r–   Úfieldr6   r6   r7   r—   û  s     z.traverse.<locals>._traverse.<locals>.<genexpr>)r¸   r¹   r¾   rº   )r·   r»   z... +T)rº   r¾   r»   )-Úidrµ   r4   r   r   r   r   rÑ   r³   r?   r   r±   rå   ÚlistÚ	__class__rp   Úappendr   rZ   ræ   r»   r¶   r¿   r8   r9   r   r   r
   r@   r	   rü   rç   rH   Ú_asdictÚitemsr²   r°   r:   rÃ   Ú_MAPPING_CONTAINERSÚiterr   Ú	enumerater¼   r½   )"r/   rï   rð   Úobj_idÚobj_typeÚreached_max_depthr÷   Úfake_attributesÚrich_repr_resultrù   ÚargsÚ
class_namer¾   r  rÏ   r»   rô   rõ   rÅ   Ú
child_noder  rü   rJ   Úrepr_callabler  Úcontainer_typer¸   r¹   rº   Ú	num_itemsÚlast_item_indexÚ
iter_itemsÚindexÚiter_values)Ú	_traverserQ   rO   Úpop_visitedÚpush_visitedrî   Úvisited_idsrÿ   r7   r  Y  s~   
$ ÿ


ûü
ýüÿ  ÿÿþýüûÿÿü
ü








ztraverse.<locals>._traverseT)rï   )Fr   )r   rÑ   ÚsetÚaddÚremovers   r�   rµ   )r…   rO   rP   rQ   rÏ   r6   )r  rQ   rO   rP   r  r  rî   r  r7   Útraverse0  s    & |r"  rÎ   r€   rŠ   )r…   r‹   r�   rO   rP   rQ   rR   r0   c          	      C   s4   t | tƒr| }nt| |||d�}|j|||d�}|S )a‡  Prettify repr string by expanding on to new lines to fit within a given width.

    Args:
        _object (Any): Object to repr.
        max_width (int, optional): Desired maximum width of repr string. Defaults to 80.
        indent_size (int, optional): Number of spaces to indent. Defaults to 4.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
            Defaults to None.
        max_depth (int, optional): Maximum depth of nested data structure, or None for no depth.
            Defaults to None.
        expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.

    Returns:
        str: A possibly multi-line representation of the object.
    )rO   rP   rQ   )r‹   r�   rR   )rZ   rµ   r"  rÙ   )	r…   r‹   r�   rO   rP   rQ   rR   rÏ   rØ   r6   r6   r7   rŽ   X  s    
   ÿ  ÿrŽ   T)rK   rN   rO   rP   rQ   rR   )r…   rK   rN   rO   rP   rQ   rR   r0   c             
   C   s6   |dkrt ƒ n|}|jt| |||||dd�dd� dS )aó  A convenience function for pretty printing.

    Args:
        _object (Any): Object to pretty print.
        console (Console, optional): Console instance, or None to use default. Defaults to None.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of strings before truncating, or None to disable. Defaults to None.
        max_depth (int, optional): Maximum depth for nested data structures, or None for unlimited depth. Defaults to None.
        indent_guides (bool, optional): Enable indentation guides. Defaults to True.
        expand_all (bool, optional): Expand all containers. Defaults to False.
    NrI   )rO   rP   rQ   rN   rR   rL   T)Ú	soft_wrap)r   r]   r^   )r…   rK   rN   rO   rP   rQ   rR   Ú_consoler6   r6   r7   rk   €  s    ù	örk   Ú__main__c                   @   s   e Zd Zedœdd„ZdS )Ú
BrokenReprrÁ   c                 C   s   dd  dS )Nr   r   zthis will failr6   rÞ   r6   r6   r7   r:   ¨  s    zBrokenRepr.__repr__N©rp   rq   rr   rÑ   r:   r6   r6   r6   r7   r&  §  s   r&  )Ú
NamedTuplec                   @   s:   e Zd ZU eed< eed< eed< eed< ee ed< dS )ÚStockKeepingUnitrü   ÚdescriptionZpriceÚcategoryZreviewsN)rp   rq   rr   rÑ   rt   Úfloatr   r6   r6   r6   r7   r)  ®  s
   
r)  é   ÚfoozHello World!gZd;ßY@gÁÊ¡E¶3t@g    cAé   é   )r   ró   rò   r€   é   ró   rò   ZcrumbleÚappleZrhubarbÚbutterZsugarZflourZorangeÚpearZkumquatAX  duriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurian)FTNzSparkling British Spring WaterzCarbonated spring watergÍÌÌÌÌÌì?Zwaterzits amazing!zits terrible!)r.  Úbarr   ÚcounterZatomicÚ
namedtupleZBroken)r]   c                   @   s   e Zd Zedœdd„ZdS )ÚThingrÁ   c                 C   s   dS )NzHello[38;5;239m World!r6   rÞ   r6   r6   r7   r:   ß  s    zThing.__repr__Nr'  r6   r6   r6   r7   r8  Þ  s   r8  )NrI   FFNNNF)NrI   FFNNNF)NNN)orf   Úcollectionsr=   rB   Úosr{   r   r   r   r   r   r   r   r	   r
   r   Ú	itertoolsr   Útypesr   Útypingr   r   r   r   r   r   r   r   r   r   r   r   Zpip._vendor.rich.reprr   rþ   r2   r³   r1   ÚImportErrorrV   r   Ú_loopr   Ú_pickr   Úabcr    Úcellsr"   r†   r#   Újupyterr$   r%   Úmeasurer&   rÛ   r'   rK   r(   r)   r*   r+   r,   r-   rs   r8   r9   Úobjectr@   r7  rA   rH   r�   rÑ   ra   r4   rZ   r   r^   r¡   r¥   Ú_EnvironÚdictÚ	frozensetr  r  ræ   r°   rt   Úkeysr²   r	  r´   rµ   rÒ   rç   r"  rŽ   rk   rp   r&  r(  r)  ÚdÚdatar  rv   r]   r8  r6   r6   r6   r7   Ú<module>   s’   8
 
        ÷
ö/ þ        ø÷Oh"             ó(
TC   üû  -ø÷+ø÷%
ú ÿúÿ
ûá!