
    j.G                       U d Z ddlmZ ddlZddlZddlmZmZ ddl	m
Z
 ddlmZ ej        rddlZddlmZ dd	lmZ neZd
Zded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZded<   dZ ded<   dZ!ded<   dZ"ded<   d Z#ded!<   d"Z$ded"<   d#Z%ded#<   d$Z&ded%<   dZ'd&ed'<    G d( d)          Z(e(Z)ej        r'ej*        ej+        ej,        ej,        f         e(df         Z-	 dLdMd0Z.dNd2Z/dOd4Z0dPd:Z1 e
d;           G d< d=                      Z2 G d> d?          Z3 G d@ dA          Z4 G dB dCe5          Z6 G dD dEeej7        F          Z8 G dG dHeej7        F          Z9dI Z:dJ Z;dK Z<dS )Qz Base classes and helpers.
    )annotationsN)parse_qsurlparse   )
deprecated)ConfigurationError)Protocol)AddressREADzte.Final[str]READ_ACCESSWRITEWRITE_ACCESSDRIVER_BOLTDRIVER_NEO4JSECURITY_TYPE_NOT_SECURE%SECURITY_TYPE_SELF_SIGNED_CERTIFICATESECURITY_TYPE_SECUREboltURI_SCHEME_BOLTzbolt+ssc'URI_SCHEME_BOLT_SELF_SIGNED_CERTIFICATEzbolt+sURI_SCHEME_BOLT_SECUREneo4jURI_SCHEME_NEO4Jz	neo4j+ssc(URI_SCHEME_NEO4J_SELF_SIGNED_CERTIFICATEzneo4j+sURI_SCHEME_NEO4J_SECUREzbolt+routingURI_SCHEME_BOLT_ROUTING#TRUST_SYSTEM_CA_SIGNED_CERTIFICATESTRUST_ALL_CERTIFICATESsystemSYSTEM_DATABASEzte.Final[None]DEFAULT_DATABASEc                  &    e Zd ZdZ	 dddZddZdS )AuthaB  Container for auth details.

    :param scheme: specifies the type of authentication, examples: "basic",
                   "kerberos"
    :type scheme: str | None
    :param principal: specifies who is being authenticated
    :type principal: str | None
    :param credentials: authenticates the principal
    :type credentials: str | None
    :param realm: specifies the authentication provider
    :type realm: str | None
    :param parameters: extra key word parameters passed along to the
                       authentication provider
    :type parameters: typing.Any
    Nschemet.Optional[str]	principalcredentialsrealm
parameterst.AnyreturnNonec                `    || _         ||| _        |r|| _        |r|| _        |r	|| _        d S d S N)r$   r&   r'   r(   r)   )selfr$   r&   r'   r(   r)   s         S/lsinfo/ai/hellotax_ai/base_platform/venv/lib/python3.11/site-packages/neo4j/api.py__init__zAuth.__init__[   sV       &DN 	+*D 	DJ 	)(DOOO	) 	)    otherboolc                z    t          |t                    st          S t          |           t          |          k    S r.   )
isinstancer#   NotImplementedvars)r/   r3   s     r0   __eq__zAuth.__eq__o   s1    %&& 	"!!DzzT%[[((r2   r.   )r$   r%   r&   r%   r'   r%   r(   r%   r)   r*   r+   r,   )r3   r*   r+   r4   )__name__
__module____qualname____doc__r1   r9    r2   r0   r#   r#   J   sP         * "&) ) ) ) )() ) ) ) ) )r2   r#   userstrpasswordr(   r%   r+   c                &    t          d| ||          S )a  Generate a basic auth token for a given user and password.

    This will set the scheme to "basic" for the auth token.

    :param user: user name, this will set the
    :param password: current password, this will set the credentials
    :param realm: specifies the authentication provider

    :returns: auth token for use with :meth:`GraphDatabase.driver` or
        :meth:`AsyncGraphDatabase.driver`
    basicr#   )r?   rA   r(   s      r0   
basic_authrE   |   s     x///r2   base64_encoded_ticketc                $    t          dd|           S )ax  Generate a kerberos auth token with the base64 encoded ticket.

    This will set the scheme to "kerberos" for the auth token.

    :param base64_encoded_ticket: a base64 encoded service ticket, this will set
                                  the credentials

    :returns: auth token for use with :meth:`GraphDatabase.driver` or
        :meth:`AsyncGraphDatabase.driver`
    kerberos rD   )rF   s    r0   kerberos_authrJ      s     
B 5666r2   base64_encoded_tokenc                $    t          dd|           S )ay  Generate an auth token for Single-Sign-On providers.

    This will set the scheme to "bearer" for the auth token.

    :param base64_encoded_token: a base64 encoded authentication token generated
                                 by a Single-Sign-On provider.

    :returns: auth token for use with :meth:`GraphDatabase.driver` or
        :meth:`AsyncGraphDatabase.driver`
    bearerNrD   )rK   s    r0   bearer_authrN      s     $ 4555r2   r&   r'   r$   r)   r*   c                "    t          || ||fi |S )a  Generate a custom auth token.

    :param principal: specifies who is being authenticated
    :param credentials: authenticates the principal
    :param realm: specifies the authentication provider
    :param scheme: specifies the type of authentication
    :param parameters: extra key word parameters passed along to the
                       authentication provider

    :returns: auth token for use with :meth:`GraphDatabase.driver` or
        :meth:`AsyncGraphDatabase.driver`
    rD   )r&   r'   r(   r$   r)   s        r0   custom_authrP      s     & 	;DDDDDr2   z"Use the `Bookmarks` class instead.c                  B    e Zd ZdZddZddZdd	Zedd            ZdS )BookmarkzA Bookmark object contains an immutable list of bookmark string values.

    :param values: ASCII string values

    .. deprecated:: 5.0
        `Bookmark` will be removed in version 6.0.
        Use :class:`Bookmarks` instead.
    valuesr@   r+   r,   c                ,   |r~g }|D ]c}	 |r*|                     d           |                    |           0# t          $ r'}t          d                    |                    d }~ww xY wt          |          | _        d S t                      | _        d S )NasciizThe value {} is not ASCII)encodeappendUnicodeEncodeError
ValueErrorformat	frozenset_values)r/   rS   	bookmarksixes        r0   r1   zBookmark.__init__   s     	'I M MM -		'***!((,,,) M M M$%@%G%G%K%KLLLM$Y//DLLL$;;DLLLs   ,7
A("A##A(c                    d                     d                    d t          | j                  D                                 S ):
        :returns: repr string with sorted values
        z<Bookmark values={{{}}}>, c                8    g | ]}d                      |          S )z'{}')rZ   ).0r^   s     r0   
<listcomp>z%Bookmark.__repr__.<locals>.<listcomp>   s%    ;m;m;mRTFMM"<M<M;m;m;mr2   )rZ   joinsortedr\   r/   s    r0   __repr__zBookmark.__repr__   s@     *00;m;mX^_c_kXlXl;m;m;m1n1nooor2   r4   c                *    t          | j                  S r.   )r4   r\   rh   s    r0   __bool__zBookmark.__bool__   s    DL!!!r2   r[   c                    | j         S )zD
        :returns: immutable list of bookmark string values
        )r\   rh   s    r0   rS   zBookmark.values   s    
 |r2   N)rS   r@   r+   r,   r+   r@   r+   r4   )r+   r[   )	r:   r;   r<   r=   r1   ri   rk   propertyrS   r>   r2   r0   rR   rR      s~         ' ' ' 'p p p p" " " "    X  r2   rR   c                  `    e Zd ZdZd ZddZddZdd	Zedd            Z	e
dd            ZdS )	BookmarksaB  Container for an immutable set of bookmark string values.

    Bookmarks are used to causally chain sessions.
    See :meth:`Session.last_bookmarks` or :meth:`AsyncSession.last_bookmarks`
    for more information.

    Use addition to combine multiple Bookmarks objects::

        bookmarks3 = bookmarks1 + bookmarks2
    c                ,    t                      | _        d S r.   )r[   _raw_valuesrh   s    r0   r1   zBookmarks.__init__   s    $;;r2   r+   r@   c           
         d                     d                    t          t          t	          | j                                                S )ra   z<Bookmarks values={{{}}}>rb   )rZ   rf   mapreprrg   rs   rh   s    r0   ri   zBookmarks.__repr__   s@     +11IIc$t'7 8 899::
 
 	
r2   r4   c                *    t          | j                  S )z-True if there are bookmarks in the container.)r4   rs   rh   s    r0   rk   zBookmarks.__bool__   s    D$%%%r2   r3   c                    t          |t                    r.|s| S |                                 }| j        |j        z  |_        |S t          S )z!Add multiple containers together.)r6   rq   	__class__rs   r7   )r/   r3   rets      r0   __add__zBookmarks.__add__  sM    eY'' 	 ..""C".1BBCOJr2   t.FrozenSet[str]c                    | j         S )zThe raw bookmark values.

        You should not need to access them unless you want to serialize
        bookmarks.

        :returns: immutable list of bookmark string values
        :rtype: frozenset[str]
        )rs   rh   s    r0   
raw_valueszBookmarks.raw_values  s     r2   rS   t.Iterable[str]c                |    |             }g }|D ]}t          |t                    s/t          d                    t	          |                              	 |                    d           n&# t          $ r}t          d| d          |d}~ww xY w|                    |           t          |          |_
        |S )a  Create a Bookmarks object from a list of raw bookmark string values.

        You should not need to use this method unless you want to deserialize
        bookmarks.

        :param values: ASCII string values (raw bookmarks)
        :type values: Iterable[str]
        z)Raw bookmark values must be str. Found {}rU   z
The value z is not ASCIIN)r6   r@   	TypeErrorrZ   typerV   rX   rY   rW   r[   rs   )clsrS   objr]   valuer_   s         r0   from_raw_valueszBookmarks.from_raw_values  s     cee	 	$ 	$EeS)) @ !++16$u+++>+>@ @ @KW%%%%% K K K !Be!B!B!BCCJKU#####I..
s   A,,
B6B

BNrm   rn   )r3   rq   r+   rq   )r+   r|   )rS   r   r+   rq   )r:   r;   r<   r=   r1   ri   rk   r{   ro   r~   classmethodr   r>   r2   r0   rq   rq      s        	 	' ' '
 
 
 
& & & &    	  	  	  X	     [  r2   rq   c                      e Zd ZdZddZedd            Zedd	            Zedd            Ze e	d          d                         Z
ddZdS )
ServerInfozE Represents a package of information relating to a Neo4j server.
    addressr
   protocol_versionVersionc                0    || _         || _        i | _        d S r.   )_address_protocol_version	_metadata)r/   r   r   s      r0   r1   zServerInfo.__init__7  s    !1!r2   r+   c                    | j         S )z/ Network address of the remote server.
        )r   rh   s    r0   r   zServerInfo.address<  s     }r2   c                    | j         S )z Bolt protocol version with which the remote server
        communicates. This is returned as a :class:`.Version`
        object, which itself extends a simple 2-tuple of
        (major, minor) integers.
        )r   rh   s    r0   r   zServerInfo.protocol_versionB  s     %%r2   r@   c                P    t          | j                            d                    S )zS Server agent string by which the remote server identifies
        itself.
        server)r@   r   getrh   s    r0   agentzServerInfo.agentK  s"    
 4>%%h//000r2   zfThe connection id is considered internal information and will no longer be exposed in future versions.c                6    | j                             d          S )z= Unique identifier for the remote server connection.
        connection_id)r   r   rh   s    r0   r   zServerInfo.connection_idR  s     ~!!/222r2   metadatadictr,   c                :    | j                             |           dS )z Update server information with extra metadata. This is
        typically drawn from the metadata received after successful
        connection initialisation.
        N)r   update)r/   r   s     r0   r   zServerInfo.updateZ  s     
 	h'''''r2   N)r   r
   r   r   )r+   r
   )r+   r   rm   )r   r   r+   r,   )r:   r;   r<   r=   r1   ro   r   r   r   r   r   r   r>   r2   r0   r   r   3  s         " " " "
    X
 & & & X& 1 1 1 X1 Z D E E3 3E E X3
( ( ( ( ( (r2   r   c                  N     e Zd Z fdZ fdZd Zd	dZed
d            Z xZ	S )r   c                H    t                                          | |          S r.   )super__new__)r   vry   s     r0   r   zVersion.__new__d  s    wwsA&&&r2   c                    d                     | j        j        t                                                                S )Nz{}{})rZ   ry   r:   r   ri   )r/   ry   s    r0   ri   zVersion.__repr__g  s,    }}T^4egg6F6F6H6HIIIr2   c                R    d                     t          t          |                     S )N.)rf   ru   r@   rh   s    r0   __str__zVersion.__str__j  s    xxC'''r2   r+   bytesc                   t          d          }t          |           D ]\  }}d|cxk    rdk     sn t          d          t          |t                    rHt          |d         dz            || dz
  <   t          |d         |d         z
  dz            || dz
  <   t          |dz            || dz
  <   t          |          S )N   r      zToo many version components   r   )	bytearray	enumeraterY   r6   listintr   )r/   bir   s       r0   to_byteszVersion.to_bytesm  s    aLLdOO 	+ 	+DAq::::A:::: !>???!T"" +!u--1"q&	1" 6771"q&		E	NN1"q&		Qxxr2   r   c                    t          |          }t          |          dk    rt          d          |d         dk    s|d         dk    rt          d          t          |d         |d                   S )Nr   z.Byte representation must be exactly four bytesr   r   z!First two bytes must contain zeror   )r   lenrY   r   )r   r   s     r0   
from_byteszVersion.from_bytesy  sk    aLLq66Q;;MNNNQ4199!		@AAAquae$$$r2   )r+   r   )r   r   r+   r   )
r:   r;   r<   r   ri   r   r   r   r   __classcell__)ry   s   @r0   r   r   b  s        ' ' ' ' 'J J J J J( ( (
 
 
 
 % % % [% % % % %r2   r   c                  V    e Zd ZdZej        d
d            Zej        dd            Zd	S )BookmarkManagera  Class to manage bookmarks throughout the driver's lifetime.

    Neo4j clusters are eventually consistent, meaning that there is no
    guarantee a query will be able to read changes made by a previous query.
    For cases where such a guarantee is necessary, the server provides
    bookmarks to the client. A bookmark is an abstract token that represents
    some state of the database. By passing one or multiple bookmarks along
    with a query, the server will make sure that the query will not get
    executed before the represented state(s) (or a later state) have been
    established.

    The bookmark manager is an interface used by the driver for keeping
    track of the bookmarks and this way keeping sessions automatically
    consistent. Configure the driver to use a specific bookmark manager with
    :ref:`bookmark-manager-ref`.

    This class is just an abstract base class that defines the required
    interface. Create a child class to implement a specific bookmark manager
    or make use of the default implementation provided by the driver through
    :meth:`.GraphDatabase.bookmark_manager()`.

    .. note::
        All methods must be concurrency safe.

    .. versionadded:: 5.0

    .. versionchanged:: 5.3
        The bookmark manager no longer tracks bookmarks per database.
        This effectively changes the signature of almost all bookmark
        manager related methods:

        * :meth:`.update_bookmarks` has no longer a ``database`` argument.
        * :meth:`.get_bookmarks` has no longer a ``database`` argument.
        * The ``get_all_bookmarks`` method was removed.
        * The ``forget`` method was removed.

    .. versionchanged:: 5.8 Stabilized from experimental.
    previous_bookmarkst.Collection[str]new_bookmarksr+   r,   c                    dS )zHandle bookmark updates.

        :param previous_bookmarks:
            The bookmarks used at the start of a transaction
        :param new_bookmarks:
            The new bookmarks retrieved at the end of a transaction
        Nr>   r/   r   r   s      r0   update_bookmarksz BookmarkManager.update_bookmarks  s	     	r2   c                    dS )zuReturn the bookmarks stored in the bookmark manager.

        :returns: The bookmarks for the given database
        Nr>   rh   s    r0   get_bookmarkszBookmarkManager.get_bookmarks  s	     	r2   Nr   r   r   r   r+   r,   r+   r   )r:   r;   r<   r=   abcabstractmethodr   r   r>   r2   r0   r   r     sg        % %N 	    	     r2   r   )	metaclassc                      e Zd ZdZej        d
d            Zej        j        e_        ej        dd            Zej        j        e_        d	S )AsyncBookmarkManagera}  Same as :class:`.BookmarkManager` but with async methods.

    The driver comes with a default implementation of the async bookmark
    manager accessible through :attr:`.AsyncGraphDatabase.bookmark_manager()`.

    .. versionadded:: 5.0

    .. versionchanged:: 5.3
        See :class:`.BookmarkManager` for changes.

    .. versionchanged:: 5.8 Stabilized from experimental.
    r   r   r   r+   r,   c                
   K   d S r.   r>   r   s      r0   r   z%AsyncBookmarkManager.update_bookmarks  s      
 	r2   c                
   K   d S r.   r>   rh   s    r0   r   z"AsyncBookmarkManager.get_bookmarks  s      r2   Nr   r   )	r:   r;   r<   r=   r   r   r   r   r   r>   r2   r0   r   r     s          	     /?G    ,9AMr2   r   c                   t          |           }|j        rt          d          |j        rt          d          |j        t
          k    r-t          d                    |j        t                              |j        t          k    rt          }t          }n|j        t          k    rt          }t          }n|j        t          k    rt          }t          }n|j        t          k    rt          }t          }n|j        t           k    rt          }t          }nk|j        t"          k    rt          }t          }nLt          d                    |j        t          t          t          t          t           t"          g                    |||fS )Nz$Username is not supported in the URIz$Password is not supported in the URIz+Uri scheme {!r} have been renamed. Use {!r}zURI scheme {!r} is not supported. Supported URI schemes are {}. Examples: bolt://host[:port] or neo4j://host[:port][?routing_context])r   usernamer   rA   r$   r   rZ   r   r   r   r   r   r   r   r   r   r   r   )uriparseddriver_typesecurity_types       r0   parse_neo4j_urir     sg   c]]F I !GHHH I !GHHH}/// !N!U!UV\Vceu!v!vwww	/	)	)!0	A	A	A!=	0	0	0!,	*	*	*"0	B	B	B"=	1	1	1",   "i  "p  "pM7& 8'
"
 
"
 
 
 
	 v--r2   c                    | t           S | t          t           fvr$d                    |           }t          |          | S )NzUnsupported access mode {})r   r   rZ   r   )access_modemsgs     r0   check_access_moder     sE    ;555*11+>> %%%r2   c           
         | si S i }t          | d          }|D ]^}||         }t          |          dk    rt          d|d|d| d          |d         }|st          d|d	|d
| d          |||<   _|S )zP Parse the query portion of a URI to generate a routing context dictionary.
    Tr   z&Duplicated query parameters with key 'z
', value 'z' found in query string ''r   zInvalid parameters:'=z' in query string 'z'.)r   r   r   )querycontextr)   key
value_listr   s         r0   parse_routing_contextr     s      	G%&&J  _
z??a$${~{~{~  AK  AK  AK  MR  MR  MR  &S  T  T  T1 	o$$[^[^[^`e`e`eglglgl%mnnnNr2   r.   )r?   r@   rA   r@   r(   r%   r+   r#   )rF   r@   r+   r#   )rK   r@   r+   r#   )r&   r%   r'   r%   r(   r%   r$   r%   r)   r*   r+   r#   )=r=   
__future__r   r   typingturllib.parser   r   _metar   
exceptionsr   TYPE_CHECKINGtyping_extensionster	   	_Protocol
addressingr
   objectr   __annotations__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r#   	AuthTokenUnionTupleAny_TAuthrE   rJ   rN   rP   rR   rq   r   tupler   ABCMetar   r   r   r   r   r>   r2   r0   <module>r      sM  "   # " " " " " 



           
       * * * * * * ? """"777777#######I $ # # # #% % % % %* * * * *, , , , ,*D  D D D D+ & , , , ,&<  < < < <!' ' ' ' '9C ' C C C C(0  0 0 0 0")  ) ) ) ):E ( E E E E)2  2 2 2 2)7  7 7 7 7 * $ * * * *(@  @ @ @ @!) ) ) ) )#'  ' ' ' '() () () () () () () ()X 	? 8WQWQUAE\*D$67F 8<0 0 0 0 0"7 7 7 76 6 6 6E E E E. 011% % % % % % % 21%PG G G G G G G GT,( ,( ,( ,( ,( ,( ,( ,(^% % % % %e % % %B< < < < <i3; < < < <~B B B B B9 B B B B<*. *. *.Z      r2   