
    uYf                         d dl mZmZmZmZmZmZmZ d dlm	Z	  G d de
      Z G d de	      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z G d de
      Zy)    )AnyListOptionalSetTupleTypeUnion)ExceptionGroupc                   0     e Zd ZdZdededdf fdZ xZS )StructureHandlerNotFoundErrorzk
    Error raised when structuring cannot find a handler for converting inputs into
    :attr:`type_`.
    messagetype_returnNc                 2    t         |   |       || _        y N)super__init__r   )selfr   r   	__class__s      M/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/cattrs/errors.pyr   z&StructureHandlerNotFoundError.__init__   s    !
    )__name__
__module____qualname____doc__strr   r   __classcell__r   s   @r   r   r      s'    
 D T  r   r   c                   6     e Zd ZU eed<   def fdZd Z xZS )BaseValidationErrorclc                 8    t         |   | ||      }||_        |S r   )r   __new__r!   )clsr   excsr!   objr   s        r   r#   zBaseValidationError.__new__   s!    goc7D1
r   c                 D    t        | j                  || j                        S r   )ClassValidationErrorr   r!   )r   r%   s     r   derivezBaseValidationError.derive   s    #DLL$@@r   )r   r   r   r   __annotations__r#   r)   r   r   s   @r   r    r       s    H 
Ar   r    c                   t    e Zd ZU dZeeef   ed<   eed<   dedeeef   dedd fdZ	de
eeeef   ef   fdZy)	IterableValidationNotezNAttached as a note to an exception when an iterable element fails structuring.indextypestringr   c                 N    t         j                  | |      }||_        ||_        |S r   )r   r#   r-   r.   )r$   r/   r-   r.   instances        r   r#   zIterableValidationNote.__new__#   s'     ;;sF+r   c                 F    t        |       | j                  | j                  fS r   )r   r-   r.   r   s    r   __getnewargs__z%IterableValidationNote.__getnewargs__+   s    D	4::tyy11r   N)r   r   r   r   r	   intr   r*   r   r#   r   r4    r   r   r,   r,      se    Xc?
I!&sCx8;	!2c5c?C&? @ 2r   r,   c                   <    e Zd ZdZdeeeeef      ee   f   fdZy)IterableValidationErrorz$Raised when structuring an iterable.r   c                    g }g }| j                   D ]i  }t        |d      rJ|j                  D ])  }|j                  t        u s|j                  ||f        F |j                  |       Y|j                  |       k ||fS zHSplit the exceptions into two groups: with and without validation notes.	__notes__)
exceptionshasattrr;   r   r,   appendr   excs_with_notes
other_excssubexcnotes        r   group_exceptionsz(IterableValidationError.group_exceptions2   s     
oo 		*Fv{+",, .D~~)??'..~>.
 %%f-!!&)		* 
**r   N)	r   r   r   r   r   r   	Exceptionr,   rD   r6   r   r   r8   r8   /   s0    .+	tE)%;;<=tIN	O+r   r8   c                   V    e Zd ZU dZeed<   eed<   dedededd fdZdeeeef   fdZ	y)	AttributeValidationNotezGAttached as a note to an exception when an attribute fails structuring.namer.   r/   r   c                 N    t         j                  | |      }||_        ||_        |S r   )r   r#   rH   r.   )r$   r/   rH   r.   r1   s        r   r#   zAttributeValidationNote.__new__L   s%    ;;sF+r   c                 F    t        |       | j                  | j                  fS r   )r   rH   r.   r3   s    r   r4   z&AttributeValidationNote.__getnewargs__R   s    D	499dii00r   N)
r   r   r   r   r   r*   r   r#   r   r4   r6   r   r   rG   rG   F   sH    Q
I
IS  3 ;T 1c3m 4 1r   rG   c                   <    e Zd ZdZdeeeeef      ee   f   fdZy)r(   z=Raised when validating a class if any attributes are invalid.r   c                    g }g }| j                   D ]i  }t        |d      rJ|j                  D ])  }|j                  t        u s|j                  ||f        F |j                  |       Y|j                  |       k ||fS r:   )r<   r=   r;   r   rG   r>   r?   s        r   rD   z%ClassValidationError.group_exceptionsY   s     
oo 		*Fv{+",, .D~~)@@'..~>.
 %%f-!!&)		* 
**r   N)	r   r   r   r   r   r   rE   rG   rD   r6   r   r   r(   r(   V   s0    G+	tE)%<<=>YO	P+r   r(   c                   @     e Zd ZdZdee   dedee   ddf fdZ xZ	S )ForbiddenExtraKeysErrora"  
    Raised when `forbid_extra_keys` is activated and such extra keys are detected
    during structuring.

    The attribute `extra_fields` is a sequence of those extra keys, which were the
    cause of this error, and `cl` is the class which was structured with those extra
    keys.
    r   r!   extra_fieldsr   Nc                     || _         || _        |j                  }t        |   |xs d| ddj                  |              y )Nz Extra fields in constructor for z: z, )r!   rO   r   r   r   join)r   r   r!   rO   clnr   s        r   r   z ForbiddenExtraKeysError.__init__w   sM     (kk S1#b<9P8QR	
r   )
r   r   r   r   r   r   r   r   r   r   r   s   @r   rN   rN   m   s:    

}

*.

>A#h

	

 

r   rN   N)typingr   r   r   r   r   r   r	   cattrs._compatr
   rE   r   r    r   r,   r8   rG   r(   rN   r6   r   r   <module>rU      si    ? ? ? )I 	A. 	A2S 2$+1 +.1c 1 +. +.
i 
r   