
    9Cg                        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    J/var/www/api/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                  J    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S )Representationr   r   r   c                      j         }|s)t           d          r j                                        } fd|D             }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                     g | ]\  }}|||fS r   r   r    avs      r   
<listcomp>z0Representation.__repr_args__.<locals>.<listcomp>1   s!    :::41aAMAMMMr   )	__slots__hasattrr   keys)r   attrs_namesattrss   `  r   __repr_args__zRepresentation.__repr_args__&   se     n 	/wtZ88 	/-,,..K<<<<<<<::5::::r   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   join_strc                d    |                     d |                                 D                       S )Nc              3  L   K   | ]\  }}|t          |          n| d|V   d S )N=)reprr$   s      r   r"   z.Representation.__repr_str__.<locals>.<genexpr>8   s>      ee1	T!WWW!||a||eeeeeer   )joinr-   )r   r1   s     r   __repr_str__zRepresentation.__repr_str__7   s0    }}eePTPbPbPdPdeeeeeer   fmttyping.Callable[[Any], Any]kwargsr   !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   Nr4   ,r   ))r0   r-   )r   r8   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   rA   
field_reprs      r   __rich_repr__zRepresentation.__rich_repr__G   sX       $ 2 2 4 4 	' 	'D*|     J&&&&&		' 	'r   c                ,    |                      d          S )N )r7   r   s    r   __str__zRepresentation.__str__O   s      %%%r   c                \    |                                   d|                     d           dS )Nr=   , r@   )r0   r7   r   s    r   r   zRepresentation.__repr__R   s3    $$&&CC):):4)@)@CCCCr   N)r   r   r   )r1   r   r   r   )r8   r9   r:   r   r   r;   )r   r   )r   r   r   r(   r-   r0   r7   rC   rF   rI   r   r   r   r   r   r      s         I; ; ; ;' ' ' 'f f f f   ' ' ' '& & & &D D D D D Dr   r   objr   r   r   c                ~   t          | t          j                  r| j        S | du rdS t          | t                    rt          |           S t          | 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        |           t          j        k    r;d                    t#          t
          t          j        |                               }n:d                    t#          t$          t          j        |                               }	 | j         d| dS # t,          $ r t          |           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...rK   zUnion[][ztyping. ztyping_extensions.)
isinstancetypesFunctionTyper   r   r5   typing_extensionsTypeAliasTyper   r   typing_baseWithArgsTypestyper/   origin_is_union
get_originr6   mapdisplay_as_typeget_argsLiteralr   AttributeErrorreplace)rL   argss     r   r\   r\   V   s   
 #u)** |	u	C	(	( Cyy	C*8	9	9 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',,0A0III99S'8'A#'F'FGGHHDD99S2C2LS2Q2QRRSSD	&000000 	 	 	s88OOO		C		 RCyy  B//778LbQQQs    G G)(G))rL   r   r   r   )r   
__future__r   _annotationsrR   typingr   rT   rP   r   TYPE_CHECKINGr   __annotations__r   r   r
   r   r\   r   r   r   <module>rg      s   @ @ @ 2 2 2 2 2 2                  	 ,UHUUUUT     
       6D 6D 6D 6D 6D 6D 6D 6Dr R  R  R  R  R  Rr   