HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_vendor/rich/__pycache__/pretty.cpython-310.pyc
o

@%Ne<�@s�UddlZddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZddlm
Z
mZmZddlmZddlmZddlmZddlmZmZmZmZmZmZmZmZmZmZm Z dd	l!m"Z"zddl#Z$Wne%yzdZ$Ynwd
dl&m'Z'd
dl(m)Z)d
d
l*m+Z+d
dl,m-Z-d
dl.m/Z/d
dl0m1Z1d
dl2m3Z3m4Z4d
dl5m6Z6d
dl7m8Z8er�d
dl9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?dede@fdd�ZAdededfdd�ZBdeCde@fdd�ZD							djd ed!ed"d#d$d%e@d&e@d'eeEd(eeEd)e@ddfd*d+�ZF							djd!ed"d#d$d%e@d&e@d'eeEd(eeEd)e@ddfd,d-�ZGGd.d/�d/e3�ZHd0eeefdeeIeIeIffd1d2�ZJd0d3deeIeIeIffd4d5�ZKejLd6d7�eeKeeJed8d7�ed9d7�eMd:d7�e	d;d7�eNd<d7�eOd=d7�e
d>d7�ePd?d7�eQd@d7�edAd7�i
ZReeSeegeeIeIeIfffeTdB<eQeR�U��ZVeMejLee	fZWdede@fdCdD�ZXe
GdEdF�dF��ZYe
GdGdH�dH��ZZ			dkd0ed'eeEd(eeEdIeeEdeYf
dJdK�Z[dLdMdddddN�d0edOeEdPeEd'eeEd(eeEdIeeEd)e@deIfdQdR�Z\ddSdddddT�d0ed!ed"d&e@d'eeEd(eeEdIeeEd)e@ddfdUdV�Z]e^dWk�rmGdXdY�dY�Z_eeE�Z`dZe`d[<d
d\d]d^d_hd`�geNhda��eeOdbgdc�i�egdd��dee_�df�Zaead[�bea�ddglcmdZdedeHeadSdhdi��dSdS)l�N)�array)�Counter�UserDict�UserList�defaultdict�deque)�	dataclass�fields�is_dataclass)�isclass)�islice)�MappingProxyType)�
TYPE_CHECKING�Any�Callable�DefaultDict�Dict�Iterable�List�Optional�Set�Tuple�Union)�RichReprResult���get_console)�	loop_last)�	pick_bool)�RichRenderable��cell_len)�ReprHighlighter)�JupyterMixin�JupyterRenderable)�Measurement)�Text)�Console�ConsoleOptions�HighlighterType�
JustifyMethod�OverflowMethod�RenderResult�obj�returncCstduo
t�t|��S)z1Check if an object was created with attrs module.N)�_attr_module�has�type�r-�r3�9/usr/lib/python3/dist-packages/pip/_vendor/rich/pretty.py�_is_attr_object8sr5z_attr_module.Attribute[Any]cCstdurt�t|��SgS)zGet fields for an attrs object.N)r/r	r1r2r3r3r4�_get_attr_fields=sr6cCs(z	|jjjtjkWStyYdSw)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__�	Exceptionr2r3r3r4�_is_dataclass_reprBs
�r=�ignoreF�value�consoler'�overflowr+�crop�
indent_guides�
max_length�
max_string�
expand_allc

Cs�ddlm}t|t�s|durdS|pt�}|jrCgd�}	|	D]#}
t||
d�}t�|�rBz|�}Wn	t	y:Yqw|durBdSqt||�rL|�
�|jt|t�rU|n
t
||||||dd�|dd�dS)Nr)�ConsoleRenderable)�_repr_html_�_repr_markdown_�_repr_json_�_repr_latex_�_repr_jpeg_�
_repr_png_�
_repr_svg_�_repr_mimebundle_�)rArCrDrErF�marginT)rB�new_line_start)r@rG�
isinstancer$r�
is_jupyter�getattr�inspect�ismethodr<�line�printr�Pretty)
r?r@rArBrCrDrErFrG�ipython_repr_methods�repr_method�method�repr_resultr3r3r4�_ipy_display_hookSsD




��
��	
�r_cs�ddlm��p
����dusJ�dtddf�������fdd�}z$t�}ddlm}	G������fd	d
�d
|	�}
|
�}||jjd<WdStyS|t	_
YdSw)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.
        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.
    rrNr?r.c	sT|dur(�dus
J�dt_�jt|t�r|n	t|�����d��d�|t_dSdS)z?Replacement sys.displayhook which prettifies objects with Rich.N)rArCrDrErF)rB)�builtins�_rYrSrrZ)r?)r@rBrFrCrDrErAr3r4�display_hook�s$���

�zinstall.<locals>.display_hook)�
BaseFormattercs:eZdZUdZeed<dedef������fdd�ZdS)zinstall.<locals>.RichFormatterT�pprintr?r.c	s&|jrt|�������d�St|�S)N)r@rArCrDrErF)rdr_�repr)�selfr?�rFrrCrDrErAr3r4�__call__�s�
z'install.<locals>.RichFormatter.__call__N)�__name__�
__module__�__qualname__rd�bool�__annotations__rrhr3rgr3r4�
RichFormatter�s
$rnz
text/plain)�pip._vendor.richrr�get_ipython�IPython.core.formattersrc�display_formatter�
formattersr<�sys�displayhook)r@rArBrCrDrErFrb�iprcrn�rich_formatterr3)r@rBrFrrCrDrErAr4�install�s
"�rxc@s�eZdZdZ	d$dddddddddddd�deded	d
ededd
eddeededeedeedeededededdfdd�Z						d%dd �Z							!d&d"d#�Z
dS)'rZakA 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�justifyrA�no_wraprCrDrE�	max_depthrFrQ�insert_line�_object�highlighterr)rzr{r*rAr+r|rCrDrEr}rFrQr~r.cCsX||_|pt�|_||_||_||_||_||_||_|	|_	|
|_
||_||_|
|_
dS�N)rr"r�rzr{rAr|rCrDrEr}rFrQr~)rfrr�rzr{rAr|rCrDrEr}rFrQr~r3r3r4�__init__�s
zPretty.__init__r@r'�optionsr(r,c	cs��t|j|j|j|j|j|j|j|jd�}t	||j
p|j
|jp"|jt|j
|j
�dd�}|r3|�|�nt	t|j��d�dd�}|jrM|jsM|j|jdd�}|jrWd|vrWd	V|VdS)
N��	max_widthrzrDrEr}rF�pretty)r{rAr|�stylez.__repr__ returned empty stringz
dim italic)r�zrepr.indent�
�)�pretty_reprrr�rQrzrDrEr}rFr&r{rArr|r�r1rC�
ascii_only�with_indent_guidesr~)rfr@r��
pretty_str�pretty_textr3r3r4�__rich_console__s>�
�	

�	����
zPretty.__rich_console__r%cCsDt|j|j|j|j|jd�}|rtdd�|��D��nd}t||�S)N)r�rzrDrEcs��|]}t|�VqdSr�r ��.0rXr3r3r4�	<genexpr>?��z*Pretty.__rich_measure__.<locals>.<genexpr>r)	r�rr�rzrDrE�max�
splitlinesr%)rfr@r�r��
text_widthr3r3r4�__rich_measure__4s��
zPretty.__rich_measure__r�)r@r'r�r(r.r,)r@r'r�r(r.r%)rirjrk�__doc__rr�intrlr�r�r�r3r3r3r4rZ�st��������	�
���
���
���
�#���rZrcCsd|j�d�dd|j�d�fS)Nzdefaultdict(z, {�})z, {}))�default_factory�rr3r3r4�_get_braces_for_defaultdictDs�r�z
array[Any]cCsd|j�d�ddfS)Nzarray(z, [�])zarray({_object.typecode!r}))�typecoder�r3r3r4�_get_braces_for_arrayLsr�cC�dS)N)z	environ({r�zenviron({})r3r�r3r3r4�<lambda>Q�r�cCr�)N)z	Counter({r�z	Counter()r3r�r3r3r4r�Tr�cCr�)N)zdeque([r�zdeque()r3r�r3r3r4r�Ur�cCr��N)�{�}z{}r3r�r3r3r4r�Vr�cCr�r�r3r�r3r3r4r�Wr�cCr�)N)zfrozenset({r�zfrozenset()r3r�r3r3r4r�Xr�cCr��N)�[�]z[]r3r�r3r3r4r�Yr�cCr�r�r3r�r3r3r4r�Zr�cCr�)N)r�r�zset()r3r�r3r3r4r�[r�cCr�)N)�(�)�()r3r�r3r3r4r�\r�cCr�)N)zmappingproxy({r�zmappingproxy({})r3r�r3r3r4r�]r��_BRACEScCs.t|t�pt|�pt|d�pt|�ot|�S)z3Check if an object may be expanded by pretty print.�
__rich_repr__)rS�_CONTAINERSr
�hasattrr5rr2r3r3r4�
is_expandablecs
����r�c	@s�eZdZUdZdZeed<dZeed<dZeed<dZ	eed<dZ
eed<dZeed	<dZ
eed
<dZeeded<d
ZdZeed<deefdd�Zdededefdd�Zdefdd�Z	d dedededefdd�ZdS)!�Nodez4A node in a repr tree. May be atomic or a container.r��key_repr�
value_repr�
open_brace�close_brace�emptyF�last�is_tupleN�childrenz: z, �	separatorr.ccs��|jr|jV|jV|jr|jVdS|jdurY|jrS|jV|jr9t|j�dkr9|jd��EdHdVn|jD]}|��EdH|jsL|j	Vq<|j
VdS|jVdSdS)zGenerate tokens for this node.Nrr�,)r��
key_separatorr�r�r�r��len�iter_tokensr�r�r�r�)rf�childr3r3r4r�|s(�

��zNode.iter_tokens�start_lengthrDcCs0|}|��D]}|t|�7}||krdSqdS)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!)rfr�rD�total_length�tokenr3r3r4�check_length�s
�zNode.check_lengthcCsd�|���}|S�Nr�)�joinr�)rf�	repr_textr3r3r4�__str__�szNode.__str__�Pryr�rzrFcCs�t|dd�g}d}|t|�kr5||}|jr+|js+|s |�|�s+|�|�|||d�<|d7}|t|�ksd�dd�|D��}|S)alRender 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_rootrrr�csr�r�)�strr�r3r3r4r��r�zNode.render.<locals>.<genexpr>)�_Liner��
expandable�expandedr��expandr�)rfr�rzrF�lines�line_norX�repr_strr3r3r4�render�s
�zNode.render)r�ryF)rirjrkr�r�r�rmr�r�r�r�r�rlr�r�rrr�r�rr�r�r�r�r�r3r3r3r4r�ms2
�����r�c@s�eZdZUdZdZeded<dZeed<dZ	ee
ed<dZeed<dZ
eed	<dZeed
<dZeed<dZeed<ed
efdd��Zded
efdd�Zded
edfdd�Zd
efdd�ZdS)r�zA line in repr output.N�parentFr�r�r��text�suffix�
whitespacer�r�r.cCst|jduo	|jj�S)z"Check if the line may be expanded.N)rlr�r��rfr3r3r4r��sz_Line.expandablerDcCs:t|j�t|j�t|j�}|jdusJ�|j�||�S)z4Check this line fits within a given number of cells.N)r�r�r!r�r�r�r�)rfrDr�r3r3r4r��s�z_Line.check_lengthrzccs��|j}|dus
J�|j}|jsJ�|jr&t|j�|j�|j��|d�V}nt|j|d�V}|jd|}|jo>t|j�dk}t	|j�D]\}}|rLdn|j
}	t||||	|oX|d�}
|
VqDt|j||j|j
d�VdS)z6Expand this line by adding children on their own line.N)r�r�� rr�)r�r�r�r�r�)r�r�r�r�)r�r�r�r�r�r�r�r�r�rr�r�r�r�)rfrzr�r��new_line�child_whitespace�tuple_of_oner�r�r�rXr3r3r4r��s:�

���z_Line.expandcCsD|jr|j�|j�|jp
d��S|j�|j�|jpd�|j����Sr�)r�r�r�r�r��rstripr�r3r3r4r��s"�z
_Line.__str__)rirjrkr�r�rrmr�rlr�r�r�r�r�r�r�r��propertyr�r�r�rr�r�r3r3r3r4r��s
!r�r}c	sddtdtf�fdd��t���j��j�ddtdtdtdtf�������fd	d
�
��|dd�}|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-r.c
s��dur$t|ttf�r$t|��kr$t|��}|d���d|��}|Szt|�}W|StyF}zdt|��d�}WYd}~|Sd}~ww)z0Get repr string for an object, but catch errors.N�+z<repr-error �>)rS�bytesr�r�rer<)r-�	truncated�obj_repr�error)rEr3r4�to_reprs��
���ztraverse.<locals>.to_reprFr�root�depthc#	s�t��}tjjtjjf}�duo|�k}dtdttttt	tfffdd�}zt
�d�}Wnty9d}Ynwd}|sWzt
�d�rLt��sL��
�}Wn	tyVYnw|dur�t�j
d	d�}	t||��}
�jj}|
r�g}|j}
|r|td
d�}�nT|	r�td|�d
�d||d
d�}nt|�d�d||d�}t|
�D]2\}}t|t�r�|\}}�||dd�}||_||_d|_|
|�q��||dd�}||_|
|�q��nt|	r�d|�d�n|�d�g|d�}�n�t���rg|�sgg}|j}
t�����rY|�rtd
d�}�n�t�jj�d�d||d�}dttt	ttttgt	fff��fdd�}t|��D]*\}\}}}|�r@tt	||��d�}n�||dd�}||_||_d|_|
|��q,�nwt�jj�d�g|d�}�nit���r�t�t��s�|�s�t���s|dk�r�t ��}|�v�r�td
d�S�|�g}|j}
|�r�td
d�}�n0t�jj�d�d||d�}tdd�t!��D��D]\}}�t�|j"�|dd�}|j"|_||_d|_|
|��q��|�n�t�t#��r�t#D]
}t�|��r�|}n�q�t ��}|�v�rtd
d�S�|�t$|��\}}}|�rtd
|d�}n�|j%t��j%k�r*t���|d�}n���r�g}t||||d�}|j}
t&��}|d}t�t'��r{t(��)��} �du�rXt*| ��} t+| �D]\}!\}}�||dd�}�|�|_|!|k|_|
|��q\n)t(��}"�du�r�t*|"��}"t+|"�D]\}!}�||dd�}|!|k|_|
|��q��du�r�|�k�r�|
td|���dd��nt|g|d �}�|�nt���|d�}t�t�|_,|S)!zWalk the object depth first.N�	rich_argsr.css��|D]<}t|t�r<t|�dkr |\}}}||krq||fVqt|�dkr0|\}}||fVqt|�dkr;|dVq|VqdS)N��rr)rS�tupler�)r��arg�keyr��defaultr3r3r4�iter_rich_args6s �


��z3traverse.<locals>._traverse.<locals>.iter_rich_args�,awehoi234_wdfjwljet234_234wdfoijsdfmmnxpi492Fr��angularz...)r��<r�r�)r�r�r�r�r�r�r�)r�r�r�r�r)r��=r�)r�r�r�c3sx��D]6}|jr9zt�|j�}Wnty)}z
|j|dfVWYd}~qd}~ww|j|t|j�r5|jndfVqdS)z$Iterate over attr fields and values.N)rerU�namer<�callable)�attrr?r���attr_fieldsr-r3r4�
iter_attrs�s������z/traverse.<locals>._traverse.<locals>.iter_attrs)r��css�|]}|jr|VqdSr�)re)r��fieldr3r3r4r��s��
�z.traverse.<locals>._traverse.<locals>.<genexpr>)r�r�z... +T)r�r�r�)-r1rt�version_info�major�minorrrrrr�r�r<rr�rU�list�	__class__ri�appendr�rrSr�r�r�r�r5r6rrr
r=�idr	r�r�r�r7r��_MAPPING_CONTAINERS�iter�itemsr�	enumerater�)#r-r�r��obj_type�
py_version�reached_max_depthr��fake_attributes�rich_repr_resultr��args�
class_namer�rr�r�r�r�r��
child_noder�r�r?�
repr_callable�obj_idr��container_typer�r�r��	num_items�last_item_index�
iter_items�index�iter_values)�	_traverser}rD�pop_visited�push_visitedr��visited_idsr�r4r.sV&����
��


�

����

�����


��
�

�



�


�
ztraverse.<locals>._traverseT)r�N)Fr)rr��set�add�removerlr�r�)rrDrEr}r�r3)rr}rDrErrr�rr4�traverses,br r�ryr�r�rzc	Cs4t|t�r|}nt||||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.
    )rDrEr})r�rzrF)rSr�r r�)	rr�rzrDrEr}rFr�r�r3r3r4r�s
��r�T)r@rCrDrEr}rFc
Cs6|durt�n|}|jt||||||dd�dd�dS)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.
    Nr>)rDrEr}rCrFrAT)�	soft_wrap)rrYrZ)rr@rCrDrEr}rF�_consoler3r3r4rd;s�	
�rd�__main__c@seZdZdefdd�ZdS)�
BrokenReprr.cCsdddS)Nrrzthis will failr3r�r3r3r4r7cszBrokenRepr.__repr__N)rirjrkr�r7r3r3r3r4r$bsr$��foozHello World!gZd;�Y@g�ʡE�3t@gcA>�rr�r�ryr%r���>rr�r��crumble)�apple�rhubarb�butter�sugar�flour)r+�orange�pear�kumquatr2�Xduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurianduriandurian)FTN)r&�barr�counter�atomic�Broken)rY�)rCrE)Nr>FFNNF)NNN)er`r:rV�os�rertr�collectionsrrrrrrr	r
r�	itertoolsr�typesr
�typingrrrrrrrrrrr�pip._vendor.rich.reprrr�r/�ImportErrorr�r�_loopr�_pickr�abcr�cellsr!r�r"�jupyterr#r$�measurer%r�r&r@r'r(r)r*r+r,rlr5r6�objectr=r�r_rxrZr�r�r��_Environ�dict�	frozensetrrr�r�r1rm�keysr�rr�r�r�r r�rdrir$�d�datarrorYr3r3r3r4�<module>s�
4� 
���������	
�A��������
�K$f
(�
SE�����
���������	
�+��������	
�
%�
��
��