o
    UhG                     @  sf  d dl mZ d dlmZ G dd deZG dd de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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eZG d#d$ d$eZG d%d& d&eZG d'd( d(eeZG d)d* d*eeeZd+S ),    )annotations)
Collectionc                   @  s   e Zd ZdS )TOMLKitErrorN)__name__
__module____qualname__ r   r   f/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/tomlkit/exceptions.pyr      s    r   c                      s<   e Zd ZdZdd fd
dZedd Zedd Z  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intcolmessage
str | NonereturnNonec                   s<   || _ || _|d u rd}t | d| j  d| j  d S )NzTOML parse errorz	 at line z col )_line_colsuper__init__selfr   r   r   	__class__r   r	   r      s
   $zParseError.__init__c                 C     | j S N)r   r   r   r   r	   r         zParseError.linec                 C  r   r   )r   r   r   r   r	   r      r   zParseError.colr   r   r   r   r   r   r   r   r   )	r   r   r   __doc__r   propertyr   r   __classcell__r   r   r   r	   r
   
   s    	
r
   c                      "   e Zd ZdZd	 fddZ  ZS )
MixedArrayTypesErrorz@
    An array was found that had two or more element types.
    r   r   r   r   r   c                      d}t  j|||d d S )NzMixed types found in arrayr   r   r   r   r   r   r	   r   (      zMixedArrayTypesError.__init__r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   r	   r#   #       r#   c                      r"   )
InvalidNumberErrorz3
    A numeric field was improperly specified.
    r   r   r   r   r   c                   r$   )NzInvalid numberr%   r&   r   r   r   r	   r   3   r'   zInvalidNumberError.__init__r(   r)   r   r   r   r	   r+   .   r*   r+   c                      r"   )
InvalidDateTimeErrorz4
    A datetime field was improperly specified.
    r   r   r   r   r   c                   r$   )NzInvalid datetimer%   r&   r   r   r   r	   r   >   r'   zInvalidDateTimeError.__init__r(   r)   r   r   r   r	   r,   9   r*   r,   c                      r"   )
InvalidDateError0
    A date field was improperly specified.
    r   r   r   r   r   c                   r$   )NzInvalid dater%   r&   r   r   r   r	   r   I   r'   zInvalidDateError.__init__r(   r)   r   r   r   r	   r-   D   r*   r-   c                      r"   )
InvalidTimeErrorr.   r   r   r   r   r   c                   r$   )NzInvalid timer%   r&   r   r   r   r	   r   T   r'   zInvalidTimeError.__init__r(   r)   r   r   r   r	   r/   O   r*   r/   c                      r"   )
InvalidNumberOrDateErrorz;
    A numeric or date field was improperly specified.
    r   r   r   r   r   c                   r$   )NzInvalid number or date formatr%   r&   r   r   r   r	   r   _   r'   z!InvalidNumberOrDateError.__init__r(   r)   r   r   r   r	   r0   Z   r*   r0   c                      r"   )
InvalidUnicodeValueErrorz2
    A unicode code was improperly specified.
    r   r   r   r   r   c                   r$   )NzInvalid unicode valuer%   r&   r   r   r   r	   r   j   r'   z!InvalidUnicodeValueError.__init__r(   r)   r   r   r   r	   r1   e   r*   r1   c                      "   e Zd ZdZd fd	d
Z  ZS )UnexpectedCharErrorz;
    An unexpected character was found during parsing.
    r   r   r   charstrr   r   c                   s    d|}t  j|||d d S )NzUnexpected character: r%   r&   r   r   r   r4   r   r   r   r	   r   u   s   
zUnexpectedCharError.__init__r   r   r   r   r4   r5   r   r   r)   r   r   r   r	   r3   p   r*   r3   c                      r"   )
EmptyKeyErrorz0
    An empty key was found during parsing.
    r   r   r   r   r   c                   r$   )Nz	Empty keyr%   r&   r   r   r   r	   r      r'   zEmptyKeyError.__init__r(   r)   r   r   r   r	   r8   {   r*   r8   c                      r"   )
EmptyTableNameErrorz7
    An empty table name was found during parsing.
    r   r   r   r   r   c                   r$   )NzEmpty table namer%   r&   r   r   r   r	   r      r'   zEmptyTableNameError.__init__r(   r)   r   r   r   r	   r9      r*   r9   c                      r2   )InvalidCharInStringErrorz@
    The string being parsed contains an invalid character.
    r   r   r   r4   r5   r   r   c                   s"   d|d}t  j|||d d S )NzInvalid character z
 in stringr%   r&   r6   r   r   r	   r      s   z!InvalidCharInStringError.__init__r7   r)   r   r   r   r	   r:      r*   r:   c                      r"   )
UnexpectedEofErrorzD
    The TOML being parsed ended before the end of a statement.
    r   r   r   r   r   c                   r$   )NzUnexpected end of filer%   r&   r   r   r   r	   r      r'   zUnexpectedEofError.__init__r(   r)   r   r   r   r	   r;      r*   r;   c                      s$   e Zd ZdZdd fd
dZ  ZS )InternalParserErrorz6
    An error that indicates a bug in the parser.
    Nr   r   r   r   r   r   r   c                   s.   d}|r|d| d7 }t  j|||d d S )NzInternal parser errorz ()r%   r&   )r   r   r   r   msgr   r   r	   r      s   zInternalParserError.__init__r   r   r)   r   r   r   r	   r<      s    r<   c                          e Zd ZdZ fddZ  ZS )NonExistentKeyz&
    A non-existent key was used.
    c                   s   d| d}t  | d S )NKey "z" does not exist.r&   r   keyr   r   r   r	   r      s   zNonExistentKey.__init__r)   r   r   r   r	   r@          r@   c                      r?   )KeyAlreadyPresentz*
    An already present key was used.
    c                   s(   t |d|}d| d}t | d S )NrC   rA   z" already exists.)getattrr   r   rB   r   r   r	   r      s   zKeyAlreadyPresent.__init__r)   r   r   r   r	   rE      rD   rE   c                      s   e Zd Zd fd	d
Z  ZS )InvalidControlCharr   r   r   r4   typer5   r   r   c                   sP   d}|dk r
|d7 }|t |dd  7 }d| d| d}t j|||d d S )	Nz\u00   0   zFControl characters (codes less than 0x1f and 0x7f) are not allowed in z, use z insteadr%   )hexr   r   )r   r   r   r4   rH   display_coder   r   r   r	   r      s   zInvalidControlChar.__init__)
r   r   r   r   r4   r   rH   r5   r   r   r   r   r   r   r!   r   r   r   r	   rG          rG   c                      s   e Zd Zd fddZ  ZS )	InvalidStringErrorvaluer5   invalid_sequencesCollection[str]	delimiterc              	     s6   t |dd }t d| | | d| d d S )N   zInvalid string: z. The character sequences z are invalid.)reprr   r   )r   rQ   rR   rT   repr_r   r   r	   r      s   zInvalidStringError.__init__)rQ   r5   rR   rS   rT   r5   rN   r   r   r   r	   rP      rO   rP   c                   @  s   e Zd ZdZdS )ConvertErrorzRaised when item() fails to convert a value.
    It should be a TypeError, but due to historical reasons
    it needs to subclass ValueError as well.
    N)r   r   r   r   r   r   r   r	   rY      s    rY   N)
__future__r   typingr   	Exceptionr   
ValueErrorr
   r#   r+   r,   r-   r/   r0   r1   r3   r8   r9   r:   r;   r<   KeyErrorr@   rE   rG   rP   	TypeErrorrY   r   r   r   r	   <module>   s,    	