
    Ieo                       d dl mZ d dlmZ  G d de      Z G d dee      Z G d de      Z G d	 d
e      Z	 G d de      Z
 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"ee      Z G d# d$e      Z G d% d&e      Z G d' d(ee      Zy))*    )annotations)
Collectionc                      e Zd Zy)TOMLKitErrorN)__name__
__module____qualname__     4/usr/lib/python3/dist-packages/tomlkit/exceptions.pyr   r      s    r   r   c                  F     e Zd ZdZdd fdZed        Zed        Z xZS )
ParseErrorz
    This error occurs when the parser encounters a syntax error
    in the TOML being parsed. The error references the line and
    location within the line where the error was encountered.
    c                    || _         || _        |d}t        |   | d| j                    d| j                          y )NzTOML parse errorz	 at line z col )_line_colsuper__init__selflinecolmessage	__class__s       r   r   zParseError.__init__   sA    
	?(GG9Idjj\tyykJKr   c                    | j                   S N)r   r   s    r   r   zParseError.line   s    zzr   c                    | j                   S r   )r   r   s    r   r   zParseError.col   s    yyr   r   r   intr   r   r   z
str | NonereturnNone)	r   r   r	   __doc__r   propertyr   r   __classcell__r   s   @r   r   r   
   s6    L    r   r   c                  $     e Zd ZdZd fdZ xZS )MixedArrayTypesErrorz@
    An array was found that had two or more element types.
    c                .    d}t         |   |||       y )NzMixed types found in arrayr   r   r   r   s       r   r   zMixedArrayTypesError.__init__(   s    .sG4r   r   r   r   r   r    r!   r   r   r	   r"   r   r$   r%   s   @r   r'   r'   #       5 5r   r'   c                  $     e Zd ZdZd fdZ xZS )InvalidNumberErrorz3
    A numeric field was improperly specified.
    c                .    d}t         |   |||       y )NzInvalid numberr)   r*   r   s       r   r   zInvalidNumberError.__init__3   s    "sG4r   r+   r,   r%   s   @r   r/   r/   .   r-   r   r/   c                  $     e Zd ZdZd fdZ xZS )InvalidDateTimeErrorz4
    A datetime field was improperly specified.
    c                .    d}t         |   |||       y )NzInvalid datetimer)   r*   r   s       r   r   zInvalidDateTimeError.__init__>       $sG4r   r+   r,   r%   s   @r   r2   r2   9   r-   r   r2   c                  $     e Zd ZdZd fdZ xZS )InvalidDateError0
    A date field was improperly specified.
    c                .    d}t         |   |||       y )NzInvalid dater)   r*   r   s       r   r   zInvalidDateError.__init__I        sG4r   r+   r,   r%   s   @r   r6   r6   D   r-   r   r6   c                  $     e Zd ZdZd fdZ xZS )InvalidTimeErrorr7   c                .    d}t         |   |||       y )NzInvalid timer)   r*   r   s       r   r   zInvalidTimeError.__init__T   r9   r   r+   r,   r%   s   @r   r;   r;   O   r-   r   r;   c                  $     e Zd ZdZd fdZ xZS )InvalidNumberOrDateErrorz;
    A numeric or date field was improperly specified.
    c                .    d}t         |   |||       y )NzInvalid number or date formatr)   r*   r   s       r   r   z!InvalidNumberOrDateError.__init___   s    1sG4r   r+   r,   r%   s   @r   r>   r>   Z   r-   r   r>   c                  $     e Zd ZdZd fdZ xZS )InvalidUnicodeValueErrorz2
    A unicode code was improperly specified.
    c                .    d}t         |   |||       y )NzInvalid unicode valuer)   r*   r   s       r   r   z!InvalidUnicodeValueError.__init__j   s    )sG4r   r+   r,   r%   s   @r   rA   rA   e   r-   r   rA   c                  $     e Zd ZdZd fdZ xZS )UnexpectedCharErrorz;
    An unexpected character was found during parsing.
    c                F    dt        |       }t        | 	  |||       y )NzUnexpected character: r)   reprr   r   r   r   r   charr   r   s        r   r   zUnexpectedCharError.__init__u   s'    *4:,7sG4r   r   r   r   r   rI   strr    r!   r,   r%   s   @r   rD   rD   p   r-   r   rD   c                  $     e Zd ZdZd fdZ xZS )EmptyKeyErrorz0
    An empty key was found during parsing.
    c                .    d}t         |   |||       y )Nz	Empty keyr)   r*   r   s       r   r   zEmptyKeyError.__init__   s    sG4r   r+   r,   r%   s   @r   rM   rM   {   r-   r   rM   c                  $     e Zd ZdZd fdZ xZS )EmptyTableNameErrorz7
    An empty table name was found during parsing.
    c                .    d}t         |   |||       y )NzEmpty table namer)   r*   r   s       r   r   zEmptyTableNameError.__init__   r4   r   r+   r,   r%   s   @r   rP   rP      r-   r   rP   c                  $     e Zd ZdZd fdZ xZS )InvalidCharInStringErrorz@
    The string being parsed contains an invalid character.
    c                H    dt        |       d}t        | 	  |||       y )NzInvalid character z
 in stringr)   rF   rH   s        r   r   z!InvalidCharInStringError.__init__   s)    &tDzl*=sG4r   rJ   r,   r%   s   @r   rS   rS      r-   r   rS   c                  $     e Zd ZdZd fdZ xZS )UnexpectedEofErrorzD
    The TOML being parsed ended before the end of a statement.
    c                .    d}t         |   |||       y )NzUnexpected end of filer)   r*   r   s       r   r   zUnexpectedEofError.__init__   s    *sG4r   r+   r,   r%   s   @r   rV   rV      r-   r   rV   c                  &     e Zd ZdZdd fdZ xZS )InternalParserErrorz6
    An error that indicates a bug in the parser.
    c                D    d}|r	|d| dz  }t         |   |||       y )NzInternal parser errorz ()r)   r*   )r   r   r   r   msgr   s        r   r   zInternalParserError.__init__   s1    %Ry?"CsC0r   r   r   r,   r%   s   @r   rY   rY      s    1 1r   rY   c                  "     e Zd ZdZ fdZ xZS )NonExistentKeyz&
    A non-existent key was used.
    c                0    d| d}t         |   |       y )NKey "z" does not exist.r*   r   keyr   r   s      r   r   zNonExistentKey.__init__   s    #/0!r   r,   r%   s   @r   r^   r^      s    " "r   r^   c                  "     e Zd ZdZ fdZ xZS )KeyAlreadyPresentz*
    An already present key was used.
    c                J    t        |d|      }d| d}t        | 	  |       y )Nrb   r`   z" already exists.)getattrr   r   ra   s      r   r   zKeyAlreadyPresent.__init__   s-    c5#&#/0!r   r,   r%   s   @r   rd   rd      s    " "r   rd   c                        e Zd Zd fdZ xZS )InvalidControlCharc                v    d}|dk  r|dz  }|t        |      dd  z  }d| d| d}t        | 	  |||       y )	Nz\u00   0   zFControl characters (codes less than 0x1f and 0x7f) are not allowed in z, use z insteadr)   )hexr   r   )r   r   r   rI   typedisplay_coder   r   s          r   r   zInvalidControlChar.__init__   sc    "9CLD	!"%##'& ).* 	 	sG4r   )
r   r   r   r   rI   r   rn   rK   r    r!   r   r   r	   r   r$   r%   s   @r   rh   rh      s    5 5r   rh   c                        e Zd Zd fdZ xZS )InvalidStringErrorc           	     V    t        |      dd }t        | 	  d| | | d| d       y )N   zInvalid string: z. The character sequences z are invalid.rF   )r   valueinvalid_sequences	delimiterrepr_r   s        r   r   zInvalidStringError.__init__   sB    UAb!yk% <''8&9H	
r   )rv   rK   rw   zCollection[str]rx   rK   rp   r%   s   @r   rr   rr      s    
 
r   rr   N)
__future__r   typingr   	Exceptionr   
ValueErrorr   r'   r/   r2   r6   r;   r>   rA   rD   rM   rP   rS   rV   rY   KeyErrorr^   rd   rh   rr   r
   r   r   <module>r      s    " 	9 	\ 25: 55 55: 55z 55z 55z 55z 55* 55J 55* 55z 55 5
1* 
1"X| "	" 	"5 5$
\ 
r   