o
    ̳i                     @   s0   d dl mZ G dd deZG dd deZdS )    )Listc                   @   s   e Zd ZdZdS )InstantiationErrorzU
    Raised when a `_component_` field in a config is unable to be instantiated.
    N)__name__
__module____qualname____doc__ r   r   L/home/ubuntu/.local/lib/python3.10/site-packages/torchtune/config/_errors.pyr   
   s    r   c                   @   s*   e Zd ZdZdee fddZdd ZdS )ConfigErrorz
    Raised when the yaml config is not well-formed. Prints all the collected
    errors at once.

    Args:
        errors (List[Exception]): exceptions found when validating `_component_`
            fields in the config
    errorsc                 C   s
   || _ d S )N)r   )selfr   r   r   r	   __init__   s   
zConfigError.__init__c                 C   s   dd | j D }dd| S )Nc                 S   s$   g | ]}t |j d t| qS )z: )typer   str).0er   r   r	   
<listcomp>    s   $ z'ConfigError.__str__.<locals>.<listcomp>z8Config is not well-formed, found the following errors: 

)r   join)r   error_messagesr   r   r	   __str__   s   zConfigError.__str__N)r   r   r   r   r   	Exceptionr   r   r   r   r   r	   r
      s    	r
   N)typingr   r   r   r
   r   r   r   r	   <module>   s   