
    ,hF4                        U d Z ddlmZmZmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZm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      Zeee   ee   ee   ee   ee   ee   ee   ee   ee   ee   ee   ee   ee   f   Zeeeeeeeeeeeeeeef   Zi a ee!ef   e"d#<   	 	 dEd%eee!ee!ee   f   f      d&ee   d'ee!ee   f   fd(Z#	 	 	 dFd)e!d*ee$   d+ee$   d,ee%   d'ef
d-Z&d.e'd'efd/Z(i d0ed1ed2ed3ed4ed5ed6ed7ed8ed9ed:ed;ed<ed=ed>ed?ed@eeeeeeeeeeeeeeedAZ)ee$ef   e"dB<   eeeeeeeedCZ*ee!ef   e"dD<   y$)GzPython exceptions.    )DictMappingOptionalTupleTypeUnion   )get_client_error)
StrOrBytes)
read_bytesread_intc                   z     e Zd ZdZ	 	 	 	 ddee   dee   deeeeef   df      dee   ddf
 fd	Z	defd
Z
 xZS )ErrorzException that is base class for all other error exceptions.

    See [1] for more details.

    References:
        [1]: https://dev.mysql.com/doc/connector-python/en/connector-python-api-errors-error.html
    Nmsgerrnovalues.sqlstatereturnc                    t         |           || _        | j                  | _        |xs d| _        || _        | j                  sJd| j                  cxk  rdk  r5n n2t        | j                        | _        |0	 | j                  |z  | _        n| j                  sdx| _        | _        | j                  r_| j                  dk7  rP| j                  | j                  d}| j
                  rd}| j
                  |d	<   nd
} |j                  di || _        | j                  | j                  | j
                  f| _	        y # t        $ r!}| j                   d| d| _        Y d }~d }~ww xY w)Ni  i  z (Warning: )zUnknown error)r   r   z{errno} ({state}): {msg}statez{errno}: {msg} )
super__init__r   	_full_msgr   r   r
   	TypeErrorformatargs)	selfr   r   r   r   errfieldsfmt	__class__s	           X/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/mysql/connector/errors.pyr   zError.__init__.   s*    	[b
 xxTTZZ6$6'

3DH!>#xx&0DH (77DNTX88

b(#zz$((;F}}0"&--w&'SZZ1&1DNZZ?	 ! >"&((;se1=DHH>s   ;D> >	E(E##E(c                     | j                   S N)r   )r    s    r%   __str__zError.__str__P   s    ~~    NNNN)__name__
__module____qualname____doc__r   strintr   r   r   r(   __classcell__r$   s   @r%   r   r   %   s     "#8<"& @c] @ } @ uS#X345	 @
 3- @ 
 @D r)   r   c                       e Zd ZdZy)Warningz Exception for important warningsNr+   r,   r-   r.   r   r)   r%   r4   r4   T   s    *r)   r4   c                       e Zd ZdZy)InterfaceErrorz-Exception for errors related to the interfaceNr5   r   r)   r%   r7   r7   X       7r)   r7   c                       e Zd ZdZy)DatabaseErrorz,Exception for errors related to the databaseNr5   r   r)   r%   r:   r:   \   s    6r)   r:   c                       e Zd ZdZy)InternalErrorz-Exception for errors internal database errorsNr5   r   r)   r%   r<   r<   `   r8   r)   r<   c                       e Zd ZdZy)OperationalErrorz8Exception for errors related to the database's operationNr5   r   r)   r%   r>   r>   d   s    Br)   r>   c                       e Zd ZdZy)ProgrammingErrorz'Exception for errors programming errorsNr5   r   r)   r%   r@   r@   h   s    1r)   r@   c                       e Zd ZdZy)IntegrityErrorz3Exception for errors regarding relational integrityNr5   r   r)   r%   rB   rB   l       =r)   rB   c                       e Zd ZdZy)	DataErrorz;Exception for errors reporting problems with processed dataNr5   r   r)   r%   rE   rE   p   s    Er)   rE   c                       e Zd ZdZy)NotSupportedErrorzBException for errors when an unsupported database feature was usedNr5   r   r)   r%   rG   rG   t   s    Lr)   rG   c                       e Zd ZdZy)	PoolErrorz3Exception for errors relating to connection poolingNr5   r   r)   r%   rI   rI   x   rC   r)   rI   c                       e Zd ZdZy)ConnectionTimeoutErrorzo
    Exception for errors related to the socket connection timing out while connecting with
    the server
    Nr5   r   r)   r%   rK   rK   |   s    r)   rK   c                   t     e Zd ZU dZdZeed<   	 	 	 	 ddee   dee   dee	eef      dee   d	df
 fd
Z
 xZS )ReadTimeoutErrorzWException for errors relating to socket timing out while receiving data from the serverz
    The Read Operation timed out. As a consequence the current connection has been closed to avoid
    any unstable behaviour, consider using the reconnect() option and continue with the current
    session's workflow.
    DEFAULT_READ_TIMEOUT_ERROR_MSGNr   r   r   r   r   c                 >    t         |   | j                  |||       y r'   )r   r   rN   r    r   r   r   r   r$   s        r%   r   zReadTimeoutError.__init__   s     	<<eVXVr)   r*   )r+   r,   r-   r.   rN   r/   __annotations__r   r0   r   r   r1   r2   s   @r%   rM   rM      s}    a+"C  "#,0"&Wc]W }W sCx)	W
 3-W 
W Wr)   rM   c                   t     e Zd ZU dZdZeed<   	 	 	 	 ddee   dee   dee	eef      dee   d	df
 fd
Z
 xZS )WriteTimeoutErrorzSException for errors relating to socket timing out while sending data to the serverz
    The Write Operation timed out. As a consequence the current connection has been closed to avoid
    any unstable behaviour, consider using the reconnect() option to continue with the current
    session's workflow.
    DEFAULT_WRITE_TIMEOUT_ERROR_MSGNr   r   r   r   r   c                 >    t         |   | j                  |||       y r'   )r   r   rT   rP   s        r%   r   zWriteTimeoutError.__init__   s     	==ufhWr)   r*   )r+   r,   r-   r.   rT   r/   rQ   r   r0   r   r   r1   r2   s   @r%   rS   rS      s}    ],#S  "#,0"&Xc]X }X sCx)	X
 3-X 
X Xr)   rS   _CUSTOM_ERROR_EXCEPTIONSNerror	exceptionr   c                    t        | t              r
| si at        S | s|st        S t        | t        t        f      st	        d      t        | t              r| |i} | j                         D ]C  \  }}t        |t              st	        d      	 |t        |t              st        	 |t        |<   E t        S # t        $ r}t	        d      |d}~ww xY w)a  Defines custom exceptions for MySQL server errors.

    This function defines custom exceptions for MySQL server errors and
    returns the current set customizations.

    To reset the customizations, simply supply an empty dictionary.

    Args:
        error: Can be a MySQL Server error number or a dictionary in which case the
               key is the server error number and the value is the exception to be raised.
        exception: If `error` is a MySQL Server error number then you have to pass
                   also the exception class, otherwise you don't.

    Returns:
        dictionary: Current set customizations.

    Examples:
        ```
        import mysql.connector
        from mysql.connector import errorcode

        # Server error 1028 should raise a DatabaseError
        mysql.connector.custom_error_exception(
            1028, mysql.connector.DatabaseError)

        # Or using a dictionary:
        mysql.connector.custom_error_exception({
            1028: mysql.connector.DatabaseError,
            1029: mysql.connector.OperationalError,
            })

        # Reset
        mysql.connector.custom_error_exception({})
        ```
    z<The error argument should be either an integer or dictionaryz!Error number should be an integerNz)Exception should be subclass of Exception)	
isinstancedictrV   r0   
ValueErroritems
issubclass	Exceptionr   )rW   rX   r   
_exceptionr!   s        r%   custom_error_exceptionra      s    R %u#% ''''ec4[)WXX%	""[[] 5z%%@AA	S!J	)J *K +5 '5 $#	  	SHIsR	Ss   B66	C?CCr   r   r   warningc                 $   	 t        |    || |      S # t        $ r Y nw xY w	 t        |    || |      S # t        $ r Y nw xY w|s|rt        | |      S t	        ||       S 	 t        |dd    || |      S # t        $ r t	        || |      cY S w xY w)a>  Get the exception matching the MySQL error

    This function will return an exception based on the SQLState. The given
    message will be passed on in the returned exception.

    The exception returned can be customized using the
    mysql.connector.custom_error_exception() function.

    Returns an Exception
    )r   r   r   )r   r   r      )rV   KeyError_ERROR_EXCEPTIONSr4   r:   _SQLSTATE_CLASS_EXCEPTION)r   r   r   rb   s       r%   get_mysql_exceptionrh     s     '.3ehWW  'CuxPP  5#&&E22F(!A758
 	
  FEHEEFs,    	4 	A A !A5 5BBpacketc                    dx}}	 | d   dk7  rt        d      	 d}	 | dd } t        | d      \  } }| d	   d
k7  r+t	        | t
        t        f      r| j                  d      }n7| }n4t        | dd d      \  } }|j                  d      }| j                  d      }t        |||      S # t        $ r}t        d| d      cY d}~S d}~ww xY w# t        t        f$ r}t        d| d      cY d}~S d}~ww xY w)zReturns an exception object based on the MySQL error

    Returns an exception object based on the MySQL error in the given
    packet.

    Returns an Error-Object.
    N      zPacket is not an error packetz"Failed getting Error information (r      rd   r   #   utf8r	   )r\   
IndexErrorr7   r   rZ   bytes	bytearraydecoder   UnicodeErrorrh   )ri   r   errmsgr!   r   s        r%   get_exceptionrv   ;  s     EFK!9<== 
 &*HK +!9?&5)"45v.)&*a8FHv.H]]6*F ufh77'  K B3%qIJJK" % K B3%qIJJKs;   B% A;C
 %	C.C<CC
C2C-'C2-C20207080A21222324252627282A2B2C2D2E)333435373C3D3F404244HZXA0KHYrg   )i  i  i  i  i  i  i  i  rf   )NN)NNF)+r.   typingr   r   r   r   r   r   localesr
   typesr   utilsr   r   r_   r   r4   r7   r:   r<   r>   r@   rB   rE   rG   rI   rK   rM   rS   ErrorClassTypes
ErrorTypesrV   r0   rQ   ra   r/   boolrh   rq   rv   rg   rf   r   r)   r%   <module>r      s  :  > > %  ',I ,^+i +8U 87E 78M 8C} C2} 2>] >F FM M> >U Wu W&X X& K		O	O	 		 	
& 8: $sO34 9 IM+/@$E#tC/)B$BCCDE@$(@$ S(?++,@$J "#	'F'F	#'F sm'F d^	'F
 'FT 8%  8J  8F 9) 9- 9 	
 9 	
	 9
 	) 9 	) 9 	. 9 	
 9 	
 9 	
 9 	
 9 	
 9 	
 9 	- 9 	
 9  	-! 9" 	-# 9$ 












? 9 4_ 45  F 






	1 4_,- 	r)   