o
    Ú­jý�  ã                   @   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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w 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 dedeDfdd„ZEdeded fdd„ZFdeGdeDfdd„ZHe Id g ¡ZJdeGdeDfd!d"„ZK		#						d€d$ed%ed& d'd(d)eDd*eDd+eeL d,eeL d-eeL d.eDde"eMdf fd/d0„ZNdeGd1e"eOe!eOd2f f deDfd3d4„ZP		#						d€d%ed& d'd(d)eDd*eDd+eeL d,eeL d-eeL d.eDddfd5d6„ZQG d7d8„ d8e7ƒZRd9eeef de!eMeMeMf fd:d;„ZSd9ee de!eMeMeMf fd<d=„ZTd9d>de!eMeMeMf fd?d@„ZUejVdAdB„ eeUeeSedCdB„ eeTeWdDdB„ e	dEdB„ eXdFdB„ eYdGdB„ e
dHdB„ eZdIdB„ e[dJdB„ edKdB„ iZ\eeOeege!eMeMeMf f f e]dL< e[e\ ^¡ ƒZ_eWejVee	fZ`dedeDfdMdN„ZaeG dOdP„ dPƒƒZbeG dQdR„ dRƒƒZcdedeDfdSdT„Zd			d�d9ed+eeL d,eeL d-eeL debf
dUdV„ZedWdXdddddYœd9edZeLd[eLd+eeL d,eeL d-eeL d.eDdeMfd\d]„Zfdd^ddddd_œd9ed%ed& d*eDd+eeL d,eeL d-eeL d.eDddfd`da„Zgehdbk�ræG dcdd„ ddƒZid delmjZj G dfdg„ dgejƒZkeeLƒZldheldi< ddjdkdldmh dn£geXh do£ƒeeYdpg dq¢iƒeg dr¢ƒdsekdtdudvdwdxdygƒeiƒ dzœZmemdi  nem¡ d d{lompZp epeRemd^d|d}�ƒ G d~d„ dƒZqepeReqƒ ƒƒ dS 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_moduleÚhasÚtype©r0   © r7   úH/var/www/html/CropPilot/venv/lib/python3.10/site-packages/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.)r2   r3   r	   r5   r6   r7   r7   r8   Ú_get_attr_fieldsA   s   r:   c                 C   s.   z| j jjtjtjfv W S  ty   Y dS w )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.
    F)Ú__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w 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   )r0   Úobj_fileÚdefault_repr_filer7   r7   r8   Ú_has_default_namedtuple_repr]   s   	ýrJ   ÚignoreÚvalueÚconsoler*   Úoverflowr.   ÚcropÚindent_guidesÚ
max_lengthÚ
max_stringÚ	max_depthÚ
expand_allc	                 C   s¨   ddl m}	 t| tƒs| d u rd S |ptƒ }| ¡ �+}
t| |	ƒr$| ¡  |jt| tƒr-| nt	| ||||||dd�|ddd� W d   ƒ n1 sHw   Y  |
 
¡  d¡S )	Nr   )ÚConsoleRenderableé   )rN   rP   rQ   rR   rS   rT   ÚmarginTÚ )rO   Únew_line_startÚendÚ
)rM   rU   Ú_safe_isinstancer'   r   ÚcaptureÚlineÚprintr"   ÚPrettyÚgetÚrstrip)rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   r]   r7   r7   r8   Ú_ipy_display_hookq   s4   


ÿøïürc   Úclass_or_tuple.c                 C   s"   zt | |ƒW S  ty   Y dS w )zFisinstance can fail in rare cases, for example types with no __class__F)Ú
isinstancerA   )r0   rd   r7   r7   r8   r\   ¡   s
   ÿr\   c              	      s®   ddl m} ˆ p
|ƒ ‰ ˆ dusJ ‚dtddf‡ ‡‡‡‡‡‡‡fdd„}	ztƒ }
W n ty5   |	t_Y dS w 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   NrL   r1   c              
      sV   | dur)ˆ dus
J ‚dt _ˆ jt| tƒr| n
t| ˆˆˆˆˆˆd�ˆd� | t _dS dS )z?Replacement sys.displayhook which prettifies objects with Rich.N)rN   rP   rQ   rR   rS   rT   )rO   )ÚbuiltinsÚ_r_   r\   r"   r`   )rL   ©rM   rO   rT   rP   rS   rQ   rR   rN   r7   r8   Údisplay_hookÈ   s&   ÿù
ò
ízinstall.<locals>.display_hook)ÚBaseFormatterc                       s<   e Zd ZU dZeed< dedef‡ ‡‡‡‡‡‡fdd„ZdS )zinstall.<locals>.RichFormatterTÚpprintrL   r1   c              
      s&   | j rt|ˆ ˆˆˆˆˆˆd�S t|ƒS )N)rM   rN   rP   rQ   rR   rS   rT   )rk   rc   Úrepr)ÚselfrL   ©rM   rT   rP   rS   rQ   rR   rN   r7   r8   Ú__call__é   s   øz'install.<locals>.RichFormatter.__call__N)Ú__name__Ú
__module__Ú__qualname__rk   ÚboolÚ__annotations__r   ro   r7   rn   r7   r8   ÚRichFormatteræ   s   
 &ru   z
text/plain)Úrichr   r   Úget_ipythonÚ	NameErrorÚsysÚdisplayhookÚIPython.core.formattersrj   Údisplay_formatterÚ
formatters)rM   rN   rO   rP   rQ   rR   rS   rT   r   ri   Úiprj   ru   Úrich_formatterr7   rh   r8   Úinstall«   s   
$
ÿ r€   c                   @   s¸   e Zd ZdZ	d$ddddddddddddœdeded	 d
eded ded dee dedee dee dee dedededdfdd„Z						d%dd „Z							!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ÚjustifyrN   Úno_wraprP   rQ   rR   rS   rT   rW   Úinsert_lineÚ_objectÚhighlighterr,   r‚   rƒ   r-   rN   r.   r„   rP   rQ   rR   rS   rT   rW   r…   r1   c                C   sX   || _ |ptƒ | _|| _|| _|| _|| _|| _|| _|	| _	|
| _
|| _|| _|| _d S ©N)r†   r%   r‡   r‚   rƒ   rN   r„   rP   rQ   rR   rS   rT   rW   r…   )rm   r†   r‡   r‚   rƒ   rN   r„   rP   rQ   rR   rS   rT   rW   r…   r7   r7   r8   Ú__init__  s   
zPretty.__init__rM   r*   Úoptionsr+   r/   c              	   c   sº   � t | j|j| j | j| j| j| j| jd�}t	j
|| jp|j| jp#|jt| j|jƒdd�}|r4|  |¡nt	t| jƒ› d�dd�}| jrN|jsN|j| jdd�}| jrXd|v rXd	V  |V  d S )
N©Ú	max_widthr‚   rQ   rR   rS   rT   Úpretty)rƒ   rN   r„   Ústylez.__repr__ returned empty stringz
dim italic)rŽ   zrepr.indentr[   rX   )Úpretty_reprr†   rŒ   rW   r‚   rQ   rR   rS   rT   r)   Ú	from_ansirƒ   rN   r!   r„   r‡   r5   rP   Ú
ascii_onlyÚwith_indent_guidesr…   )rm   rM   rŠ   Ú
pretty_strÚ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   ó   � | ]}t |ƒV  qd S rˆ   r#   ©Ú.0r^   r7   r7   r8   Ú	<genexpr>`  ó   € z*Pretty.__rich_measure__.<locals>.<genexpr>r   )r�   r†   rŒ   r‚   rQ   rR   rS   rT   ÚmaxÚ
splitlinesr(   )rm   rM   rŠ   r“   Ú
text_widthr7   r7   r8   Ú__rich_measure__S  s   ù
ÿ
zPretty.__rich_measure__rˆ   )rM   r*   rŠ   r+   r1   r/   )rM   r*   rŠ   r+   r1   r(   )rp   rq   rr   Ú__doc__r   r   Úintrs   r‰   r•   rž   r7   r7   r7   r8   r`   ý   st    ýñþýûúùø	÷
öõôóòñ
ðÿÿ
þ#ÿÿþr`   r†   c                 C   ó   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   r¡   )Nzarray(z, [r§   r¨   )Útypecoder¤   r7   r7   r8   Ú_get_braces_for_arrayw  s   r¬   c                 C   ó   dS )N)z	environ({r¢   zenviron({})r7   r¤   r7   r7   r8   Ú<lambda>|  ó    r®   c                 C   r­   )N)z	Counter({r¢   z	Counter()r7   r¤   r7   r7   r8   r®     r¯   c                 C   r­   ©N)Ú{Ú}z{}r7   r¤   r7   r7   r8   r®   �  r¯   c                 C   r­   r°   r7   r¤   r7   r7   r8   r®   ‚  r¯   c                 C   r­   )N)zfrozenset({r¢   zfrozenset()r7   r¤   r7   r7   r8   r®   ƒ  r¯   c                 C   r­   ©N)ú[ú]z[]r7   r¤   r7   r7   r8   r®   „  r¯   c                 C   r­   r³   r7   r¤   r7   r7   r8   r®   …  r¯   c                 C   r­   )N)r±   r²   zset()r7   r¤   r7   r7   r8   r®   †  r¯   c                 C   r­   )N)ú(r¨   ú()r7   r¤   r7   r7   r8   r®   ‡  r¯   c                 C   r­   )N)zmappingproxy({r¢   zmappingproxy({})r7   r¤   r7   r7   r8   r®   ˆ  r¯   Ú_BRACESc                 C   s.   t | tƒpt| ƒpt| dƒpt| ƒot| ƒ S )z3Check if an object may be expanded by pretty print.Ú__rich_repr__)r\   Ú_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< dee fdd„Zdededefdd„Zdefdd„Z	d"dedededefd d!„ZdS )#ÚNodez4A node in a repr tree. May be atomic or a container.rX   Úkey_reprÚ
value_reprÚ
open_braceÚclose_braceÚemptyFÚlastÚis_tupleÚis_namedtupleNÚchildrenz: Úkey_separatorz, Ú	separatorr1   c                 c   s¼   � | j r| j V  | jV  | jr| jV  dS | jdur\| jrV| jV  | jr<| js<t| jƒdkr<| jd  ¡ E dH  dV  n| jD ]}| ¡ E dH  |j	sO| j
V  q?| jV  dS | jV  dS dS )zGenerate tokens for this node.Nr   r   ú,)r¾   rÇ   r¿   rÆ   rÀ   rÄ   rÅ   ÚlenÚiter_tokensrÃ   rÈ   rÁ   rÂ   )rm   Úchildr7   r7   r8   rË   ¨  s(   €

€ózNode.iter_tokensÚstart_lengthrQ   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Í   rQ   Útotal_lengthÚtokenr7   r7   r8   Úcheck_length¾  s   
ÿzNode.check_lengthc                 C   s   d  |  ¡ ¡}|S ©NrX   )ÚjoinrË   )rm   Ú	repr_textr7   r7   r8   Ú__str__Ï  s   zNode.__str__éP   r�   rŒ   r‚   rT   c                 C   s‚   t | dd�g}d}|t|ƒk r5|| }|jr+|js+|s | |¡s+| |¡|||d …< |d7 }|t|ƒk s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   r[   c                 s   r–   rˆ   )Ústrr—   r7   r7   r8   r™   é  rš   zNode.render.<locals>.<genexpr>)Ú_LinerÊ   Ú
expandableÚexpandedrÐ   ÚexpandrÒ   )rm   rŒ   r‚   rT   ÚlinesÚline_nor^   Úrepr_strr7   r7   r8   Ú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à   r7   r7   r7   r8   r½   ˜  s4   
 ÿÿÿÿþ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defdd„ƒZdedefdd„Zdeded  fdd„Zdefdd„ZdS )rÙ   zA line in repr output.NÚparentFr×   rÖ   rX   ÚtextÚsuffixÚ
whitespacerÛ   rÃ   r1   c                 C   s   t | jduo	| jjƒS )z"Check if the line may be expanded.N)rs   rÖ   rÆ   ©rm   r7   r7   r8   rÚ   ú  s   z_Line.expandablerQ   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Ð   )rm   rQ   rÍ   r7   r7   r8   rÐ   ÿ  s   ÿz_Line.check_lengthr‚   c                 c   sÚ   � | j }|dus
J ‚| j}|jsJ ‚|jr&t|j› |j› |j› �|d�V }nt|j|d�V }| jd|  }|jo>t|jƒdk}t	|jƒD ]\}}|rLdn|j
}	t||||	|oX| d�}
|
V  qDt|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Ã   )rm   r‚   rÖ   rä   Únew_lineÚchild_whitespaceÚtuple_of_onerÃ   rÌ   rÈ   r^   r7   r7   r8   rÜ     s:   €

þûüz_Line.expandc                 C   sD   | j r| j› | j› | jpd› �S | j› | j› | jpd› | j ¡ › �S rÑ   )rÃ   rä   râ   rÖ   rã   rb   rå   r7   r7   r8   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Ô   r7   r7   r7   r8   rÙ   í  s   
 !rÙ   c                 C   s:   zt | ddƒ}W n
 ty   Y dS w 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)ÚgetattrrA   re   Útuple)r0   r	   r7   r7   r8   Ú_is_namedtuple1  s   þrî   c              	      sd   dt dtf‡fdd„‰tƒ ‰ˆj‰ˆj‰ddt dtdtdtf‡ ‡‡‡‡‡‡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   r1   c              
      sŽ   ˆ dur$t | ttfƒr$t| ƒˆ kr$t| ƒˆ  }| dˆ … ›d|› �}|S zt| ƒ}W |S  tyF } zdt|ƒ›d�}W Y d}~|S d}~ww )z0Get repr string for an object, but catch errors.Nú+z<repr-error ú>)r\   ÚbytesrØ   rÊ   rl   rA   )r0   Ú	truncatedÚobj_reprÚerror)rR   r7   r8   Úto_reprY  s   ÿü
þ€þztraverse.<locals>.to_reprFr   ÚrootÚdepthc           "   	      sœ  t ˆƒ}|ˆv rtdd�S tˆƒ}ˆduo|ˆk}dtdttttttf f  fdd„}ztˆdƒ}W n t	y>   d	}Y nw d}|s\ztˆd
ƒrQt
ˆƒsQˆ ¡ }W n	 t	y[   Y nw |durþˆ|ƒ tˆjdd	ƒ}	t||ƒƒ}
ˆjj}|
ræg }|j}|r“|	rŠtd|› d�d�}nnt|› d�d�}ne|	r£td|› d�d||dd�}nt|› d�d||d�}t|
ƒD ]2\}}t|tƒrÕ|\}}ˆ||d d�}||_||_d|_||ƒ q²ˆ||d d�}||_||ƒ q²nt|	rïd|› d�n|› d�g |d�}ˆ|ƒ �nBtˆƒ�rŒ|�sŒˆ|ƒ g }|j}tˆƒ‰ ˆ �rz|�r$tˆjj› d�d�}nbtˆjj› d�d||d�}dtttttttgtf  f  f‡ ‡fdd„}t|ƒ ƒD ]*\}\}}}|�rbtt||ƒƒd�}nˆ||d d�}||_||_d|_||ƒ �qNntˆjj› d�g |d�}ˆ|ƒ �n´tˆƒ�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‡fdd„tˆƒD ƒƒD ]\}}ˆtˆ|jƒ|d d�}|j|_||_d|_||ƒ �qÖˆ|ƒ �nDtˆƒ�rWt ˆƒ�rWˆ|ƒ ˆjj}|�rt|› d�d�}n8g }|j}t|› d�d||› d�d�}tˆ !¡  "¡ ƒD ]\}\}}ˆ||d d�}||_||_d|_||ƒ �q5ˆ|ƒ nétˆt#ƒ�r8t#D ]}tˆ|ƒ�rk|} n�q_ˆ|ƒ t$| ˆƒ\}}}|�rˆt|› d|› �d�}n«|j%tˆƒj%k�rštˆˆƒ|d �}n™ˆ�r,g }t||||d�}|j}t&ˆƒ}|d }tˆt'ƒ�rët(ˆ "¡ ƒ}ˆdu�rÈt)|ˆƒ}t*|ƒD ]\} \}}ˆ||d d�}ˆ|ƒ|_| |k|_||ƒ �qÌn)t(ˆƒ}!ˆ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_argsr1   c                 s   s„   � | D ]<}t |tƒr<t|ƒdkr |\}}}||krq||fV  qt|ƒdkr0|\}}||fV  qt|ƒdkr;|d V  q|V  qd S )Né   é   r   r   )r\   rí   rÊ   )rø   ÚargÚkeyrÌ   Údefaultr7   r7   r8   Úiter_rich_argsy  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Ã   c                  3   sx   � ˆ D ]6} | j r9ztˆ| jƒ}W n ty) } z| j|dfV  W Y d}~qd}~ww | j|t| j ƒr5| j ndfV  qdS )z$Iterate over attr fields and values.N)rl   rì   ÚnamerA   Úcallable)ÚattrrL   rô   ©Úattr_fieldsr0   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ˆ   )rl   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__rp   Úappendr    r\   rí   rÃ   r¾   rÇ   r9   r:   r   r   r
   rB   r	   r  rî   rJ   Ú_asdictÚitemsrº   r¸   r;   rÊ   Ú_MAPPING_CONTAINERSÚiterr   Ú	enumeraterÄ   rÅ   )"r0   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  rL   Úrepr_callabler	  Úcontainer_typerÀ   rÁ   rÂ   Ú	num_itemsÚlast_item_indexÚ
iter_itemsÚindexÚiter_values)Ú	_traverserS   rQ   Úpop_visitedÚpush_visitedrõ   Úvisited_idsr  r8   r"  m  sˆ  
&ÿÿ€ÿ
ûü


õýüÿø
ÿÿþýüûþÿü
þü



ü


€

ztraverse.<locals>._traverseT)rö   N)Fr   )r   rØ   ÚsetÚaddÚremovers   r    r½   )r†   rQ   rR   rS   rÖ   r7   )r"  rS   rQ   rR   r#  r$  rõ   r%  r8   ÚtraverseD  s   , ~r)  rÕ   r�   r‹   rŒ   r‚   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.
    )rQ   rR   rS   )rŒ   r‚   rT   )r\   r½   r)  rà   )	r†   rŒ   r‚   rQ   rR   rS   rT   rÖ   rß   r7   r7   r8   r�   n  s   
ÿÿr�   T)rM   rP   rQ   rR   rS   rT   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.
    NrK   )rQ   rR   rS   rP   rT   rN   T)Ú	soft_wrap)r   r_   r`   )r†   rM   rP   rQ   rR   rS   rT   Ú_consoler7   r7   r8   rk   –  s   ù	
örk   Ú__main__c                   @   ó   e Zd Zdefdd„ZdS )Ú
BrokenReprr1   c                 C   s   dd  dS )Nr   r   zthis will failr7   rå   r7   r7   r8   r;   ¾  s   zBrokenRepr.__repr__N©rp   rq   rr   rØ   r;   r7   r7   r7   r8   r.  ½  ó    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  ÚdescriptionÚpriceÚcategoryÚreviewsN)rp   rq   rr   rØ   rt   Úfloatr   r7   r7   r7   r8   r2  Ä  s   
 r2  é   ÚfoozHello World!gZd;ßY@gÁÊ¡E¶3t@g    cA>   ©r   rú   rù   r�   r8  é   é   é   >   r   rú   rù   Úcrumble)ÚappleÚrhubarbÚbutterÚsugarÚflour)r?  ÚorangeÚpearÚkumquatrF  ÁX  duriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurian)FTNzSparkling British Spring WaterzCarbonated spring watergÍÌÌÌÌÌì?Úwaterzits amazing!zits terrible!)r9  Úbarr   ÚcounterÚatomicÚ
namedtupleÚBroken)r_   é   )rP   rR   c                   @   r-  )ÚThingr1   c                 C   r­   )NzHello[38;5;239m World!r7   rå   r7   r7   r8   r;   õ  s   zThing.__repr__Nr/  r7   r7   r7   r8   rO  ô  r0  rO  )NrK   FFNNNF)NNN)rrf   Úcollectionsr>   rD   Úosr@   ry   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   Ú	rich.reprr   r  r3   r»   r2   ÚImportErrorrX   r   Ú_loopr    Ú_pickr!   Úabcr"   Úcellsr$   r‡   r%   Újupyterr&   r'   Úmeasurer(   râ   r)   rM   r*   r+   r,   r-   r.   r/   rs   r9   r:   ÚobjectrB   rL  rC   rJ   r    rØ   rc   r5   r\   r€   r`   r¥   rª   r¬   Ú_EnvironÚdictÚ	frozensetr  r&  rí   r¸   rt   Úkeysrº   r  r¼   r½   rÙ   rî   r)  r�   rk   rp   r.  r1  r2  ÚdÚdatar  rv   r_   rO  r7   r7   r7   r8   Ú<module>   sÀ  
 <ÿ 
÷ÿþýüûúùø	÷


ö0ÿÿ
þøÿþýüûúùø	
÷R$h 

(ó
TCüÿþýü
û  /øÿýüûúùø	
÷+øÿýüûúùø	
÷
%ú
ÿÿ
ûá!Ã