a
    <Bìj'Ž  ã                   @   sN  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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!m"Z" d d	l#m$Z$ zd dl%Z&e'e&d
ƒZ(W n e)�y   dZ(Y n0 ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< e�r¨ddl=m>Z>m?Z?m@Z@mAZAmBZBmCZC eeDdœdd„ZEeed dœdd„ZFeGeDdœdd„ZHe Idg ¡ZJeGeDdœd d!„ZKdyeed# d$eDeDeeL eeL eeL eDe"eMdf d%œ
d&d'„ZNeGe"eOe!eOd(f f eDd)œd*d+„ZPdzed# d$eDeDeeL eeL eeL eDdd,œ	d-d.„ZQG d/d0„ d0e7ƒZReeef e!eMeMeMf d1œd2d3„ZSee e!eMeMeMf d1œd4d5„ZTd6e!eMeMeMf d1œd7d8„ZUejVd9d:„ eeUeeSed;d:„ eeTeWd<d:„ e	d=d:„ eXd>d:„ eYd?d:„ e
d@d:„ eZdAd:„ e[dBd:„ edCd:„ iZ\eeOeege!eMeMeMf f f e]dD< e[e\ ^¡ ƒZ_eWejVee	fZ`eeDdœdEdF„ZaeG dGdH„ dHƒƒZbeG dIdJ„ dJƒƒZceeDdœdKdL„Zdd{eeeL eeL eeL ebdMœdNdO„ZedPdQdddddRœeeLeLeeL eeL eeL eDeMdSœdTdU„ZfddVdddddWœeed# eDeeL eeL eeL eDddXœdYdZ„Zgehd[k�rJG d\d]„ d]ƒZid d^lmjZj G d_d`„ d`ejƒZkeeLƒZldaeldb< ddcdddedfh dg£geXh dh£ƒeeYdig dj¢iƒeg dk¢ƒdlekdmdndodpdqdrgƒeiƒ dsœZmemdb  nem¡ d dtlompZp epeRemdVdudv�ƒ G dwdx„ dxƒZqepeReqƒ ƒƒ dS )|é    N)Úarray)ÚCounterÚUserDictÚUserListÚdefaultdictÚdeque)Ú	dataclassÚfieldsÚis_dataclass)Úisclass)Úislice)ÚMappingProxyType)ÚTYPE_CHECKINGÚAnyÚCallableÚDefaultDictÚDequeÚDictÚIterableÚListÚOptionalÚSequenceÚSetÚTupleÚUnion)ÚRichReprResultÚ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_moduleZhasÚtype©r1   © r7   úV/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pip/_vendor/rich/pretty.pyÚ_is_attr_object<   s    r9   z_attr_module.Attribute[Any]c                 C   s   t rt t| ƒ¡S g S )zGet fields for an attrs object.)r3   r4   r	   r5   r6   r7   r7   r8   Ú_get_attr_fieldsA   s    r:   c                 C   s2   z| j jjtjtjfv W S  ty,   Y dS 0 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__ÚreprlibÚ	Exceptionr6   r7   r7   r8   Ú_is_dataclass_reprF   s    þrB   Ú_dummy_namedtuplec              	   C   s@   d}zt  | j¡}W n ttfy*   Y n0 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Ú	TypeErrorrC   )r1   Zobj_fileZdefault_repr_filer7   r7   r8   Ú_has_default_namedtuple_repr]   s    	rH   Úignorer*   r.   )
ÚvalueÚconsoleÚoverflowÚcropÚindent_guidesÚ
max_lengthÚ
max_stringÚ	max_depthÚ
expand_allr2   c	                 C   s¨   ddl m}	 t| tƒs| d u r"d S |p*tƒ }| ¡ �V}
t| |	ƒrH| ¡  |jt| tƒrZ| nt	| ||||||dd�|ddd� W d   ƒ n1 s�0    Y  |
 
¡  d¡S )	Nr   )ÚConsoleRenderableé   )rL   rN   rO   rP   rQ   rR   ÚmarginTÚ )rM   Z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   rZ   r7   r7   r8   Ú_ipy_display_hookq   s2    


ÿøï$r`   .)r1   Úclass_or_tupler2   c                 C   s&   zt | |ƒW S  ty    Y dS 0 dS )zFisinstance can fail in rare cases, for example types with no __class__FN)Ú
isinstancerA   )r1   ra   r7   r7   r8   rY   ¡   s    rY   )	rK   rL   rM   rN   rO   rP   rQ   rR   r2   c              	      sª   ddl m‰ ˆ pˆƒ ‰ ˆ dus"J ‚tddœ‡ ‡‡‡‡‡‡‡fdd„}z
tƒ }	W n tyf   |t_Y n@0 ddlm}
 G ‡‡‡‡‡‡‡fdd	„d	|
ƒ}|ƒ }||	j	j
d
< 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   r2   c              
      sR   | durNˆ dusJ ‚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   )ÚbuiltinsÚ_r\   rY   r"   r]   )rJ   )rK   rM   rR   rN   rQ   rO   rP   rL   r7   r8   Údisplay_hookÈ   s$    ÿù
òzinstall.<locals>.display_hook)Ú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Úpprintrc   c              
      s,   | j r t|ˆƒ ˆˆˆˆˆˆ d�S t|ƒS d S )N)rK   rL   rN   rO   rP   rQ   rR   )rh   r`   Úrepr)ÚselfrJ   ©rR   r   rN   rQ   rO   rP   rL   r7   r8   Ú__call__é   s    øz'install.<locals>.RichFormatter.__call__N)Ú__name__Ú
__module__Ú__qualname__rh   ÚboolÚ__annotations__r   rl   r7   rk   r7   r8   ÚRichFormatteræ   s   
rr   z
text/plain)Úpip._vendor.richr   r   Zget_ipythonÚ	NameErrorÚsysÚdisplayhookZIPython.core.formattersrg   Zdisplay_formatterÚ
formatters)rK   rL   rM   rN   rO   rP   rQ   rR   rf   Úiprg   rr   Zrich_formatterr7   )	rK   rM   rR   r   rN   rQ   rO   rP   rL   r8   Úinstall«   s    
"
 ry   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~   r2   c                C   sX   || _ |ptƒ | _|| _|| _|| _|| _|| _|| _|	| _	|
| _
|| _|| _|| _d S ©N)r   r%   r€   r{   r|   rL   r}   rN   rO   rP   rQ   rR   rU   r~   )rj   r   r€   r{   r|   rL   r}   rN   rO   rP   rQ   rR   rU   r~   r7   r7   r8   Ú__init__  s    zPretty.__init__r*   r+   r/   )rK   Úoptionsr2   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|v 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.indentrX   rV   )Úpretty_reprr   r…   rU   r{   rO   rP   rQ   rR   r)   Z	from_ansir|   rL   r!   r}   r€   r5   rN   Z
ascii_onlyZwith_indent_guidesr~   )rj   rK   rƒ   Ú
pretty_strZpretty_textr7   r7   r8   Ú__rich_console__0  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[   r7   r7   r8   Ú	<genexpr>`  ó    z*Pretty.__rich_measure__.<locals>.<genexpr>r   )rˆ   r   r…   r{   rO   rP   rQ   rR   ÚmaxÚ
splitlinesr(   )rj   rK   rƒ   r‰   Ú
text_widthr7   r7   r8   Ú__rich_measure__S  s    ù
ÿzPretty.__rich_measure__)N)rm   rn   ro   Ú__doc__r   r   Úintrp   r‚   rŠ   r’   r7   r7   r7   r8   r]   ý   sH    ýñð þ$þr]   )r   r2   c                 C   s   d| j ›d�dd| j ›d�fS )Nzdefaultdict(z, {ú})z, {}))Údefault_factory©r   r7   r7   r8   Ú_get_braces_for_defaultdicte  s    ýr˜   c                 C   s,   | j d u rdS dd| j › d�d| j › d�fS )N)údeque([ú])zdeque()r™   z
], maxlen=ú)zdeque(maxlen=)Úmaxlenr—   r7   r7   r8   Ú_get_braces_for_dequem  s    
ýr�   z
array[Any]c                 C   s   d| j ›d�dd| j ›d�fS )Nzarray(z, [rš   r›   )Útypecoder—   r7   r7   r8   Ú_get_braces_for_arrayw  s    rŸ   c                 C   s   dS )N)z	environ({r•   zenviron({})r7   r—   r7   r7   r8   Ú<lambda>|  rŽ   r    c                 C   s   dS )N)z	Counter({r•   z	Counter()r7   r—   r7   r7   r8   r      rŽ   c                 C   s   dS ©N)Ú{Ú}z{}r7   r—   r7   r7   r8   r    �  rŽ   c                 C   s   dS r¡   r7   r—   r7   r7   r8   r    ‚  rŽ   c                 C   s   dS )N)zfrozenset({r•   zfrozenset()r7   r—   r7   r7   r8   r    ƒ  rŽ   c                 C   s   dS ©N)ú[ú]z[]r7   r—   r7   r7   r8   r    „  rŽ   c                 C   s   dS r¤   r7   r—   r7   r7   r8   r    …  rŽ   c                 C   s   dS )N)r¢   r£   zset()r7   r—   r7   r7   r8   r    †  rŽ   c                 C   s   dS )N)ú(r›   ú()r7   r—   r7   r7   r8   r    ‡  rŽ   c                 C   s   dS )N)zmappingproxy({r•   zmappingproxy({})r7   r—   r7   r7   r8   r    ˆ  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__)rY   Ú_CONTAINERSr
   Úhasattrr9   r   r6   r7   r7   r8   Úis_expandableŽ  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©r2   c                 c   s²   | j r| j V  | jV  | jr&| jV  nˆ| jdu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³   )rj   Úchildr7   r7   r8   r½   ¨  s"    




zNode.iter_tokens)Ústart_lengthrO   r2   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$   )rj   r¿   rO   Útotal_lengthÚtokenr7   r7   r8   Úcheck_length¾  s    
zNode.check_lengthc                 C   s   d  |  ¡ ¡}|S ©NrV   )Újoinr½   )rj   Z	repr_textr7   r7   r8   Ú__str__Ï  s    zNode.__str__éP   rz   )r…   r{   rR   r2   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   rX   c                 s   s   | ]}t |ƒV  qd S r�   )Ústrr‹   r7   r7   r8   r�   é  rŽ   zNode.render.<locals>.<genexpr>)Ú_Liner¼   Ú
expandableÚexpandedrÂ   ÚexpandrÄ   )rj   r…   r{   rR   ÚlinesÚline_nor[   Úrepr_strr7   r7   r8   ÚrenderÓ  s    
zNode.render)rÆ   rz   F)rm   rn   ro   r“   r¯   rÉ   rq   r°   r±   r²   r³   r´   rp   rµ   r¶   r·   r   r   r¸   r¹   r   r½   r”   rÂ   rÅ   rÑ   r7   r7   r7   r8   r®   ˜  s(   
 ÿþ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uo| jjƒS )z"Check if the line may be expanded.N)rp   rÇ   r·   ©rj   r7   r7   r8   rË   ú  s    z_Line.expandable)rO   r2   c                 C   s:   t | jƒt| jƒ t| jƒ }| jdus,J ‚| j ||¡S )z4Check this line fits within a given number of cells.N)r¼   rÕ   r$   rÓ   rÔ   rÇ   rÂ   )rj   rO   r¿   r7   r7   r8   rÂ   ÿ  s    ÿz_Line.check_length)r{   r2   c                 c   sØ   | j }|dusJ ‚| j}|js"J ‚|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Ç   rÕ   r·   r¯   rÊ   r¸   r±   rµ   r¼   r    r¹   r²   rÔ   r´   )rj   r{   rÇ   rÕ   Únew_lineZchild_whitespaceZtuple_of_oner´   r¾   r¹   r[   r7   r7   r8   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Ö   r7   r7   r8   rÅ   (  s    "ÿz_Line.__str__)rm   rn   ro   r“   rÒ   r   rq   rÈ   rp   rÇ   r®   rÓ   rÉ   rÔ   rÕ   rÌ   r´   ÚpropertyrË   r”   rÂ   r   rÍ   rÅ   r7   r7   r7   r8   rÊ   í  s   
!rÊ   c                 C   s:   zt | ddƒ}W n ty$   Y dS 0 t| tƒo8t|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)ÚgetattrrA   rb   Útuple)r1   r	   r7   r7   r8   Ú_is_namedtuple1  s
    rÝ   )r   rO   rP   rQ   r2   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.
    r0   c              
      sŒ   ˆ durFt | ttfƒrFt| ƒˆ krFt| ƒˆ  }| dˆ … ›d|› �}nBzt| ƒ}W n4 ty† } zdt|ƒ›d�}W Y d}~n
d}~0 0 |S )z0Get repr string for an object, but catch errors.Nú+z<repr-error ú>)rY   ÚbytesrÉ   r¼   ri   rA   )r1   Z	truncatedÚobj_reprÚerror)rP   r7   r8   Úto_reprY  s    ÿþ
ý&ztraverse.<locals>.to_reprFr   )r1   ÚrootÚdepthr2   c           "         s²  t ˆƒ}|ˆv rtdd�S tˆƒ}ˆduo0|ˆk}tttttttf f  dœdd„}ztˆdƒ}W n t	yz   d}Y n0 d}|s¶ztˆd	ƒr t
ˆƒs ˆ ¡ }W n t	y´   Y n0 |du�r
ˆ|ƒ tˆjd
dƒ}	t||ƒƒ}
ˆjj}|
�rØg }|j}|�r,|	�rtd|› d�d�}nt|› d�d�}nª|	�rNtd|› d�d||dd�}nt|› d�d||d�}t|
ƒD ]h\}}t|tƒ�r´|\}}ˆ||d d�}||_||_d|_||ƒ nˆ||d d�}||_||ƒ �qln&t|	�rìd|› d�n|› d�g |d�}ˆ|ƒ �nŒtˆƒ�r&|�s&ˆ|ƒ g }|j}tˆƒ‰ ˆ �r|�rVtˆ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�}ˆ|ƒ �nptˆƒ�rtˆtƒ�s|�stˆƒ�rˆ|ƒ g }|j}|�rztˆjj› d�d�}n€tˆjj› d�d||ˆjj› d�d�}t‡f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u�r¦t)|ˆƒ}t*|ƒD ]:\} \}}ˆ||d d�}ˆ|ƒ|_| |k|_||ƒ �q®nRt(ˆƒ}!ˆdu�rt)|!ˆƒ}!t*|!ƒD ],\} }ˆ||d d�}| |k|_||ƒ �qˆdu�r||ˆk�r||td!|ˆ › �d"d �ƒ nt|g |d#�}ˆ|ƒ ntˆˆƒ|d �}tˆƒtk|_+tˆƒ|_,|S )$zWalk the object depth first.z...)r°   N)Ú	rich_argsr2   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   )rY   rÜ   r¼   )ræ   ÚargÚkeyr¾   Údefaultr7   r7   r8   Úiter_rich_argsy  s    

z3traverse.<locals>._traverse.<locals>.iter_rich_argsZ,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   sv   ˆ D ]l} | j rztˆ| jƒ}W n2 tyP } z| j|dfV  W Y d}~qd}~0 0 | j|t| j ƒrh| j ndfV  qdS )z$Iterate over attr fields and values.N)ri   rÛ   ÚnamerA   Úcallable)ÚattrrJ   râ   ©Zattr_fieldsr1   r7   r8   Ú
iter_attrsÛ  s    $ýz/traverse.<locals>._traverse.<locals>.iter_attrs)r±   r²   r·   r´   r³   c                 3   s$   | ]}|j rtˆ |jƒr|V  qd S r�   )ri   r¬   rð   )rŒ   Úfieldr6   r7   r8   r�     s   þz.traverse.<locals>._traverse.<locals>.<genexpr>)r±   r²   r·   r³   )r°   r´   z... +T)r³   r·   r´   )-Úidr®   r5   r   r   r   r   rÉ   r¬   rA   r   rª   rÛ   ÚlistÚ	__class__rm   Úappendr    rY   rÜ   r´   r¯   r¸   r9   r:   r   r   r
   rB   r	   rð   rÝ   rH   Ú_asdictÚitemsr«   r©   r;   r¼   Ú_MAPPING_CONTAINERSÚiterr   Ú	enumeraterµ   r¶   )"r1   rä   rå   Zobj_idZobj_typeZreached_max_depthrì   Zfake_attributesZrich_repr_resultrí   ÚargsÚ
class_namer·   rù   rÇ   r´   ré   rê   r¾   Z
child_noderô   rð   rJ   Zrepr_callablerõ   Zcontainer_typer±   r²   r³   Z	num_itemsZlast_item_indexZ
iter_itemsÚindexZiter_values)Ú	_traverserQ   rO   Úpop_visitedÚpush_visitedrã   Úvisited_idsró   r8   r  m  sv   
$ÿ


ûü
ýüÿÿÿþýüûþÿü
ü








ztraverse.<locals>._traverseT)rä   )Fr   )r   rÉ   ÚsetÚaddÚremoverp   r”   r®   )r   rO   rP   rQ   rÇ   r7   )r  rQ   rO   rP   r  r  rã   r  r8   ÚtraverseD  s    & ~r	  rÆ   rz   r„   )r   r…   r{   rO   rP   rQ   rR   r2   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   )rY   r®   r	  rÑ   )	r   r…   r{   rO   rP   rQ   rR   rÇ   rÐ   r7   r7   r8   rˆ   n  s    
ÿÿrˆ   T)rK   rN   rO   rP   rQ   rR   )r   rK   rN   rO   rP   rQ   rR   r2   c             
   C   s6   |du 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)Z	soft_wrap)r   r\   r]   )r   rK   rN   rO   rP   rQ   rR   Z_consoler7   r7   r8   rh   –  s    ù	örh   Ú__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 failr7   rÖ   r7   r7   r8   r;   ¾  s    zBrokenRepr.__repr__N©rm   rn   ro   rÉ   r;   r7   r7   r7   r8   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)rm   rn   ro   rÉ   rq   Úfloatr   r7   r7   r7   r8   r  Ä  s
   
r  é   ÚfoozHello World!gZd;ßY@gÁÊ¡E¶3t@g    cA>   r  é   é   é   )r   rè   rç   rz   >   r   rè   rç   Zcrumble)ÚappleZrhubarbZbutterZsugarZflour)r  ZorangeZpearÚkumquatr  AX  duriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurian)FTNzSparkling British Spring WaterzCarbonated spring watergÍÌÌÌÌÌì?Zwaterzits amazing!zits terrible!)r  Úbarr   ÚcounterZatomicÚ
namedtupleZBroken)r\   é   )rN   rP   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!r7   rÖ   r7   r7   r8   r;   õ  s    zThing.__repr__Nr  r7   r7   r7   r8   r  ô  s   r  )NrI   FFNNNF)NrI   FFNNNF)NNN)rrd   Úcollectionsr>   rD   Úosr@   ru   r   r   r   r   r   r   r   r	   r
   r   Ú	itertoolsr   Útypesr   Útypingr   r   r   r   r   r   r   r   r   r   r   r   r   Zpip._vendor.rich.reprr   rò   r4   r¬   r3   ÚImportErrorrV   r   Z_loopr    Z_pickr!   Úabcr"   Úcellsr$   r€   r%   Zjupyterr&   r'   Zmeasurer(   rÓ   r)   rK   r*   r+   r,   r-   r.   r/   rp   r9   r:   ÚobjectrB   r  rC   rH   r”   rÉ   r`   r5   rY   ry   r]   r˜   r�   rŸ   Ú_EnvironÚdictÚ	frozensetr÷   r  rÜ   r©   rq   Úkeysr«   rü   r­   r®   rÊ   rÝ   r	  rˆ   rh   rm   r  r  r  ÚdÚdatarù   rs   r\   r  r7   r7   r7   r8   Ú<module>   sl  
<
 
        ÷
ö1þ        ø÷Rh"

ó(
TC   üû  /ø÷+ø÷%
ú
ÿÿ
ûá!