
    gZw                    N   d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d d	lm
Z
 d d
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" e
rddlm#Z# ddlm$Z$ ddlm%Z%  ede       Z& ed!e	ed"f          Z' G d# d$ee         Z( G d% d&ee(ee'            Z) G d' d(e(e         Z* G d) d*ee(e         Z+ G d+ d,e(e   ejX                        Z- ed-d.       Z.d0d/Z/y)1    )annotationsN)Any)AsyncIterator)Optional)overload)Sequence)Tuple)TYPE_CHECKING)TypeVar   )exc   )util)Result)_NO_ROW)_R)	_WithKeys)FilterResult)FrozenResult)ResultMetaData)Row)
RowMapping)_generative)greenlet_spawn)Literal)Self)CursorResult)_KeyIndexType)_UniqueFilterType_T)bound_TP.c                  @    e Zd ZU dZded<   ded<   d	dZed
d       Zy)AsyncCommon Result[Any]_real_resultr   	_metadatac                ^   K   t        | j                  j                         d{    y7 w)zClose this result.N)r   r'   closeselfs    ]/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/sqlalchemy/ext/asyncio/result.pyr*   zAsyncCommon.close2   s"      T..44555s   #-+-c                .    | j                   j                  S )zproxies the .closed attribute of the underlying result object,
        if any, else raises ``AttributeError``.

        .. versionadded:: 2.0.0b3

        )r'   closedr+   s    r-   r/   zAsyncCommon.closed7   s       '''    N)returnNone)r1   bool)__name__
__module____qualname__	__slots____annotations__r*   propertyr/   r%   r0   r-   r$   r$   ,   s,    I6
 ( (r0   r$   c                     e Zd ZU dZdZded<   d$dZed%d       Zd%dZ	e
d&d'd	       Zd(d
Z	 d&	 	 	 d)dZd*dZd+dZ	 d&	 	 	 d,dZd*dZd-dZd.dZd+dZd+dZed/d       Zed0d       Zd0dZe	 	 	 	 d1d       Zed2d       Zd2dZd.dZed1d       Zed0d       Zd0dZd3dZe	 	 	 	 	 	 d4d       Zed5d        Zed6d7d!       Zd6d7d"Zd8d#Zy)9AsyncResultal  An asyncio wrapper around a :class:`_result.Result` object.

    The :class:`_asyncio.AsyncResult` only applies to statement executions that
    use a server-side cursor.  It is returned only from the
    :meth:`_asyncio.AsyncConnection.stream` and
    :meth:`_asyncio.AsyncSession.stream` methods.

    .. note:: As is the case with :class:`_engine.Result`, this object is
       used for ORM results returned by :meth:`_asyncio.AsyncSession.execute`,
       which can yield instances of ORM mapped objects either individually or
       within tuple-like rows.  Note that these result objects do not
       deduplicate instances or rows automatically as is the case with the
       legacy :class:`_orm.Query` object. For in-Python de-duplication of
       instances or rows, use the :meth:`_asyncio.AsyncResult.unique` modifier
       method.

    .. versionadded:: 1.4

    r%   Result[_TP]r'   c                    || _         |j                  | _        |j                  | _        |j                  | _        d | _        d|j
                  v r | j                  d|j
                  d          y y )N_row_getter)r'   r(   _unique_filter_state_source_supports_scalars_post_creational_filter__dict___set_memoized_attribute)r,   real_results     r-   __init__zAsyncResult.__init__[   sn    '$..$/$D$D!(3(L(L%'+$ K000(({33MB 1r0   c                    | S )zApply a "typed tuple" typing filter to returned rows.

        The :attr:`_asyncio.AsyncResult.t` attribute is a synonym for
        calling the :meth:`_asyncio.AsyncResult.tuples` method.

        .. versionadded:: 2.0

        r%   r+   s    r-   tzAsyncResult.tj   s	     r0   c                    | S )aB  Apply a "typed tuple" typing filter to returned rows.

        This method returns the same :class:`_asyncio.AsyncResult` object
        at runtime,
        however annotates as returning a :class:`_asyncio.AsyncTupleResult`
        object that will indicate to :pep:`484` typing tools that plain typed
        ``Tuple`` instances are returned rather than rows.  This allows
        tuple unpacking and ``__getitem__`` access of :class:`_engine.Row`
        objects to by typed, for those cases where the statement invoked
        itself included typing information.

        .. versionadded:: 2.0

        :return: the :class:`_result.AsyncTupleResult` type at typing time.

        .. seealso::

            :attr:`_asyncio.AsyncResult.t` - shorter synonym

            :attr:`_engine.Row.t` - :class:`_engine.Row` version

        r%   r+   s    r-   tupleszAsyncResult.tuplesv   s	    0 r0   Nc                (    t               |f| _        | S )zApply unique filtering to the objects returned by this
        :class:`_asyncio.AsyncResult`.

        Refer to :meth:`_engine.Result.unique` in the synchronous
        SQLAlchemy API for a complete behavioral description.

        setr?   r,   strategys     r-   uniquezAsyncResult.unique   s     &)UH$5!r0   c                $    | j                  |      S )zEstablish the columns that should be returned in each row.

        Refer to :meth:`_engine.Result.columns` in the synchronous
        SQLAlchemy API for a complete behavioral description.

        _column_slicesr,   col_expressionss     r-   columnszAsyncResult.columns   s     ""?33r0   c               f   K   | j                   }	 t        || |       d{   }|r| ny7 w)a  Iterate through sub-lists of rows of the size given.

        An async iterator is returned::

            async def scroll_results(connection):
                result = await connection.stream(select(users_table))

                async for partition in result.partitions(100):
                    print("list of rows: %s" % partition)

        Refer to :meth:`_engine.Result.partitions` in the synchronous
        SQLAlchemy API for a complete behavioral description.

        N_manyrow_getterr   r,   sizegetter	partitions       r-   
partitionszAsyncResult.partitions   s:     $ %%,VT4@@I @   1/1c                H   K   t        | j                         d{   S 7 w)zcA synonym for the :meth:`_asyncio.AsyncResult.all` method.

        .. versionadded:: 2.0

        Nr   _allrowsr+   s    r-   fetchallzAsyncResult.fetchall   s      $DMM2222   " "c                `   K   t        | j                  |        d{   }|t        u ry|S 7 w)a  Fetch one row.

        When all rows are exhausted, returns None.

        This method is provided for backwards compatibility with
        SQLAlchemy 1.x.x.

        To fetch the first row of a result only, use the
        :meth:`_asyncio.AsyncResult.first` method.  To iterate through all
        rows, iterate the :class:`_asyncio.AsyncResult` object directly.

        :return: a :class:`_engine.Row` object if no filters are applied,
         or ``None`` if no rows remain.

        Nr   _onerow_getterr   r,   rows     r-   fetchonezAsyncResult.fetchone   s1       #4#6#6=='>J	 >   .,.c                L   K   t        | j                  | |       d{   S 7 w)a  Fetch many rows.

        When all rows are exhausted, returns an empty list.

        This method is provided for backwards compatibility with
        SQLAlchemy 1.x.x.

        To fetch rows in groups, use the
        :meth:`._asyncio.AsyncResult.partitions` method.

        :return: a list of :class:`_engine.Row` objects.

        .. seealso::

            :meth:`_asyncio.AsyncResult.partitions`

        Nr   rX   r,   rZ   s     r-   	fetchmanyzAsyncResult.fetchmany   s#     * $D$8$8$EEEE   $"$c                H   K   t        | j                         d{   S 7 w)zReturn all rows in a list.

        Closes the result set after invocation.   Subsequent invocations
        will return an empty list.

        :return: a list of :class:`_engine.Row` objects.

        Nr`   r+   s    r-   allzAsyncResult.all   s      $DMM2222rc   c                    | S Nr%   r+   s    r-   	__aiter__zAsyncResult.__aiter__      r0   c                r   K   t        | j                  |        d {   }|t        u r
t               |S 7 wrs   r   rf   r   StopAsyncIterationrg   s     r-   	__anext__zAsyncResult.__anext__  5     "4#6#6=='>$&&J	 >   757c                N   K   t        | j                  ddd       d{   S 7 w)a  Fetch the first row or ``None`` if no row is present.

        Closes the result set and discards remaining rows.

        .. note::  This method returns one **row**, e.g. tuple, by default.
           To return exactly one single scalar value, that is, the first
           column of the first row, use the
           :meth:`_asyncio.AsyncResult.scalar` method,
           or combine :meth:`_asyncio.AsyncResult.scalars` and
           :meth:`_asyncio.AsyncResult.first`.

           Additionally, in contrast to the behavior of the legacy  ORM
           :meth:`_orm.Query.first` method, **no limit is applied** to the
           SQL query which was invoked to produce this
           :class:`_asyncio.AsyncResult`;
           for a DBAPI driver that buffers results in memory before yielding
           rows, all rows will be sent to the Python process and all but
           the first row will be discarded.

           .. seealso::

                :ref:`migration_20_unify_select`

        :return: a :class:`_engine.Row` object, or None
         if no rows remain.

        .. seealso::

            :meth:`_asyncio.AsyncResult.scalar`

            :meth:`_asyncio.AsyncResult.one`

        FNr   _only_one_rowr+   s    r-   firstzAsyncResult.first  s&     D $D$6$6ueLLLL   %#%c                N   K   t        | j                  ddd       d{   S 7 w)a  Return at most one result or raise an exception.

        Returns ``None`` if the result has no rows.
        Raises :class:`.MultipleResultsFound`
        if multiple rows are returned.

        .. versionadded:: 1.4

        :return: The first :class:`_engine.Row` or ``None`` if no row
         is available.

        :raises: :class:`.MultipleResultsFound`

        .. seealso::

            :meth:`_asyncio.AsyncResult.first`

            :meth:`_asyncio.AsyncResult.one`

        TFNr}   r+   s    r-   one_or_nonezAsyncResult.one_or_none0  s%     * $D$6$6eUKKKKr   c                   K   y wrs   r%   r+   s    r-   
scalar_onezAsyncResult.scalar_oneG  s	     >A   c                   K   y wrs   r%   r+   s    r-   r   zAsyncResult.scalar_oneJ  	     '*r   c                N   K   t        | j                  ddd       d{   S 7 w)aB  Return exactly one scalar result or raise an exception.

        This is equivalent to calling :meth:`_asyncio.AsyncResult.scalars` and
        then :meth:`_asyncio.AsyncScalarResult.one`.

        .. seealso::

            :meth:`_asyncio.AsyncScalarResult.one`

            :meth:`_asyncio.AsyncResult.scalars`

        TNr}   r+   s    r-   r   zAsyncResult.scalar_oneM  s%      $D$6$6dDIIIIr   c                   K   y wrs   r%   r+   s    r-   scalar_one_or_nonezAsyncResult.scalar_one_or_none\  s      r   c                   K   y wrs   r%   r+   s    r-   r   zAsyncResult.scalar_one_or_nonea  s	     9<r   c                N   K   t        | j                  ddd       d{   S 7 w)aH  Return exactly one scalar result or ``None``.

        This is equivalent to calling :meth:`_asyncio.AsyncResult.scalars` and
        then :meth:`_asyncio.AsyncScalarResult.one_or_none`.

        .. seealso::

            :meth:`_asyncio.AsyncScalarResult.one_or_none`

            :meth:`_asyncio.AsyncResult.scalars`

        TFNr}   r+   s    r-   r   zAsyncResult.scalar_one_or_noned  s%      $D$6$6eTJJJJr   c                N   K   t        | j                  ddd       d{   S 7 w)a  Return exactly one row or raise an exception.

        Raises :class:`.NoResultFound` if the result returns no
        rows, or :class:`.MultipleResultsFound` if multiple rows
        would be returned.

        .. note::  This method returns one **row**, e.g. tuple, by default.
           To return exactly one single scalar value, that is, the first
           column of the first row, use the
           :meth:`_asyncio.AsyncResult.scalar_one` method, or combine
           :meth:`_asyncio.AsyncResult.scalars` and
           :meth:`_asyncio.AsyncResult.one`.

        .. versionadded:: 1.4

        :return: The first :class:`_engine.Row`.

        :raises: :class:`.MultipleResultsFound`, :class:`.NoResultFound`

        .. seealso::

            :meth:`_asyncio.AsyncResult.first`

            :meth:`_asyncio.AsyncResult.one_or_none`

            :meth:`_asyncio.AsyncResult.scalar_one`

        TFNr}   r+   s    r-   onezAsyncResult.ones  s%     : $D$6$6dEJJJJr   c                   K   y wrs   r%   r+   s    r-   scalarzAsyncResult.scalar  s	     DGr   c                   K   y wrs   r%   r+   s    r-   r   zAsyncResult.scalar  s	     #&r   c                N   K   t        | j                  ddd       d{   S 7 w)a  Fetch the first column of the first row, and close the result set.

        Returns ``None`` if there are no rows to fetch.

        No validation is performed to test if additional rows remain.

        After calling this method, the object is fully closed,
        e.g. the :meth:`_engine.CursorResult.close`
        method will have been called.

        :return: a Python scalar value, or ``None`` if no rows remain.

        FTNr}   r+   s    r-   r   zAsyncResult.scalar  s%      $D$6$6udKKKKr   c                >   K   t        t        |        d{   S 7 w)a  Return a callable object that will produce copies of this
        :class:`_asyncio.AsyncResult` when invoked.

        The callable object returned is an instance of
        :class:`_engine.FrozenResult`.

        This is used for result set caching.  The method must be called
        on the result when it has been unconsumed, and calling the method
        will consume the result fully.   When the :class:`_engine.FrozenResult`
        is retrieved from a cache, it can be called any number of times where
        it will produce a new :class:`_engine.Result` object each time
        against its stored set of rows.

        .. seealso::

            :ref:`do_orm_execute_re_executing` - example usage within the
            ORM to implement a result-set cache.

        N)r   r   r+   s    r-   freezezAsyncResult.freeze  s     * $L$7777s   c                     y rs   r%   r,   indexs     r-   scalarszAsyncResult.scalars  s     !$r0   c                     y rs   r%   r+   s    r-   r   zAsyncResult.scalars  s    HKr0   c                     y rs   r%   r   s     r-   r   zAsyncResult.scalars  s    KNr0   c                .    t        | j                  |      S )a>  Return an :class:`_asyncio.AsyncScalarResult` filtering object which
        will return single elements rather than :class:`_row.Row` objects.

        Refer to :meth:`_result.Result.scalars` in the synchronous
        SQLAlchemy API for a complete behavioral description.

        :param index: integer or row key indicating the column to be fetched
         from each row, defaults to ``0`` indicating the first column.

        :return: a new :class:`_asyncio.AsyncScalarResult` filtering object
         referring to this :class:`_asyncio.AsyncResult` object.

        )AsyncScalarResultr'   r   s     r-   r   zAsyncResult.scalars  s     !!2!2E::r0   c                ,    t        | j                        S )a  Apply a mappings filter to returned rows, returning an instance of
        :class:`_asyncio.AsyncMappingResult`.

        When this filter is applied, fetching rows will return
        :class:`_engine.RowMapping` objects instead of :class:`_engine.Row`
        objects.

        :return: a new :class:`_asyncio.AsyncMappingResult` filtering object
         referring to the underlying :class:`_result.Result` object.

        )AsyncMappingResultr'   r+   s    r-   mappingszAsyncResult.mappings  s     "$"3"344r0   )rD   r<   )r1   zAsyncTupleResult[_TP]rs   rN   zOptional[_UniqueFilterType]r1   r   rT   r   r1   r   )rZ   Optional[int]r1   z!AsyncIterator[Sequence[Row[_TP]]])r1   Sequence[Row[_TP]])r1   zOptional[Row[_TP]])rZ   r   r1   r   )r1   zAsyncResult[_TP])r1   zRow[_TP])r,   AsyncResult[Tuple[_T]]r1   r    r1   r   )r,   r   r1   Optional[_T]r1   zOptional[Any])r1   zFrozenResult[_TP])r,   r   r   z
Literal[0]r1   AsyncScalarResult[_T])r,   r   r1   r   )r   )r   r   r1   zAsyncScalarResult[Any]r1   r   )r4   r5   r6   __doc__r7   r8   rE   r9   rG   rI   r   rO   rU   r]   rb   ri   rn   rq   rt   ry   r   r   r   r   r   r   r   r   r   r   r%   r0   r-   r;   r;   B   s   ( I 	 	4 	 	4 %)!	*63. %)F!F	F.
3"MHL. A A* *J $	  < <KK> G G& &L 8. $$$-7$	$ $ K KN N; 5r0   r;   c                      e Zd ZdZdZdZddZ	 d	 	 	 ddZ	 d	 	 	 ddZddZ	ddd	Z
dd
ZddZddZddZddZddZy)r   a  A wrapper for a :class:`_asyncio.AsyncResult` that returns scalar values
    rather than :class:`_row.Row` values.

    The :class:`_asyncio.AsyncScalarResult` object is acquired by calling the
    :meth:`_asyncio.AsyncResult.scalars` method.

    Refer to the :class:`_result.ScalarResult` object in the synchronous
    SQLAlchemy API for a complete behavioral description.

    .. versionadded:: 1.4

    r%   Fc                    || _         |j                  r|j                  | _        d | _        n;|j                  j	                  |g      | _        t        j                  d      | _        |j                  | _        y Nr   )r'   r@   r(   rA   _reduceoperator
itemgetterr?   )r,   rD   r   s      r-   rE   zAsyncScalarResult.__init__  sc    '//(22DN+/D((22::E7CDN+3+>+>q+AD($/$D$D!r0   Nc                (    t               |f| _        | S )zApply unique filtering to the objects returned by this
        :class:`_asyncio.AsyncScalarResult`.

        See :meth:`_asyncio.AsyncResult.unique` for usage details.

        rK   rM   s     r-   rO   zAsyncScalarResult.unique       &)UH$5!r0   c               f   K   | j                   }	 t        || |       d{   }|r| ny7 w)zIterate through sub-lists of elements of the size given.

        Equivalent to :meth:`_asyncio.AsyncResult.partitions` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        NrW   rY   s       r-   r]   zAsyncScalarResult.partitions  :      %%,VT4@@I @r^   c                H   K   t        | j                         d{   S 7 w)z@A synonym for the :meth:`_asyncio.AsyncScalarResult.all` method.Nr`   r+   s    r-   rb   zAsyncScalarResult.fetchall)        $DMM2222rc   c                L   K   t        | j                  | |       d{   S 7 w)zFetch many objects.

        Equivalent to :meth:`_asyncio.AsyncResult.fetchmany` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        Nrl   rm   s     r-   rn   zAsyncScalarResult.fetchmany.  s#      $D$8$8$EEEEro   c                H   K   t        | j                         d{   S 7 w)zReturn all scalar values in a list.

        Equivalent to :meth:`_asyncio.AsyncResult.all` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        Nr`   r+   s    r-   rq   zAsyncScalarResult.all8  s      $DMM2222rc   c                    | S rs   r%   r+   s    r-   rt   zAsyncScalarResult.__aiter__B  ru   r0   c                r   K   t        | j                  |        d {   }|t        u r
t               |S 7 wrs   rw   rg   s     r-   ry   zAsyncScalarResult.__anext__E  rz   r{   c                N   K   t        | j                  ddd       d{   S 7 w)zFetch the first object or ``None`` if no object is present.

        Equivalent to :meth:`_asyncio.AsyncResult.first` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        FNr}   r+   s    r-   r   zAsyncScalarResult.firstL  %      $D$6$6ueLLLLr   c                N   K   t        | j                  ddd       d{   S 7 w)zReturn at most one object or raise an exception.

        Equivalent to :meth:`_asyncio.AsyncResult.one_or_none` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        TFNr}   r+   s    r-   r   zAsyncScalarResult.one_or_noneV  %      $D$6$6eUKKKKr   c                N   K   t        | j                  ddd       d{   S 7 w)zReturn exactly one object or raise an exception.

        Equivalent to :meth:`_asyncio.AsyncResult.one` except that
        scalar values, rather than :class:`_engine.Row` objects,
        are returned.

        TFNr}   r+   s    r-   r   zAsyncScalarResult.one`  %      $D$6$6dEJJJJr   )rD   r&   r   r   rs   r   rZ   r   r1   zAsyncIterator[Sequence[_R]]r1   Sequence[_R]rZ   r   r1   r   )r1   zAsyncScalarResult[_R]r1   r   r1   zOptional[_R])r4   r5   r6   r   r7   _generate_rowsrE   rO   r]   rb   rn   rq   rt   ry   r   r   r   r%   r0   r-   r   r     s{     IN
E 15- 
 %)!	$(3
F3MLKr0   r   c                      e Zd ZdZdZdZ ej                  d      ZddZ		 d	 	 	 ddZ
ddZ	 d	 	 	 dd	Zdd
ZddZ	 d	 	 	 ddZddZddZddZddZddZddZy)r   a  A wrapper for a :class:`_asyncio.AsyncResult` that returns dictionary
    values rather than :class:`_engine.Row` values.

    The :class:`_asyncio.AsyncMappingResult` object is acquired by calling the
    :meth:`_asyncio.AsyncResult.mappings` method.

    Refer to the :class:`_result.MappingResult` object in the synchronous
    SQLAlchemy API for a complete behavioral description.

    .. versionadded:: 1.4

    r%   T_mappingc                    || _         |j                  | _        |j                  | _        |j                  r"| j                  j	                  dg      | _        y y r   )r'   r?   r(   r@   r   )r,   results     r-   rE   zAsyncMappingResult.__init__  sK    "$*$?$?!))**!^^33QC8DN +r0   Nc                (    t               |f| _        | S )zApply unique filtering to the objects returned by this
        :class:`_asyncio.AsyncMappingResult`.

        See :meth:`_asyncio.AsyncResult.unique` for usage details.

        rK   rM   s     r-   rO   zAsyncMappingResult.unique  r   r0   c                $    | j                  |      S )z:Establish the columns that should be returned in each row.rQ   rS   s     r-   rU   zAsyncMappingResult.columns  s    ""?33r0   c               f   K   | j                   }	 t        || |       d{   }|r| ny7 w)zIterate through sub-lists of elements of the size given.

        Equivalent to :meth:`_asyncio.AsyncResult.partitions` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        NrW   rY   s       r-   r]   zAsyncMappingResult.partitions  r   r^   c                H   K   t        | j                         d{   S 7 w)zAA synonym for the :meth:`_asyncio.AsyncMappingResult.all` method.Nr`   r+   s    r-   rb   zAsyncMappingResult.fetchall  r   rc   c                `   K   t        | j                  |        d{   }|t        u ry|S 7 w)zFetch one object.

        Equivalent to :meth:`_asyncio.AsyncResult.fetchone` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        Nre   rg   s     r-   ri   zAsyncMappingResult.fetchone  s1      #4#6#6=='>J	 >rj   c                L   K   t        | j                  | |       d{   S 7 w)zFetch many rows.

        Equivalent to :meth:`_asyncio.AsyncResult.fetchmany` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        Nrl   rm   s     r-   rn   zAsyncMappingResult.fetchmany  s#      $D$8$8$EEEEro   c                H   K   t        | j                         d{   S 7 w)zReturn all rows in a list.

        Equivalent to :meth:`_asyncio.AsyncResult.all` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        Nr`   r+   s    r-   rq   zAsyncMappingResult.all  s      $DMM2222rc   c                    | S rs   r%   r+   s    r-   rt   zAsyncMappingResult.__aiter__  ru   r0   c                r   K   t        | j                  |        d {   }|t        u r
t               |S 7 wrs   rw   rg   s     r-   ry   zAsyncMappingResult.__anext__  rz   r{   c                N   K   t        | j                  ddd       d{   S 7 w)zFetch the first object or ``None`` if no object is present.

        Equivalent to :meth:`_asyncio.AsyncResult.first` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        FNr}   r+   s    r-   r   zAsyncMappingResult.first  r   r   c                N   K   t        | j                  ddd       d{   S 7 w)zReturn at most one object or raise an exception.

        Equivalent to :meth:`_asyncio.AsyncResult.one_or_none` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        TFNr}   r+   s    r-   r   zAsyncMappingResult.one_or_none  r   r   c                N   K   t        | j                  ddd       d{   S 7 w)zReturn exactly one object or raise an exception.

        Equivalent to :meth:`_asyncio.AsyncResult.one` except that
        :class:`_engine.RowMapping` values, rather than :class:`_engine.Row`
        objects, are returned.

        TFNr}   r+   s    r-   r   zAsyncMappingResult.one  r   r   )r   r&   rs   r   r   )rZ   r   r1   z#AsyncIterator[Sequence[RowMapping]])r1   Sequence[RowMapping])r1   zOptional[RowMapping])rZ   r   r1   r   r   )r1   r   )r4   r5   r6   r   r7   r   r   
attrgetterrA   rE   rO   rU   r]   rb   ri   rn   rq   rt   ry   r   r   r   r%   r0   r-   r   r   k  s     IN1h11*=9 15- 
4
 %)!	,(3
  %)F!F	F	3MLKr0   r   c                  
   e Zd ZdZdZery	 d	 	 	 ddZddZddZdddZ	ddZ
dd	Zdd
ZddZddZddZedd       Zedd       ZddZe	 	 	 	 d d       Zed!d       Zd!dZe	 	 	 	 d d       Zedd       ZddZyy)"AsyncTupleResulta  A :class:`_asyncio.AsyncResult` that's typed as returning plain
    Python tuples instead of rows.

    Since :class:`_engine.Row` acts like a tuple in every way already,
    this class is a typing only class, regular :class:`_asyncio.AsyncResult` is
    still used at runtime.

    r%   Nc                   K   yw)zIterate through sub-lists of elements of the size given.

            Equivalent to :meth:`_result.Result.partitions` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.

            Nr%   rm   s     r-   r]   zAsyncTupleResult.partitions  s      r   c                   K   yw)zFetch one tuple.

            Equivalent to :meth:`_result.Result.fetchone` except that
            tuple values, rather than :class:`_engine.Row`
            objects, are returned.

            Nr%   r+   s    r-   ri   zAsyncTupleResult.fetchone        r   c                   K   yw)z:A synonym for the :meth:`_engine.ScalarResult.all` method.Nr%   r+   s    r-   rb   zAsyncTupleResult.fetchall$  s	     r   c                   K   yw)zFetch many objects.

            Equivalent to :meth:`_result.Result.fetchmany` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.

            Nr%   rm   s     r-   rn   zAsyncTupleResult.fetchmany(  r   r   c                   K   yw)zReturn all scalar values in a list.

            Equivalent to :meth:`_result.Result.all` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.

            Nr%   r+   s    r-   rq   zAsyncTupleResult.all2  r   r   c                   K   y wrs   r%   r+   s    r-   rt   zAsyncTupleResult.__aiter__<  s     r   c                   K   y wrs   r%   r+   s    r-   ry   zAsyncTupleResult.__anext__>  s     r   c                   K   yw)zFetch the first object or ``None`` if no object is present.

            Equivalent to :meth:`_result.Result.first` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.


            Nr%   r+   s    r-   r   zAsyncTupleResult.first@  s      r   c                   K   yw)zReturn at most one object or raise an exception.

            Equivalent to :meth:`_result.Result.one_or_none` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.

            Nr%   r+   s    r-   r   zAsyncTupleResult.one_or_noneK  r   r   c                   K   yw)zReturn exactly one object or raise an exception.

            Equivalent to :meth:`_result.Result.one` except that
            tuple values, rather than :class:`_engine.Row` objects,
            are returned.

            Nr%   r+   s    r-   r   zAsyncTupleResult.oneU  r   r   c                   K   y wrs   r%   r+   s    r-   r   zAsyncTupleResult.scalar_one_  s	     GJr   c                   K   y wrs   r%   r+   s    r-   r   zAsyncTupleResult.scalar_oneb  s	     +.r   c                   K   yw)aL  Return exactly one scalar result or raise an exception.

            This is equivalent to calling :meth:`_engine.Result.scalars`
            and then :meth:`_engine.AsyncScalarResult.one`.

            .. seealso::

                :meth:`_engine.AsyncScalarResult.one`

                :meth:`_engine.Result.scalars`

            Nr%   r+   s    r-   r   zAsyncTupleResult.scalar_onee        r   c                   K   y wrs   r%   r+   s    r-   r   z#AsyncTupleResult.scalar_one_or_nonet        r   c                   K   y wrs   r%   r+   s    r-   r   z#AsyncTupleResult.scalar_one_or_noney  s	     =@r   c                   K   yw)aL  Return exactly one or no scalar result.

            This is equivalent to calling :meth:`_engine.Result.scalars`
            and then :meth:`_engine.AsyncScalarResult.one_or_none`.

            .. seealso::

                :meth:`_engine.AsyncScalarResult.one_or_none`

                :meth:`_engine.Result.scalars`

            Nr%   r+   s    r-   r   z#AsyncTupleResult.scalar_one_or_none|  r   r   c                   K   y wrs   r%   r+   s    r-   r   zAsyncTupleResult.scalar  r   r   c                   K   y wrs   r%   r+   s    r-   r   zAsyncTupleResult.scalar  r   r   c                   K   yw)a  Fetch the first column of the first row, and close the result
            set.

            Returns ``None`` if there are no rows to fetch.

            No validation is performed to test if additional rows remain.

            After calling this method, the object is fully closed,
            e.g. the :meth:`_engine.CursorResult.close`
            method will have been called.

            :return: a Python scalar value , or ``None`` if no rows remain.

            Nr%   r+   s    r-   r   zAsyncTupleResult.scalar  s      r   rs   r   r   r   r   )r1   zAsyncIterator[_R]r   )r,   AsyncTupleResult[Tuple[_T]]r1   r    r   )r,   r   r1   r   r   )r4   r5   r6   r   r7   r
   r]   ri   rb   rn   rq   rt   ry   r   r   r   r   r   r   r   r%   r0   r-   r   r      s     I )-
	%
	(
					 	<,				 
J 
J	. 
.	 
	-		 
	 
@ 
@	 
	-		 
	 
* 
*	O r0   r   _RTr&   c           	       K   	 | j                   }|st        | dd       }n| }|r|j                  j                  rt        |j                         d {    t        j                  d|j                  j                  j                  d|j                  d|j                  j                  j                  d      | S # t        $ r | cY S w xY w7 |w)NrawzCan't use the .z-() method with a server-side cursor. Use the z3.stream() method for an async streaming result set.)
_is_cursorAttributeErrorgetattrcontext_is_server_sider   r*   	async_excAsyncMethodRequired__self__	__class__r4   )r   calling_method	is_cursorcursor_results       r-   _ensure_sync_resultr    s     %%	
 t4..>>]00111++ ''11::''''11::

 
	
 M+   	2s5   CB> ACCA+C>C	CCC)r   r   r   r   r1   r   )0
__future__r   r   typingr   r   r   r   r   r	   r
   r    r   r   r   enginer   engine.resultr   r   r   r   r   r   
engine.rowr   r   sql.baser   util.concurrencyr   util.typingr   r   r   r   r   r    r"   r$   r;   r   r   
TypingOnlyr   r   r  r%   r0   r-   <module>r     s   #               $  & ) ) +  $ # . " &.2Te5c?+(,r" (,e5)[S2 e5P~KB ~KBRKK
$; RKjb{2 bJ e=)r0   