U
    SZf                     @   s   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 )c                   @   s   e Zd ZdS )PlotlyErrorN__name__
__module____qualname__ r   r   </tmp/pip-unpacked-wheel-5ksk5baj/_plotly_utils/exceptions.pyr      s   r   c                   @   s   e Zd ZdS )PlotlyEmptyDataErrorNr   r   r   r   r   r      s   r   c                       s&   e Zd Zd fdd	Zdd Z  ZS )PlotlyGraphObjectError r   c                    s0   || _ || _t|| _|| _tt| | dS )a  
        General graph object error for validation failures.

        :param (str|unicode) message: The error message.
        :param (iterable) path: A path pointing to the error.
        :param notes: Add additional notes, but keep default exception message.

        N)messageZplain_messagelistpathnotessuperr	   __init__)selfr   r   r   	__class__r   r   r   
   s
    	
zPlotlyGraphObjectError.__init__c                 C   s<   | j dddd | jD  d d| jd}djf |S )	z6This is called by Python to present the error message.[z][c                 s   s   | ]}t |V  qd S N)repr).0kr   r   r   	<genexpr>   s     z1PlotlyGraphObjectError.__str__.<locals>.<genexpr>]
r   r   r   z){message}

Path To Error: {path}

{notes})r   joinr   r   format)r   format_dictr   r   r   __str__   s
    
zPlotlyGraphObjectError.__str__)r
   r   r   )r   r   r   r   r    __classcell__r   r   r   r   r	   	   s   r	   c                       s   e Zd Zd fdd	Z  ZS )PlotlyDictKeyErrorr   c                    sL   |d |j d}djf |}|jddgt| }tt| j|||d dS )3See PlotlyGraphObjectError.__init__ for param docs.	attributeobject_namez/'{attribute}' is not allowed in '{object_name}'TZreturn_helpr   N)_namer   helpr   r   r"   r   r   objr   r   r   r   r   r   r   r   $   s    
  zPlotlyDictKeyError.__init__)r   r   r   r   r   r!   r   r   r   r   r"   #   s   r"   c                       s   e Zd Zd fdd	Z  ZS )PlotlyDictValueErrorr   c                    sR   |d |j d}djf |}|j|d ddgt| }tt| j|||d dS )r#   r$   r%   z6'{attribute}' has invalid value inside '{object_name}'Tr(   )r   r   r   N)r)   r   r*   r   r   r.   r   r+   r   r   r   r   1   s    
  zPlotlyDictValueError.__init__)r   r-   r   r   r   r   r.   0   s   r.   c                       s   e Zd Zd fdd	Z  ZS )PlotlyListEntryErrorr   c                    sL   |d |j d}djf |}|jddgt| }tt| j|||d dS )r#   r$   indexr'   :Invalid entry found in '{object_name}' at index, '{index}'Tr(   r   N)r)   r   r*   r   r   r/   r   r+   r   r   r   r   >   s    
  zPlotlyListEntryError.__init__)r   r-   r   r   r   r   r/   =   s   r/   c                       s   e Zd Zd fdd	Z  ZS )PlotlyDataTypeErrorr   c                    sH   |d |j d}djf |}d}|gt| }tt| j|||d dS )r#   r$   r0   r2   z=It's invalid because it doesn't contain a valid 'type' value.r   N)r)   r   r   r   r3   r   )r   r,   r   r   r   r   Znoter   r   r   r   K   s    
  zPlotlyDataTypeError.__init__)r   r-   r   r   r   r   r3   J   s   r3   c                   @   s   e Zd ZdZdd ZdS )PlotlyKeyErrora  
    KeyErrors are not printed as beautifully as other errors (this is so that
    {}[''] prints    "KeyError: ''" and not "KeyError:"). So here we use
    LookupError's __str__ to make a PlotlyKeyError object which will print nicer
    error messages for KeyErrors.
    c                 C   s
   t | S r   )LookupErrorr    )r   r   r   r   r    `   s    zPlotlyKeyError.__str__N)r   r   r   __doc__r    r   r   r   r   r4   X   s   r4   N)
	Exceptionr   r   r	   r"   r.   r/   r3   KeyErrorr4   r   r   r   r   <module>   s   