o
    $i
                     @   s   d dl mZmZmZmZmZ dedefddZG dd deZ	G dd	 d	e	Z
G d
d de
ZG dd de
ZG dd deZG dd de
ZG dd de	ZG dd de	ZdS )    )AnyTypeOptionalSetDicttype_returnc                 C   s   t | dr| jS t| S )N__name__)hasattrr	   str)r    r   f/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/exceptions.py_name   s   r   c                   @   s   e Zd ZdS )DaciteErrorN)r	   
__module____qualname__r   r   r   r   r      s    r   c                       s:   e Zd Zd	dee f fddZdeddfddZ  ZS )
DaciteFieldErrorN
field_pathc                       t    || _d S N)super__init__r   selfr   	__class__r   r   r         

zDaciteFieldError.__init__parent_field_pathr   c                 C   s&   | j r| d| j  | _ d S || _ d S )N.r   )r   r   r   r   r   update_path   s   
zDaciteFieldError.update_pathr   )r	   r   r   r   r   r   r    __classcell__r   r   r   r   r      s    r   c                	       sB   e Zd Zd
dededee ddf fddZdefdd	Z  Z	S )WrongTypeErrorN
field_typevaluer   r   c                    s   t  j|d || _|| _d S Nr   )r   r   r#   r$   )r   r#   r$   r   r   r   r   r      s   
zWrongTypeError.__init__c              
   C   s2   d| j  dt| j d| j dtt| j d	S )Nzwrong value type for field "z" - should be "z" instead of value "z" of type "")r   r   r#   r$   typer   r   r   r   __str__   s   zWrongTypeError.__str__r   )
r	   r   r   r   r   r   r   r   r)   r!   r   r   r   r   r"      s    $r"   c                       s6   e Zd Zddee f fddZdefddZ  ZS )	MissingValueErrorNr   c                    s   t  j|d d S r%   )r   r   r   r   r   r   r   &   s   zMissingValueError.__init__r   c                 C   s   d| j  dS )Nzmissing value for field "r&   r   r(   r   r   r   r)   )   s   zMissingValueError.__str__r   )r	   r   r   r   r   r   r)   r!   r   r   r   r   r*   %   s    r*   c                   @   s   e Zd ZdefddZdS )UnionMatchErrorr   c                 C   s(   dt t| j d| j dt | j S )Nzcan not match type "z" to any type of "z	" union: )r   r'   r$   r   r#   r(   r   r   r   r)   .   s   zUnionMatchError.__str__N)r	   r   r   r   r)   r   r   r   r   r+   -   s    r+   c                       sF   e Zd Zd	deeef dee ddf fddZdefddZ	  Z
S )
StrictUnionMatchErrorNunion_matchesr   r   c                    s   t  j|d || _d S r%   )r   r   r-   )r   r-   r   r   r   r   r   6   s   
zStrictUnionMatchError.__init__c                 C   s(   d dd | jD }d| j d| S )N, c                 s   s    | ]}t |V  qd S r   )r   ).0r   r   r   r   	<genexpr>;   s    z0StrictUnionMatchError.__str__.<locals>.<genexpr>z9can not choose between possible Union matches for field "z": )joinr-   r   )r   conflicting_typesr   r   r   r)   :   s   zStrictUnionMatchError.__str__r   )r	   r   r   r   r   r   r   r   r   r)   r!   r   r   r   r   r,   5   s    (r,   c                       s4   e Zd Zdeddf fddZdefddZ  ZS )ForwardReferenceErrormessager   Nc                    r   r   )r   r   r4   )r   r4   r   r   r   r   @   r   zForwardReferenceError.__init__c                 C   s   d| j  S )Nz#can not resolve forward reference: )r4   r(   r   r   r   r)   D   s   zForwardReferenceError.__str__)r	   r   r   r   r   r)   r!   r   r   r   r   r3   ?   s    r3   c                       s8   e Zd Zdee ddf fddZdefddZ  ZS )UnexpectedDataErrorkeysr   Nc                    r   r   )r   r   r6   )r   r6   r   r   r   r   I   r   zUnexpectedDataError.__init__c                 C   s"   d dd | jD }d| dS )Nr.   c                 s   s    | ]	}d | d V  qdS )r&   Nr   )r/   keyr   r   r   r0   N   s    z.UnexpectedDataError.__str__.<locals>.<genexpr>zcan not match z to any data class field)r1   r6   )r   formatted_keysr   r   r   r)   M   s   zUnexpectedDataError.__str__)r	   r   r   r   r   r   r)   r!   r   r   r   r   r5   H   s    r5   N)typingr   r   r   r   r   r   r   	Exceptionr   r   r"   r*   r+   r,   r3   r5   r   r   r   r   <module>   s    
	