
    Jch                     8   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d)S )*    )
Collection)Optionalc                       e Zd ZdS )TOMLKitErrorN)__name__
__module____qualname__     2lib/python3.11/site-packages/tomlkit/exceptions.pyr   r      s        Dr   r   c            	       n     e Zd ZdZd
dededee         ddf 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.
    Nlinecolmessagereturnc                     || _         || _        |d}t                                          | d| j          d| j                    d S )NzTOML parse errorz	 at line z col )_line_colsuper__init__selfr   r   r   	__class__s       r   r   zParseError.__init__   sV    
	 	)(GGJJdjJJtyJJKKKKKr   c                     | j         S N)r   r   s    r   r   zParseError.line   s
    zr   c                     | j         S r   )r   r   s    r   r   zParseError.col   s
    yr   r   )r   r   r	   __doc__intr   strr   propertyr   r   __classcell__r   s   @r   r   r   
   s         L LS Ls LXc] Ld L L L L L L   X   X    r   r   c                   0     e Zd ZdZdededdf fdZ xZS )MixedArrayTypesErrorz@
    An array was found that had two or more element types.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzMixed types found in arrayr   r   r   r   s       r   r   zMixedArrayTypesError.__init__(   s-    .sG44444r   r   r   r	   r   r    r   r#   r$   s   @r   r&   r&   #   \         5S 5s 5t 5 5 5 5 5 5 5 5 5 5r   r&   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidNumberErrorz3
    A numeric field was improperly specified.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid numberr(   r)   r   s       r   r   zInvalidNumberError.__init__3   s-    "sG44444r   r*   r$   s   @r   r-   r-   .   r+   r   r-   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidDateTimeErrorz4
    A datetime field was improperly specified.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid datetimer(   r)   r   s       r   r   zInvalidDateTimeError.__init__>   -    $sG44444r   r*   r$   s   @r   r0   r0   9   r+   r   r0   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidDateError0
    A date field was improperly specified.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid dater(   r)   r   s       r   r   zInvalidDateError.__init__I   -     sG44444r   r*   r$   s   @r   r4   r4   D   r+   r   r4   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidTimeErrorr5   r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid timer(   r)   r   s       r   r   zInvalidTimeError.__init__T   r7   r   r*   r$   s   @r   r9   r9   O   r+   r   r9   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidNumberOrDateErrorz;
    A numeric or date field was improperly specified.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid number or date formatr(   r)   r   s       r   r   z!InvalidNumberOrDateError.__init___   s-    1sG44444r   r*   r$   s   @r   r<   r<   Z   r+   r   r<   c                   0     e Zd ZdZdededdf fdZ xZS )InvalidUnicodeValueErrorz2
    A unicode code was improperly specified.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzInvalid unicode valuer(   r)   r   s       r   r   z!InvalidUnicodeValueError.__init__j   s-    )sG44444r   r*   r$   s   @r   r?   r?   e   r+   r   r?   c                   4     e Zd ZdZdedededdf fdZ xZS )UnexpectedCharErrorz;
    An unexpected character was found during parsing.
    r   r   charr   Nc                 t    dt          |           }t                                          |||           d S )NzUnexpected character: r(   reprr   r   r   r   r   rC   r   r   s        r   r   zUnexpectedCharError.__init__u   s;    74::77sG44444r   r   r   r	   r   r    r!   r   r#   r$   s   @r   rB   rB   p   c         5S 5s 5# 5$ 5 5 5 5 5 5 5 5 5 5r   rB   c                   0     e Zd ZdZdededdf fdZ xZS )EmptyKeyErrorz0
    An empty key was found during parsing.
    r   r   r   Nc                 T    d}t                                          |||           d S )Nz	Empty keyr(   r)   r   s       r   r   zEmptyKeyError.__init__   s-    sG44444r   r*   r$   s   @r   rK   rK   {   r+   r   rK   c                   0     e Zd ZdZdededdf fdZ xZS )EmptyTableNameErrorz7
    An empty table name was found during parsing.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzEmpty table namer(   r)   r   s       r   r   zEmptyTableNameError.__init__   r2   r   r*   r$   s   @r   rN   rN      r+   r   rN   c                   4     e Zd ZdZdedededdf fdZ xZS )InvalidCharInStringErrorz@
    The string being parsed contains an invalid character.
    r   r   rC   r   Nc                 v    dt          |           d}t                                          |||           d S )NzInvalid character z
 in stringr(   rE   rG   s        r   r   z!InvalidCharInStringError.__init__   s>    =tDzz===sG44444r   rH   r$   s   @r   rQ   rQ      rI   r   rQ   c                   0     e Zd ZdZdededdf fdZ xZS )UnexpectedEofErrorzD
    The TOML being parsed ended before the end of a statement.
    r   r   r   Nc                 T    d}t                                          |||           d S )NzUnexpected end of filer(   r)   r   s       r   r   zUnexpectedEofError.__init__   s-    *sG44444r   r*   r$   s   @r   rT   rT      r+   r   rT   c            	       B     e Zd ZdZddededee         ddf fdZ xZS )	InternalParserErrorz6
    An error that indicates a bug in the parser.
    Nr   r   r   r   c                 j    d}|r	|d| dz  }t                                          |||           d S )NzInternal parser errorz ()r(   r)   )r   r   r   r   msgr   s        r   r   zInternalParserError.__init__   sG    % 	#????"CsC00000r   r   )	r   r   r	   r   r    r   r!   r   r#   r$   s   @r   rW   rW      sl         1 1S 1s 1Xc] 1d 1 1 1 1 1 1 1 1 1 1r   rW   c                   "     e Zd ZdZ fdZ xZS )NonExistentKeyz&
    A non-existent key was used.
    c                 V    d| d}t                                          |           d S )NKey "z" does not exist.r)   r   keyr   r   s      r   r   zNonExistentKey.__init__   s1    0#000!!!!!r   r   r   r	   r   r   r#   r$   s   @r   r\   r\      sB         " " " " " " " " "r   r\   c                   "     e Zd ZdZ fdZ xZS )KeyAlreadyPresentz*
    An already present key was used.
    c                 x    t          |d|          }d| d}t                                          |           d S )Nr`   r^   z" already exists.)getattrr   r   r_   s      r   r   zKeyAlreadyPresent.__init__   sB    c5#&&0#000!!!!!r   ra   r$   s   @r   rc   rc      sB         " " " " " " " " "r   rc   c            
       4     e Zd Zdededededdf
 fdZ xZS )InvalidControlCharr   r   rC   typer   Nc                     d}|dk     r|dz  }|t          |          dd          z  }d                    ||          }t                                          |||           d S )Nz\u00   0   zXControl characters (codes less than 0x1f and 0x7f) are not allowed in {}, use {} insteadr(   )hexformatr   r   )r   r   r   rC   rh   display_coder   r   s          r   r   zInvalidControlChar.__init__   sv    "9 	 CLD		!""%#VD,77 	
 	sG44444r   )r   r   r	   r    r!   r   r#   r$   s   @r   rg   rg      s`        5S 5s 5# 5S 5T 5 5 5 5 5 5 5 5 5 5r   rg   c                   8     e Zd Zdedee         def fdZ xZS )InvalidStringErrorvalueinvalid_sequences	delimiterc           	          t          |          dd         }t                                          d| | | d| d           d S )N   zInvalid string: z. The character sequences z are invalid.rE   )r   rr   rs   rt   repr_r   s        r   r   zInvalidStringError.__init__   sv    UAbD!Hy H% H H H'8H H H	
 	
 	
 	
 	
r   )r   r   r	   r!   r   r   r#   r$   s   @r   rq   rq      sW        
c 
jo 
RU 
 
 
 
 
 
 
 
 
 
r   rq   N)typingr   r   	Exceptionr   
ValueErrorr   r&   r-   r0   r4   r9   r<   r?   rB   rK   rN   rQ   rT   rW   KeyErrorr\   rc   rg   rq   r
   r   r   <module>r}      sW              	 	 	 	 	9 	 	 	
    \   25 5 5 5 5: 5 5 55 5 5 5 5 5 5 55 5 5 5 5: 5 5 55 5 5 5 5z 5 5 55 5 5 5 5z 5 5 55 5 5 5 5z 5 5 55 5 5 5 5z 5 5 55 5 5 5 5* 5 5 55 5 5 5 5J 5 5 55 5 5 5 5* 5 5 55 5 5 5 5z 5 5 55 5 5 5 5 5 5 5
1 
1 
1 
1 
1* 
1 
1 
1" " " " "X| " " "	" 	" 	" 	" 	" 	" 	" 	"5 5 5 5 5 5 5 5"
 
 
 
 
\ 
 
 
 
 
r   