
    uYf.                         d Z ddlmZmZmZ ddlmZmZmZ ddgZ	de
deed	f   d
efdZdefdeeee
f   dedee
eed	f   gef   d
ee   fdZy	)zCattrs validation.    )CallableListUnion   )ClassValidationErrorForbiddenExtraKeysErrorIterableValidationErrorformat_exceptiontransform_errorexctypeNreturnc                    t        | t              rd}|S t        | t              r0|*t        |d      r|j                  n
t        |      }d| }|S d}|S t        | t              rV|*| j                  d   j                  d      rd}|S d|  d	}|S t        |d      r|j                  n
t        |      }d| }|S t        | t              r!d
dj                  | j                         d	}|S t        | t              r"| j                  d   j                  d      rd}|S t        | t              r"| j                  d   j                  d      rd}|S d|  d	}|S )a  The default exception formatter, handling the most common exceptions.

    The following exceptions are handled specially:

    * `KeyErrors` (`required field missing`)
    * `ValueErrors` (`invalid value for type, expected <type>` or just `invalid value`)
    * `TypeErrors` (`invalid value for type, expected <type>` and a couple special
      cases for iterables)
    * `cattrs.ForbiddenExtraKeysError`
    * some `AttributeErrors` (special cased for structing mappings)
    zrequired field missing__name__z!invalid value for type, expected zinvalid valuer   zobject is not iterablez,invalid value for type, expected an iterablezinvalid type ()zextra fields found (z, zobject has no attribute 'items'zexpected a mappingzobject has no attribute 'copy'zunknown error ()
isinstanceKeyError
ValueErrorhasattrr   repr	TypeErrorargsendswithr   joinextra_fieldsAttributeError)r   r   restns       H/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/cattrs/v.pyr
   r
      s    #x &@ J? 
C	$")$
";dB5bT:C8 J5 "C4 J3 
C	#<xx{##$<=D, J) 'se1-( J% #*$
";dB5bT:C" J! 
C0	1$TYYs/?/?%@$AC J 
C	(SXXa[-A-A). # J 
C	(SXXa[-A-A(.
 # J  uA&J    $pathc                 >   g }t        | t              r| j                         \  }}|D ]q  \  } }| d|j                  d}t        | t        t        f      r|j                  t        | ||             K|j                   || |j                         d|        s |D ]  } |j                   || d       d|        ! |S t        | t              r| j                         \  }}|D ]p  \  } }| d|j                   }t        | t        t        f      r|j                  t        | ||             J|j                   || |j                         d|        r |D ]  } |j                   || d       d|        ! |S |j                   || d       d|        |S )a  Transform an exception into a list of error messages.

    To get detailed error messages, the exception should be produced by a converter
    with `detailed_validation` set.

    By default, the error messages are in the form of `{description} @ {path}`.

    While traversing the exception and subexceptions, the path is formed:

    * by appending `.{field_name}` for fields in classes
    * by appending `[{int}]` for indices in iterables, like lists
    * by appending `[{str}]` for keys in mappings, like dictionaries

    :param exc: The exception to transform into error messages.
    :param path: The root path to use.
    :param format_exception: A callable to use to transform `Exceptions` into
        string descriptions of errors.

    .. versionadded:: 23.1.0
    []z @ N.)
r   r	   group_exceptionsindexr   extendr   appendr   name)r   r"   r
   errors
with_noteswithoutnoteps           r   r   r   =   s   6 F#./!224
G# 	KIC&$**q)A# 46MNOoc16FGH!1#tyy!A B#aSIJ	K  	ECMM-c489TFCD	E M 
C-	.!224
G# 	KIC&$))%A# 46MNOoc16FGH!1#tyy!A B#aSIJ	K  	ECMM-c489TFCD	E M 	)#t45S?@Mr    )__doc__typingr   r   r   r,   r   r   r	   __all__BaseExceptionr   strr
   r    r    r   <module>r7      s     ( (  0
1-- -uT4Z/@ -S -d  	2	#%<mK	L2
2 	dDj)*C/2 
#Y2r    