o
    Mh                     @   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                   @      e Zd ZdS )PlotlyErrorN__name__
__module____qualname__ r   r   Y/var/www/html/Persson_Maskin/env/lib/python3.10/site-packages/_plotly_utils/exceptions.pyr          r   c                   @   r   )PlotlyEmptyDataErrorNr   r   r   r   r   r
      r	   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)message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d
i |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}Nr   )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                          e Zd Zd fdd	Z  ZS )PlotlyDictKeyErrorr   c                    P   |d |j d}djdi |}|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return_helpr   Nr   )_namer!   helpr   r   r&   r   r   objr   r   r"   r   r   r   r   r   $      

zPlotlyDictKeyError.__init__r   r   r   r   r   r$   r   r   r   r   r&   #       r&   c                       r%   )PlotlyDictValueErrorr   c                    sV   |d |j d}djdi |}|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   Nr   )r/   r!   r0   r   r   r7   r   r1   r   r   r   r   1   s   

zPlotlyDictValueError.__init__r4   r5   r   r   r   r   r7   0   r6   r7   c                       r%   )PlotlyListEntryErrorr   c                    r'   )	r(   r)   indexr,   :Invalid entry found in '{object_name}' at index, '{index}'Tr-   r   Nr   )r/   r!   r0   r   r   r8   r   r1   r   r   r   r   >   r3   zPlotlyListEntryError.__init__r4   r5   r   r   r   r   r8   =   r6   r8   c                       r%   )PlotlyDataTypeErrorr   c                    sL   |d |j d}djdi |}d}|gt| }tt| j|||d dS )r(   r)   r9   r;   z=It's invalid because it doesn't contain a valid 'type' value.r   Nr   )r/   r!   r   r   r<   r   )r   r2   r   r   r"   r   noter   r   r   r   K   s   

zPlotlyDataTypeError.__init__r4   r5   r   r   r   r   r<   J   r6   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 r   )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&   r7   r8   r<   KeyErrorr>   r   r   r   r   <module>   s    