
    mBNj                        d dl mZ ddlmZ ej
                  r ej                  d      Z G d d      Z	 	 d		 	 	 	 	 d
dZ	y)    )annotations   )_typing_Tc                  4    e Zd ZdZ	 	 d	 	 	 	 	 	 	 ddZddZy)Querya  
    A query with attached extra data.

    This wrapper class for queries is used to attach extra data to queries
    passed to :meth:`.Session.run`/:meth:`.AsyncSession.run` and
    :meth:`.Driver.execute_query`/:meth:`.AsyncDriver.execute_query`,
    fulfilling a similar role as :func:`.unit_of_work` for transactions
    functions.

    :param text: The query text.
    :type text: typing.LiteralString
    :param metadata:
        a dictionary with metadata.
        Specified metadata will be attached to the executing transaction
        and visible in the output of ``SHOW TRANSACTIONS YIELD *``
        It will also get logged to the ``query.log``.
        This functionality makes it easier to tag transactions and is
        equivalent to the ``dbms.setTXMetaData`` procedure, see
        https://neo4j.com/docs/cypher-manual/current/clauses/transaction-clauses/#query-listing-transactions
        and https://neo4j.com/docs/operations-manual/current/reference/procedures/
        for reference.
    :type metadata: typing.Dict[str, typing.Any] | None
    :param timeout:
        the transaction timeout in seconds.
        Transactions that execute longer than the configured timeout will
        be terminated by the database.
        This functionality allows user code to limit query/transaction
        execution time.
        The specified timeout overrides the default timeout configured in
        the database using the ``db.transaction.timeout`` setting
        (``dbms.transaction.timeout`` before Neo4j 5.0).
        Values higher than ``db.transaction.timeout`` will be ignored and
        will fall back to the default for server versions between 4.2 and
        5.2 (inclusive).
        The value should not represent a negative duration.
        A ``0`` duration will make the transaction execute indefinitely.
        :data:`None` will use the default timeout configured on the server.
    :type timeout: float | None
    Nc                .    || _         || _        || _        y N)textmetadatatimeout)selfr   r   r   s       b/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/neo4j/_work/query.py__init__zQuery.__init__C   s     	     c                0    t        | j                        }|S r
   )strr   )r   r   s     r   __str__zQuery.__str__N   s    
 !$DIIr   NN)r   t.LiteralStringr   dict[str, t.Any] | Noner   float | NonereturnNone)r   r   )__name__
__module____qualname____doc__r   r    r   r   r   r      s@    &V -1 $			 *	 		
 
	r   r   Nc                      fd}|S )a  
    Configure a transaction function.

    This function is a decorator for transaction functions that allows extra
    control over how the transaction is carried out.

    For example, a timeout may be applied::

        from neo4j import unit_of_work


        @unit_of_work(timeout=100)
        def count_people_tx(tx):
            result = tx.run("MATCH (a:Person) RETURN count(a) AS persons")
            record = result.single()
            return record["persons"]

    :param metadata:
        a dictionary with metadata.
        Specified metadata will be attached to the executing transaction
        and visible in the output of ``SHOW TRANSACTIONS YIELD *``
        It will also get logged to the ``query.log``.
        This functionality makes it easier to tag transactions and is
        equivalent to the ``dbms.setTXMetaData`` procedure, see
        https://neo4j.com/docs/cypher-manual/current/clauses/transaction-clauses/#query-listing-transactions
        and https://neo4j.com/docs/operations-manual/current/reference/procedures/
        for reference.
    :type metadata: typing.Dict[str, typing.Any] | None

    :param timeout:
        the transaction timeout in seconds.
        Transactions that execute longer than the configured timeout will
        be terminated by the database.
        This functionality allows user code to limit query/transaction
        execution time.
        The specified timeout overrides the default timeout configured in
        the database using the ``db.transaction.timeout`` setting
        (``dbms.transaction.timeout`` before Neo4j 5.0).
        Values higher than ``db.transaction.timeout`` will be ignored and
        will fall back to the default for server versions between 4.2 and
        5.2 (inclusive).
        The value should not represent a negative duration.
        A ``0`` duration will make the transaction execute indefinitely.
        :data:`None` will use the default timeout configured on the server.
    :type timeout: float | None

    :rtype: typing.Callable[[T], T]
    c                0      fd}|_         |_        |S )Nc                      | i |S r
   r   )argskwargsfs     r   wrappedz.unit_of_work.<locals>.wrapper.<locals>.wrapped   s    d%f%%r   )r   r   )r%   r&   r   r   s   ` r   wrapperzunit_of_work.<locals>.wrapper   s    	& $!r   r   )r   r   r'   s   `` r   unit_of_workr(   W   s    j Nr   r   )r   r   r   r   r   zt.Callable[[_T], _T])

__future__r    r   tTYPE_CHECKINGTypeVarr   r   r(   r   r   r   <module>r.      sW   " #  ??	4B: :| )- =%== =r   