B
    eJd                 @   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   J/var/www/html/venv/lib/python3.7/site-packages/_plotly_utils/exceptions.pyr      s   r   c               @   s   e Zd ZdS )PlotlyEmptyDataErrorN)r   r   r   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 )z3See PlotlyGraphObjectError.__init__ for param docs.)	attributeobject_namez/'{attribute}' is not allowed in '{object_name}'T)return_help)r
   r   r   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 )z3See PlotlyGraphObjectError.__init__ for param docs.r   )r    r!   z6'{attribute}' has invalid value inside '{object_name}'T)r"   )r
   r   r   N)r#   r   r$   r   r   r&   r   )r   r%   r   r   r   r
   )r   r   r   r   1   s    
zPlotlyDictValueError.__init__)r   )r   r   r   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 )z3See PlotlyGraphObjectError.__init__ for param docs.r   )indexr!   z:Invalid entry found in '{object_name}' at index, '{index}'T)r"   )r
   r   r   N)r#   r   r$   r   r   r'   r   )r   r%   r   r   r   r
   )r   r   r   r   >   s    
zPlotlyListEntryError.__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 )PlotlyDataTypeErrorr   c                sH   |d |j d}djf |}d}|gt| }tt| j|||d dS )z3See PlotlyGraphObjectError.__init__ for param docs.r   )r(   r!   z:Invalid entry found in '{object_name}' at index, '{index}'z=It's invalid because it doesn't contain a valid 'type' value.)r
   r   r   N)r#   r   r   r   r)   r   )r   r%   r   r   r   r
   Znote)r   r   r   r   K   s    
zPlotlyDataTypeError.__init__)r   )r   r   r   r   r   r   r   )r   r   r)   J   s   r)   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 )N)LookupErrorr   )r   r   r   r   r   `   s    zPlotlyKeyError.__str__N)r   r   r   __doc__r   r   r   r   r   r*   X   s   r*   N)
	Exceptionr   r   r   r   r&   r'   r)   KeyErrorr*   r   r   r   r   <module>   s   