
    ,h                        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	 ddl
m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y)z:Tools to provide pretty/human-readable display of objects.    )annotationsN)Any)typing_objects)is_union_origin   )_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y)	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.
    c                    t        |       S N)strselfs    Z/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pydantic/_internal/_repr.py__repr__zPlainRepr.__repr__   s    4y    Nreturnr   )__name__
__module____qualname____doc__r    r   r   r   r      s    r   r   c                  P    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y
)Representationr   c                      j                   }|s&t         d      r j                  j                         } fd|D        }|D cg c]!  \  }}|	|| ur|n j	                  |      f# c}}S c c}}w )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  y wr   )getattr).0sr   s     r   	<genexpr>z/Representation.__repr_args__.<locals>.<genexpr>2   s     <1!WT1%&<s   )	__slots__hasattrr   keys__repr_recursion__)r   attrs_namesattrsavs   `    r   __repr_args__zRepresentation.__repr_args__(   sl     nnwtZ8--,,.K<<TYkDAq]^]j$AD,C,CA,FGkkks   
A0A0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__5   s    ~~&&&r   c                L    dt        |      j                   dt        |       dS )z8Returns the string representation of a recursive object.z<Recursion on z	 with id=>)typer   id)r   objects     r   r(   z!Representation.__repr_recursion__9   s(      V 5 56i6
|1MMr   c                N    |j                  d | j                         D              S )Nc              3  J   K   | ]  \  }}|t        |      n| d|  y w)N=)repr)r"   r+   r,   s      r   r$   z.Representation.__repr_str__.<locals>.<genexpr>?   s+     e1	T!W!AaU|Ces   !#)joinr-   )r   join_strs     r   __repr_str__zRepresentation.__repr_str__>   s!    }}ePTPbPbPdeeer   c              +     K   | j                         dz    d | j                         D ]   \  }}||dz     ||       d d " d d yw)	zRUsed by devtools (https://python-devtools.helpmanual.io/) to pretty print objects.(r   Nr8   ,r   ))r0   r-   )r   fmtkwargsnamevalues        r   
__pretty__zRepresentation.__pretty__A   sk       "S((--/ 	KD%Sj e*IG	 	s   AAc              #  V   K   | j                         D ]  \  }}|| ||f  yw)zYUsed by Rich (https://rich.readthedocs.io/en/stable/pretty.html) to pretty print objects.N)r-   )r   rD   
field_reprs      r   __rich_repr__zRepresentation.__rich_repr__N   s9      $ 2 2 4 	'D*|  J&&		's   ')c                $    | j                  d      S )N )r<   r   s    r   __str__zRepresentation.__str__V   s      %%r   c                L    | j                          d| j                  d       dS )Nr>   , rA   )r0   r<   r   s    r   r   zRepresentation.__repr__Y   s+    $$&'q):):4)@(ACCr   N)r   r	   r   )r5   r   r   r   )r;   r   r   r   )rB   ztyping.Callable[[Any], Any]rC   r   r   z!typing.Generator[Any, None, None])r   r
   )r   r   r   r%   r-   r0   r(   r<   rF   rI   rL   r   r   r   r   r   r      s5     Il'N
f'&Dr   r   c                   t        | t        j                  t        j                  f      r| j                  S | du ryt        | t
              rt        |       S t        | t        j                        st        j                  |       rt        |       S t        | t        j                  t        j                  t        f      s| j                   } t#        t%        j&                  |             r8dj)                  t+        t,        t%        j.                  |                   }d| dS t        | t        j                        rt        j0                  t%        j&                  |             r3dj)                  t+        t        t%        j.                  |                   }n2dj)                  t+        t,        t%        j.                  |                   }	 | j2                   d| dS t        | t              r| j2                  S t        |       j7                  dd      j7                  d	d      S # t4        $ r. t        |       j7                  dd      j7                  d	d      cY S w xY w)
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...rN   zUnion[][ztyping. ztyping_extensions.)
isinstancetypesFunctionTypeBuiltinFunctionTyper   r   r9   typing
ForwardRefr   is_typealiastyper   r   typing_baseWithArgsTypesr3   r/   r   typing_extensions
get_originr:   mapdisplay_as_typeget_args
is_literalr   AttributeErrorreplace)objargss     r   r_   r_   ]   s   
 #**E,E,EFG||		C	(Cy	C**	+~/N/Ns/S3xcM55}7R7RTXYZmm(33C89yy_.?.H.H.MNOvQ	C44	5$$%6%A%A#%FG99S'8'A'A#'FGHD99S2C2L2LS2QRSD	U&&'qa00 
C	Cy  B/778LbQQ  	Us8##Ir2::;OQSTT	Us   
H# #4II)rd   r   r   r   )r   
__future__r   _annotationsrT   rW   r   r\   typing_inspectionr   typing_inspection.introspectionr   rR   r   TYPE_CHECKINGr	   __annotations__r
   r   r   r   r_   r   r   r   <module>rl      sc    @ 2     , ; 	,UH)UT / 
 ;D ;D| Rr   