
    jMC                    |   U d Z ddlmZ ddlZddlmZ ej        rLddlZ	ddl
mZmZmZmZ ddlmZmZmZmZ ej        eeeef         Zej        eef         Zej        eef         Zn'ej        d         Zej        d	         Zej        d
         ZdZded<   dZded<   dZded<   edfedfedfdZded<    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*i d.e"d/e"d0e"d1e"d2e d3e d4e!d5e!d6e!d7e*d8e%d9e%d:e%d;e%d<e%d=e#d>e#e$e)d?Z+d@edA<   dBe(iZ,d@edC<    G dD dEe          Z- G dF dGe-          Z. G dH dIe-          Z/ G dJ dKe/          Z0 G dL dMe-          Z1 G dN dOe1          Z2 G dP dQe1          Z3 G dR dSe1          Z4 G dT dUe-          Z5 G dV dWe-          Z6 G dX dYe-          Z7 G dZ d[e7          Z8 G d\ d]e7          Z9 G d^ d_e7          Z: G d` dae7          Z; G db dce-          Z< G dd dee<          Z= G df dge<          Z> G dh die          Z?dS )ja  
This module contains the core driver exceptions.

Driver API Errors
=================
+ Neo4jError
  + ClientError
    + CypherSyntaxError
    + CypherTypeError
    + ConstraintError
    + AuthError
      + TokenExpired
    + Forbidden
  + DatabaseError
  + TransientError
    + DatabaseUnavailable
    + NotALeader
    + ForbiddenOnReadOnlyDatabase

+ DriverError
  + SessionError
  + TransactionError
    + TransactionNestingError
  + ResultError
    + ResultFailedError
    + ResultConsumedError
    + ResultNotSingleError
  + BrokenRecordError
  + SessionExpired
  + ServiceUnavailable
    + RoutingServiceUnavailable
    + WriteServiceUnavailable
    + ReadServiceUnavailable
    + IncompleteCommit
  + ConfigurationError
    + AuthConfigurationError
    + CertificateConfigurationError

Connector API Errors
====================
+ BoltError
  + BoltHandshakeError
  + BoltRoutingError
  + BoltConnectionError
      + BoltSecurityError
      + BoltConnectionBroken
      + BoltConnectionClosed
  + BoltFailure
  + BoltProtocolError
  + Bolt*
    )annotationsN   )
deprecated)AsyncManagedTransactionAsyncResultAsyncSessionAsyncTransaction)ManagedTransactionResultSessionTransaction)r   r	   r
   r   )r   r   )r   r   ClientErrorzte.Final[str]CLASSIFICATION_CLIENTTransientErrorCLASSIFICATION_TRANSIENTDatabaseErrorCLASSIFICATION_DATABASEz&Neo.ClientError.Transaction.Terminatedz-Neo.ClientError.Transaction.LockClientStopped)-Neo.ClientError.Security.AuthorizationExpiredz)Neo.TransientError.Transaction.Terminatedz0Neo.TransientError.Transaction.LockClientStoppedz*t.Dict[str, t.Tuple[str, t.Optional[str]]]ERROR_REWRITE_MAPc                      e Zd ZdZdZdZdZdZdZdZ	dZ
e	 	 ddd
            Zed             Z ed          dd            ZddZddZ  ed          e          ZddZddZ  ed          e          Z fdZ xZS )
Neo4jErrorzC Raised when the Cypher engine returns an error to the client.
    NFmessaget.Optional[str]codemetadatat.Anyreturnc                f   |pd}|pd}	 |                     d          \  }}}}t                              |d          \  }}	||}|	|	}n# t          $ r t          }d}d}Y nw xY w|                     ||          }
 |
|          }||_        ||_        ||_        ||_	        ||_
        ||_        |S )NzAn unknown error occurredz&Neo.DatabaseError.General.UnknownError.NNGeneralUnknownError)splitr   get
ValueErrorr   _extract_error_classr   r   classificationcategorytitler   )clsr   r   r   _r'   r(   r)   classification_overridecode_overrideerror_classinsts               Z/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/neo4j/exceptions.pyhydratezNeo4jError.hydrate   s     88??	%15C.A~x "%%dL99 3#]&2!8($  	# 	# 	#4N H"EEE	# ..~tDD{7##	, 
 s   A A#"A#c                    |t           k    r%	 t          |         S # t          $ r
 t          cY S w xY w|t          k    r%	 t
          |         S # t          $ r
 t          cY S w xY w|t          k    rt          S | S N)	r   client_errorsKeyErrorr   r   transient_errorsr   r   r   )r*   r'   r   s      r0   r&   zNeo4jError._extract_error_class   s    222#$T** # # #""""# 777&'-- & & &%%%%& 666   Js    ..A
 
AAzzNeo4jError.is_retriable is deprecated and will be removed in a future version. Please use Neo4jError.is_retryable instead.boolc                *    |                                  S )a>  Whether the error is retryable.

        See :meth:`.is_retryable`.

        :returns: :const:`True` if the error is retryable,
            :const:`False` otherwise.

        .. deprecated:: 5.0
            This method will be removed in a future version.
            Please use :meth:`.is_retryable` instead.
        )is_retryableselfs    r0   is_retriablezNeo4jError.is_retriable   s        """    c                    | j         S )  Whether the error is retryable.

        Indicates whether a transaction that yielded this error makes sense to
        retry. This method makes mostly sense when implementing a custom
        retry policy in conjunction with :ref:`explicit-transactions-ref`.

        :returns: :const:`True` if the error is retryable,
            :const:`False` otherwise.

        .. versionadded:: 5.0
        )
_retryabler:   s    r0   r9   zNeo4jError.is_retryable   s     r=   c                    | j         dk    S )Nr   )r   r:   s    r0    _unauthenticates_all_connectionsz+Neo4jError._unauthenticates_all_connections   s    yKKKr=   zNeo4jError.invalidates_all_connections is deprecated and will be removed in a future version. It is an internal method and not meant for external use.c                    t          | j        t                    sdS | j        dv rdS | j                            d          r| j        dk    rdS dS )NF)z)Neo.ClientError.Database.DatabaseNotFoundz+Neo.ClientError.Transaction.InvalidBookmarkz2Neo.ClientError.Transaction.InvalidBookmarkMixture#Neo.ClientError.Statement.TypeErrorz'Neo.ClientError.Statement.ArgumentErrorzNeo.ClientError.Request.InvalidTNeo.ClientError.Security.r   )
isinstancer   str
startswithr:   s    r0   _is_fatal_during_discoveryz%Neo4jError._is_fatal_during_discovery   so     $)S)) 	59 < < < 4I  !<== 	I "8 8 84ur=   c                H    | j         dS | j                             d          S )NFrE   )r   rH   r:   s    r0   _has_security_codezNeo4jError._has_security_code  s&    95y##$?@@@r=   zNeo4jError.is_fatal_during_discovery is deprecated and will be removed in a future version. It is an internal method and not meant for external use.c                    | j         s| j        r!d                    | j         | j                  S t                                                      S )Nz'{{code: {code}}} {{message: {message}}})r   r   )r   r   formatsuper__str__)r;   	__class__s    r0   rO   zNeo4jError.__str__  sS    9 	 	<CCY D    ww   r=   r    )r   r   r   r   r   r   r   r   r   r7   )__name__
__module____qualname____doc__r   r   r'   r(   r)   r   r@   classmethodr1   r&   r   r<   r9   rB   invalidates_all_connectionsrI   rK   is_fatal_during_discoveryrO   __classcell__rP   s   @r0   r   r      s         G DNHEHJ $( $    [B   [( Z	F # # #	 #   L L L L#**	# # '	#( #(   $A A A A!

	! ! !	!" !"! ! ! ! ! ! ! ! !r=   r   c                      e Zd ZdZdS )r   z\ The Client sent a bad request - changing the request might yield a successful outcome.
    NrR   rS   rT   rU    r=   r0   r   r                r=   c                      e Zd ZdZdS )CypherSyntaxError
    Nr\   r]   r=   r0   r`   r`   #  r^   r=   r`   c                      e Zd ZdZdS )CypherTypeErrorra   Nr\   r]   r=   r0   rc   rc   )  r^   r=   rc   c                      e Zd ZdZdS )ConstraintErrorra   Nr\   r]   r=   r0   re   re   /  r^   r=   re   c                      e Zd ZdZdS )	AuthErrorz0 Raised when authentication failure occurs.
    Nr\   r]   r=   r0   rg   rg   5  r^   r=   rg   c                      e Zd ZdZdS )TokenExpireda'   Raised when the authentication token has expired.

    A new driver instance with a fresh authentication token needs to be
    created, unless the driver was configured using a non-static
    :class:`.AuthManager`. In that case, the error will be
    :exc:`.TokenExpiredRetryable` instead.
    Nr\   r]   r=   r0   ri   ri   ;             r=   ri   c                      e Zd ZdZdS )	Forbiddenra   Nr\   r]   r=   r0   rl   rl   F  r^   r=   rl   c                      e Zd ZdZdS )r   z1 The database failed to service the request.
    Nr\   r]   r=   r0   r   r   L  r^   r=   c                      e Zd ZdZdZdS )r   zi The database cannot service the request right now, retrying later might yield a successful outcome.
    TN)rR   rS   rT   rU   r@   r]   r=   r0   r   r   R  s          JJJr=   c                      e Zd ZdZdS )DatabaseUnavailablera   Nr\   r]   r=   r0   rp   rp   Z  r^   r=   rp   c                      e Zd ZdZdS )
NotALeaderra   Nr\   r]   r=   r0   rr   rr   `  r^   r=   rr   c                      e Zd ZdZdS )ForbiddenOnReadOnlyDatabasera   Nr\   r]   r=   r0   rt   rt   f  r^   r=   rt   z1Neo.ClientError.Schema.ConstraintValidationFailedz*Neo.ClientError.Schema.ConstraintViolationz6Neo.ClientError.Statement.ConstraintVerificationFailedz-Neo.ClientError.Statement.ConstraintViolationz'Neo.ClientError.Statement.InvalidSyntaxz%Neo.ClientError.Statement.SyntaxErrorz#Neo.ClientError.Procedure.TypeErrorz%Neo.ClientError.Statement.InvalidTyperD   z3Neo.ClientError.General.ForbiddenOnReadOnlyDatabasez Neo.ClientError.General.ReadOnlyz1Neo.ClientError.Schema.ForbiddenOnConstraintIndexz/Neo.ClientError.Schema.IndexBelongsToConstraintz"Neo.ClientError.Security.Forbiddenz9Neo.ClientError.Transaction.ForbiddenDueToTransactionTypez,Neo.ClientError.Security.AuthorizationFailedz%Neo.ClientError.Security.Unauthorized)z%Neo.ClientError.Security.TokenExpiredz"Neo.ClientError.Cluster.NotALeaderzt.Dict[str, t.Type[Neo4jError]]r4   z.Neo.TransientError.General.DatabaseUnavailabler6   c                      e Zd ZdZddZdS )DriverErrorz- Raised when the Driver raises an error.
    r   r7   c                    dS )r?   Fr]   r:   s    r0   r9   zDriverError.is_retryable  s	     ur=   NrQ   rR   rS   rT   rU   r9   r]   r=   r0   rv   rv     s2              r=   rv   c                  .     e Zd ZU dZded<    fdZ xZS )SessionErrorz8 Raised when an error occurs while using a session.
    	_TSessionsessionc                H     t                      j        |i | || _        d S r3   )rN   __init__r|   )r;   session_argskwargsrP   s       r0   r~   zSessionError.__init__  s*    $)&)))r=   rR   rS   rT   rU   __annotations__r~   rY   rZ   s   @r0   rz   rz     sR                            r=   rz   c                  .     e Zd ZU dZded<    fdZ xZS )TransactionErrorz< Raised when an error occurs while using a transaction.
    _TTransactiontransactionc                H     t                      j        |i | || _        d S r3   )rN   r~   r   )r;   transaction_r   r   rP   s       r0   r~   zTransactionError.__init__  s-    $)&)))'r=   r   rZ   s   @r0   r   r     sR           ( ( ( ( ( ( ( ( (r=   r   c                      e Zd ZdZdS )TransactionNestingErrorz6 Raised when transactions are nested incorrectly.
    Nr\   r]   r=   r0   r   r     r^   r=   r   c                  .     e Zd ZU dZded<    fdZ xZS )ResultErrorz8Raised when an error occurs while using a result object._TResultresultc                H     t                      j        |i | || _        d S r3   )rN   r~   r   )r;   result_r   r   rP   s       r0   r~   zResultError.__init__  s*    $)&)))r=   r   rZ   s   @r0   r   r     sL         BB        r=   r   c                      e Zd ZdZdS )ResultFailedErrora  Raised when trying to access records of a failed result.

    A :class:`.Result` will be considered failed if
     * itself encountered an error while fetching records
     * another result within the same transaction encountered an error while
       fetching records
    Nr\   r]   r=   r0   r   r     rj   r=   r   c                      e Zd ZdZdS )ResultConsumedErrorz:Raised when trying to access records of a consumed result.Nr\   r]   r=   r0   r   r     s        DDDDr=   r   c                      e Zd ZdZdS )ResultNotSingleErrorzARaised when a result should have exactly one record but does not.Nr\   r]   r=   r0   r   r     s        KKKKr=   r   c                      e Zd ZdZdS )BrokenRecordErrorz Raised when accessing a Record's field that couldn't be decoded.

    This can for instance happen when the server sends a zoned datetime with a
    zone id unknown to the client.
    Nr\   r]   r=   r0   r   r     s           r=   r   c                      e Zd ZdZddZdS )SessionExpiredzm Raised when a session is no longer able to fulfil
    the purpose described by its original parameters.
    r   r7   c                    dS NTr]   r:   s    r0   r9   zSessionExpired.is_retryable      tr=   NrQ   rx   r]   r=   r0   r   r     s2              r=   r   c                      e Zd ZdZddZdS )ServiceUnavailablez Raised when no database service is available.

    This may be due to incorrect configuration or could indicate a runtime
    failure of a database service that the driver is unable to route around.
    r   r7   c                    dS r   r]   r:   s    r0   r9   zServiceUnavailable.is_retryable  r   r=   NrQ   rx   r]   r=   r0   r   r     s2              r=   r   c                      e Zd ZdZdS )RoutingServiceUnavailablez2 Raised when no routing service is available.
    Nr\   r]   r=   r0   r   r     r^   r=   r   c                      e Zd ZdZdS )WriteServiceUnavailablez0 Raised when no write service is available.
    Nr\   r]   r=   r0   r   r     r^   r=   r   c                      e Zd ZdZdS )ReadServiceUnavailablez/ Raised when no read service is available.
    Nr\   r]   r=   r0   r   r     r^   r=   r   c                      e Zd ZdZddZdS )IncompleteCommitaB   Raised when the client looses connection while committing a transaction

    Raised when a disconnection occurs while still waiting for a commit
    response. For non-idempotent write transactions, this leaves the data
    in an unknown state with regard to whether the transaction completed
    successfully or not.
    r   r7   c                    dS )NFr]   r:   s    r0   r9   zIncompleteCommit.is_retryable"  s    ur=   NrQ   rx   r]   r=   r0   r   r     s2              r=   r   c                      e Zd ZdZdS )ConfigurationErrorz? Raised when there is an error concerning a configuration.
    Nr\   r]   r=   r0   r   r   '  r^   r=   r   c                      e Zd ZdZdS )AuthConfigurationErrorzJ Raised when there is an error with the authentication configuration.
    Nr\   r]   r=   r0   r   r   -  r^   r=   r   c                      e Zd ZdZdS )CertificateConfigurationErrorzG Raised when there is an error with the certificate configuration.
    Nr\   r]   r=   r0   r   r   3  r^   r=   r   c                      e Zd ZdZdS )UnsupportedServerProductz< Raised when an unsupported server product is detected.
    Nr\   r]   r=   r0   r   r   8  r^   r=   r   )@rU   
__future__r   typingt_metar   TYPE_CHECKINGtyping_extensionste_async.workr   r   r   r	   
_sync.workr
   r   r   r   Unionr   r   r{   r   r   r   r   r   	Exceptionr   r   r`   rc   re   rg   ri   rl   r   r   rp   rr   rt   r4   r6   rv   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]   r=   r0   <module>r      s[  "2 2 2j # " " " " "           ? 3""""                       G35E.< =Mw{F*+Hg-.IIG @ AMw./H12I (5  4 4 4 4*:  : : : :)8  8 8 8 8 	!$6 	G2 	N9A A     ,V! V! V! V! V! V! V! V!t    *              k       k              9              J       Z       .              .   
"2 8"2 1/	"2
 =o"2 4_"2 ./@"2 ,->"2 *?"2 ,_"2 *?"2$ :;V%"2& '	'"2( 8)"2* 6y+"2, ))-"2. @/"24 3I5"26 ,Y7"2< .: +5C"2 "2 "2 " " " "N 56I5         )   &         ;      ( ( ( ( ({ ( ( (    .       +          E E E E E+ E E E
L L L L L; L L L
           [               2       0       /   
 
 
 
 
) 
 
 
           /       $6   
    y     r=   