
    Tg`                        U d Z ddlmZ ddlZddlZddlmZ ddlZddlm	Z	 ej
        rdZded	<   d
Zded<    G d de          Z G d d          ZddZdS )z:Tools to provide pretty/human-readable display of objects.    )annotationsN)Any   )_typing_extraz'typing.Iterable[tuple[str | None, Any]]ztyping_extensions.TypeAliasReprArgszJtyping.Iterable[Any | tuple[Any] | tuple[str, Any] | tuple[str, Any, Any]]RichReprResultc                      e Zd ZdZddZdS )	PlainReprzString class where repr doesn't include quotes. Useful with Representation when you want to return a string
    representation of something that is valid (or pseudo-valid) python.
    returnstrc                     t          |           S N)r   selfs    M/var/www/sysmax/venv/lib/python3.11/site-packages/pydantic/_internal/_repr.py__repr__zPlainRepr.__repr__   s    4yy    Nr   r   )__name__
__module____qualname____doc__r    r   r   r
   r
      s2              r   r
   c                  R    e Zd ZdZddZddZdd	ZddZddZddZ	ddZ
ddZdS )Representationr   r   r   c                      j         }|s)t           d          r j                                        } fd|D             } fd|D             S )a-  Returns the attributes to show in __str__, __repr__, and __pretty__ this is generally overridden.

        Can either return:
        * name - value pairs, e.g.: `[('foo_name', 'foo'), ('bar_name', ['b', 'a', 'r'])]`
        * or, just values, e.g.: `[(None, 'foo'), (None, ['b', 'a', 'r'])]`
        __dict__c              3  <   K   | ]}|t          |          fV  d S r   )getattr).0sr   s     r   	<genexpr>z/Representation.__repr_args__.<locals>.<genexpr>0   s2      <<1!WT1%%&<<<<<<r   c                T    g | ]$\  }}|||ur|n                     |          f%S r   )__repr_recursion__)r    avr   s      r   
<listcomp>z0Representation.__repr_args__.<locals>.<listcomp>1   sB    kkkDAq]^]j$AAD,C,CA,F,FG]j]j]jr   )	__slots__hasattrr   keys)r   attrs_namesattrss   `  r   __repr_args__zRepresentation.__repr_args__&   sl     n 	/wtZ88 	/-,,..K<<<<<<<kkkkTYkkkkr   r   c                    | j         j        S )z/Name of the instance's class, used in __repr__.)	__class__r   r   s    r   __repr_name__zRepresentation.__repr_name__3   s    ~&&r   objectr   c                R    dt          |          j         dt          |           dS )z8Returns the string representation of a recursive object.z<Recursion on z	 with id=>)typer   id)r   r1   s     r   r$   z!Representation.__repr_recursion__7   s-     NV 5MM6

MMMMr   join_strc                d    |                     d |                                 D                       S )Nc              3  L   K   | ]\  }}|t          |          n| d|V   d S )N=)repr)r    r%   r&   s      r   r"   z.Representation.__repr_str__.<locals>.<genexpr>=   s>      ee1	T!WWW!||a||eeeeeer   )joinr-   )r   r6   s     r   __repr_str__zRepresentation.__repr_str__<   s0    }}eePTPbPbPdPdeeeeeer   fmttyping.Callable[[Any], Any]kwargs!typing.Generator[Any, None, None]c              +     K   |                                  dz   V  dV  |                                 D ]#\  }}||dz   V   ||          V  dV  dV  $dV  dV  dS )	zRUsed by devtools (https://python-devtools.helpmanual.io/) to pretty print objects.(r   Nr9   ,r   ))r0   r-   )r   r=   r?   namevalues        r   
__pretty__zRepresentation.__pretty__?   s        ""S((((--// 	 	KD%Sj   #e**IIIGGGG					r   r   c              #  X   K   |                                  D ]\  }}||V  ||fV  dS )zYUsed by Rich (https://rich.readthedocs.io/en/stable/pretty.html) to pretty print objects.N)r-   )r   rF   
field_reprs      r   __rich_repr__zRepresentation.__rich_repr__L   sX       $ 2 2 4 4 	' 	'D*|     J&&&&&		' 	'r   c                ,    |                      d          S )N )r<   r   s    r   __str__zRepresentation.__str__T   s      %%%r   c                \    |                                   d|                     d           dS )NrB   , rE   )r0   r<   r   s    r   r   zRepresentation.__repr__W   s3    $$&&CC):):4)@)@CCCCr   N)r   r   r   )r1   r   r   r   )r6   r   r   r   )r=   r>   r?   r   r   r@   )r   r   )r   r   r   r(   r-   r0   r$   r<   rH   rK   rN   r   r   r   r   r   r      s         Il l l l' ' ' 'N N N N
f f f f   ' ' ' '& & & &D D D D D Dr   r   objr   r   r   c                   t          | t          j        t          j        f          r| j        S | du rdS t          | t
                    rt          |           S t          | t          j                  st          j
        |           rt          |           S t          | t          j        t          j        t          f          s| j        } t          j        t#          j        |                     r@d                    t)          t*          t#          j        |                               }d| dS t          | t          j                  rt          j        |           r;d                    t)          t          t#          j        |                               }n:d                    t)          t*          t#          j        |                               }	 | j         d| dS # t2          $ r: t          |                               dd                              d	d          cY S w xY wt          | t                    r| j        S t          |                               dd                              d	d          S )
zPretty representation of a type, should be as close as possible to the original type definition string.

    Takes some logic from `typing._type_repr`.
    .z...rP   zUnion[][ztyping. ztyping_extensions.)
isinstancetypesFunctionTypeBuiltinFunctionTyper   r   r:   typing
ForwardRefr   is_type_alias_typer   typing_baseWithArgsTypesr4   r/   origin_is_uniontyping_extensions
get_originr;   mapdisplay_as_typeget_args
is_literalr   AttributeErrorreplace)rQ   argss     r   rc   rc   [   s=   
 #*E,EFGG |	u	C	(	( Cyy	C*	+	+ }/OPS/T/T 3xxcM5}7RTXYZZ m$%6%A#%F%FGG Ryy_.?.H.M.MNNOO	C4	5	5 R#C(( 	T99S'8'A#'F'FGGHHDD99S2C2LS2Q2QRRSSD	U&000000 	U 	U 	Us88##Ir22::;OQSTTTTT	U	C		 RCyy  B//778LbQQQs   G AH#"H#)rQ   r   r   r   )r   
__future__r   _annotationsrW   rZ   r   r`   rU   r   TYPE_CHECKINGr   __annotations__r   r   r
   r   rc   r   r   r   <module>rm      s   @ @ @ 2 2 2 2 2 2                  	 ,UHUUUUT     
       ;D ;D ;D ;D ;D ;D ;D ;D| R  R  R  R  R  Rr   