
    ,h/                   *   S r SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSKJ	r	  SSKJ
r
  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"  SSK!J#r#  SSK!J$r$  SS K J%r%  SS!K J&r&  SS"K'J(r(  SS#K)J*r*  SS$K)J+r+  \R0                  (       d  \((       d  SS%K,J-r-  OSS%K.J-r-  \R0                  (       a  SS&K/J0r0  SS'K1J2r2  \\3S(4   r4\\4\54   r6\	r7\\4\74   r8\\\	   \\	4   r9 \\	S)4   r: \" S*\9S+9r;\" S,\	S+9r<\" S-\\	S)4   S+9r=\\;\:4   r> \\\	   \	4   r?\\S.      r@\
\\	   /\\	   4   rA\
\	/\	4   rB\\\	   \\B   4   rC " S/ S05      rD " S1 S2\R                  \	   5      rF " S3 S4\D5      rG SO     SPS5 jjrH " S6 S7\5      rI\IR                  rJ " S8 S9\$\\;   5      rK " S: S;5      rL " S< S=\L\K\\=      5      rM " S> S?\K\;   5      rN " S@ SA\N\;   5      rO " SB SC\N\;   \ R                  5      rQ " SD SE\L\N\   5      rR " SF SG\\=   5      rS " SH SI\M\=   5      rTSQSJ jrU " SK SL\T\=   5      rV " SM SN\T\=   5      rWg)Rz%Define generic result set constructs.    )annotations)EnumN)Any)Callable)cast)Dict)Generic)Iterable)Iterator)List)Mapping)NoReturn)Optional)overload)Sequence)Set)Tuple)TYPE_CHECKING)TypeVar)Union   )Row)
RowMapping   )exc)util)_generative)HasMemoized)InPlaceGenerative)!HasMemoized_ro_memoized_attribute)NONE_SET)HAS_CYEXTENSION)Literal)Self)tuplegetter)SQLCoreOperations)_ResultProcessorTypezSQLCoreOperations[Any]._R)bound_T_TPz_ResultProcessorType[Any]c                     \ rS rSr% SrSrSrS\S'   SrS\S'   Sr	S	\S
'   S\S'   S\S'   S\S'   S\S'   \
S$S j5       rS%S jrS&S jr\ S'       S(S jj5       r\ S'       S)S jj5       r\ S'       S*S jj5       r S+       S*S jjr    S,S jr      S-S jr    S.S jr    S/S jrS0S jr S+     S1S jjr    S2S  jr      S3S! jrS4S" jr\
S5S# j5       rSrg)6ResultMetaData]   z$Base for metadata about result rows. NOptional[_TupleGetterType]_tuplefilterOptional[Sequence[int]]_translated_indexes(Optional[Sequence[Callable[[Any], Any]]]_unique_filters_KeyMapType_keymapSequence[str]_keysOptional[_ProcessorsType]_processorsMapping[_KeyType, int]_key_to_indexc                    [        U 5      $ N)	RMKeyViewselfs    P/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/engine/result.pykeysResultMetaData.keysj   s        c                    [        5       er?   NotImplementedErrorrB   keys     rC   _has_keyResultMetaData._has_keyn       !##rF   c                    [        5       er?   rH   rA   s    rC   _for_freezeResultMetaData._for_freezeq   rN   rF   c                    g r?   r/   rB   rK   errraiseerrs       rC   _key_fallbackResultMetaData._key_fallbackt   s     rF   c                    g r?   r/   rS   s       rC   rV   rW   y   s     rF   c                    g r?   r/   rS   s       rC   rV   rW      s     !rF   c                ,    U(       d   e[        U5      Uer?   )KeyErrorrS   s       rC   rV   rW      s     xsm$rF   c                    [        S5      e)NzCambiguous column name logic is implemented for CursorResultMetaDatarH   )rB   recs     rC    _raise_for_ambiguous_column_name/ResultMetaData._raise_for_ambiguous_column_name   s     "#
 	
rF   c                    [        5       er?   rH   rB   rK   rU   s      rC   _index_for_keyResultMetaData._index_for_key        "##rF   c                    [        5       er?   rH   rB   rD   s     rC   _indexes_for_keys ResultMetaData._indexes_for_keys   rd   rF   c                    [        5       er?   rH   rf   s     rC   _metadata_for_keys!ResultMetaData._metadata_for_keys   rd   rF   c                    [        5       er?   rH   rf   s     rC   _reduceResultMetaData._reduce   rN   rF   c                X    U R                  X5      nUb  [        R                  " U5      $ g r?   )rb   operator
itemgetter)rB   rK   rU   indexs       rC   _getterResultMetaData._getter   s.     ##C2&&u--rF   c                4    U R                  U5      n[        U6 $ r?   )rg   r%   )rB   rD   indexess      rC   _row_as_tuple_getter#ResultMetaData._row_as_tuple_getter   s     ((.G$$rF   c                l    UR                  5        VVs0 s H  u  p4XB   c  M  X4U   _M     snn$ s  snnf r?   )items)rB   keymaprr   rK   r]   s        rC   _make_key_to_index!ResultMetaData._make_key_to_index   s>    
 #LLN
*z CUO*
 	
 
s   0	0c                   XR                   ;   a  U R                  U R                   U   5        g U(       a   U R                  US 5        g U R                  US 5        g ! [         a  n[	        UR
                  S   5      UeS nAff = fNr   )r7   r^   rV   r[   AttributeErrorargs)rB   rK   
attr_errorkes       rC   _key_not_foundResultMetaData._key_not_found   sv    ,,11$,,s2CD =&&sD1 ""3-   =(4"<=s   A 
B'B  Bc                    U R                   (       a%  [        R                  " U R                   5      (       a  g U R                   $ r?   )r;   r!   
issupersetrA   s    rC   _effective_processors$ResultMetaData._effective_processors   s0    8#6#6t7G7G#H#H###rF   returnr@   rK   objectr   boolr   r-   ).)rK   r   rT   Optional[Exception]rU   Literal[True]r   r   )rK   r   rT   r   rU   zLiteral[False]r   None)rK   r   rT   r   rU   r   r   zOptional[NoReturn]T)r]   _KeyMapRecTyper   r   )rK   _KeyIndexTyperU   r   r   Optional[int])rD   Sequence[_KeyIndexType]r   Sequence[int])rD   r   r   Iterator[_KeyMapRecType])rD   r   r   r-   )rK   r   rU   r   r   #Optional[Callable[[Row[Any]], Any]]rD   r   r   _TupleGetterType)r{   z Mapping[_KeyType, Sequence[Any]]rr   intr   r<   )rK   r   r   r   r   r   )r   r:   )__name__
__module____qualname____firstlineno____doc__	__slots__r1   __annotations__r3   r5   propertyrD   rL   rP   r   rV   r^   rb   rg   rj   rm   rs   rw   r|   r   r   __static_attributes__r/   rF   rC   r-   r-   ]   s   .I/3L,33707@DO=D**)) $$ LO0<I	  
 $'	 ! !	
 
  CF!!0!<@!	! !
 DH%%0%<@%	%
!
	
$ $,0$	$
$+$	$
$+$	!$
$ *."&	,%+%	%
6
?B
	
. $ $rF   r-   c                  t    \ rS rSr% SrS\S'   S\S'   SS jrSS jrSS	 jrSS
 jr	SS jr
SS jrSS jrSrg)r@      _parentr9   r-   r   r8   r9   c                f    Xl         UR                   Vs/ s H	  o"c  M  UPM     snU l        g s  snf r?   r   )rB   parentks      rC   __init__RMKeyView.__init__   s$    !'?Aa?
?s   ..c                ,    [        U R                  5      $ r?   )lenr9   rA   s    rC   __len__RMKeyView.__len__   s    4::rF   c                $    SR                  U 5      $ )Nz#{0.__class__.__name__}({0._keys!r}))formatrA   s    rC   __repr__RMKeyView.__repr__   s    4;;DAArF   c                ,    [        U R                  5      $ r?   )iterr9   rA   s    rC   __iter__RMKeyView.__iter__   s    DJJrF   c                d    [        U[        5      (       a  gU R                  R                  U5      $ NF)
isinstancer   r   rL   )rB   items     rC   __contains__RMKeyView.__contains__   s)    dC   ||$$T**rF   c                0    [        U5      [        U 5      :H  $ r?   listrB   others     rC   __eq__RMKeyView.__eq__       E{d4j((rF   c                0    [        U5      [        U 5      :g  $ r?   r   r   s     rC   __ne__RMKeyView.__ne__   r   rF   )r9   r   N)r   r-   )r   r   )r   str)r   zIterator[str])r   r   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r/   rF   rC   r@   r@      s8    $I@B +))rF   r@   c                      \ rS rSr% SrSrS\S'        S           SS jjrSS jrSS	 jr	SS
 jr
SS jrSSS jjrSS jr    SS jrSS jrSrg)SimpleResultMetaData   z*result metadata for in-memory collections.)r9   r7   r;   r1   r3   r5   r=   r8   r9   Nc           	        [        U5      U l        X@l        XPl        X`l        U(       aJ  [        [        U R                  U5      5       VVV	s/ s H  u  nu  pU4U	(       a  U	OS-   XxU	44PM     n
nnn	O.[        U R                  5       VVs/ s H  u  pxU4XxS44PM     n
nnU
 VVVs0 s H  u  pU  H  oU_M     M     snnnU l        X0l        U R                  U R                  S5      U l
        g s  sn	nnf s  snnf s  snnnf )Nr/   r   )r   r9   r1   r3   r5   	enumeratezipr7   r;   r|   r=   )rB   rD   extrar;   r1   r3   r5   rr   nameextras
recs_namesr]   rK   s                rC   r   SimpleResultMetaData.__init__  s	    $Z
(#6 . .7s4::u7M-N
 .O)E>D GvR8&) .O  J $-TZZ#8#8KE 5+,#8  
 3=M*YTS*M&!44T\\1E#
 Ns   "C2C9(C?c                    XR                   ;   $ r?   r7   rJ   s     rC   rL   SimpleResultMetaData._has_key'  s    ll""rF   c                    U R                   nU(       a"  U R                  (       a  U R                  U5      n[        U R                  U R                   Vs/ s H  o R                  U   S   PM     snUS9$ s  snf )Nr   )r   r5   )r5   r1   r   r9   r7   )rB   unique_filtersrK   s      rC   rP    SimpleResultMetaData._for_freeze*  sf    --d//!..~>N $JJ37::>:C<<$Q':>*
 	
>s   A5
c                4    U R                   U R                  S.$ )Nr9   r3   r   rA   s    rC   __getstate__!SimpleResultMetaData.__getstate__7  s    ZZ#'#;#;
 	
rF   c                b    US   (       a  US   n[        U6 nOS =p#U R                  US   UUS9  g )Nr3   r9   )r3   r1   )r%   r   )rB   stater3   r1   s       rC   __setstate__!SimpleResultMetaData.__setstate__=  sI    &'"'(=">&(;<L155'N 3% 	 	
rF   c                    [         UR                  R                  ;   a  U R                  U   n U R                  U   nUS   $ ! [
         a   nU R                  XU5      n S nAUS   $ S nAff = fr   r   	__class____mro__r9   r7   r[   rV   )rB   rK   rU   r]   r   s        rC   rb   #SimpleResultMetaData._index_for_keyI  sl    #--'''**S/C	8,,s#C 1v  	8$$Sh7C1v	8s   A 
A-A((A-c                P    U Vs/ s H  o R                   U   S   PM     sn$ s  snf r   r   )rB   rD   rK   s      rC   rg   &SimpleResultMetaData._indexes_for_keysS  s&    045S!!$555s   #c              #     #    U HD  n[         UR                  R                  ;   a  U R                  U   n U R                  U   nUv   MF     g ! [
         a  nU R                  X$S5      n S nAN*S nAff = f7f)NTr   )rB   rD   rK   r]   r   s        rC   rj   'SimpleResultMetaData._metadata_for_keysV  sm      Ccmm+++jjo8ll3' I   8(($78s.   3A7A	A7
A4A/*A7/A44A7c           	         U Vs/ s H?  nU R                   [        UR                  R                  ;   a  U R                  U   OU   PMA     nn[        W6 u  pVnU R                  (       a  U Vs/ s H  oR                  U   PM     nn[        U6 n	[        UUU	UU R                  U R                  S9n
U
$ s  snf ! [
         a*  nU R                  UR                  S   US5         S nANS nAff = fs  snf )Nr   T)r   r1   r3   r;   r5   )r7   r   r   r   r9   r[   rV   r   r   r3   r%   r   r;   r5   )rB   rD   rK   metadata_for_keysr   rv   new_keysr   idxtupnew_metadatas              rC   rm   SimpleResultMetaData._reduced  s    	5
  	!  C '*cmm.C.C'CDJJsO  	  ! $'(9#: 5##@GH//4GH7#+ '(( 00
 9!  	5rwwqz2t44	5 Is/   B9 AB4B9 .C04B9 9
C- C((C-)r=   r7   r9   r;   r3   r1   r5   )NNNNN)rD   r8   r   zOptional[Sequence[Any]]r;   r:   r1   r0   r3   r2   r5   r4   r   r   )r   Dict[str, Any])r   r   r   r   r   )rK   r   rU   r   r   r   )rD   Sequence[Any]r   r   )rD   r   r   r   )rD   r   r   r-   )r   r   r   r   r   r   r   r   rL   rP   r   r   rb   rg   rj   rm   r   r/   rF   rC   r   r      s    4I 
 *.15377;DHFF 'F /	F
 1F 5F BFB#



6!	!rF   r   c                x    [        X5      n[        R                  " [        X"R                  UR
                  5      $ r?   )r   	functoolspartialr   r   r=   )fieldsr   r   s      rC   result_tupler     s4     "&0FV1163G3G rF   c                      \ rS rSrSrSrg)_NoRowi  r   r/   N)r   r   r   r   _NO_ROWr   r/   rF   rC   r   r     s    GrF   r   c                     \ rS rSr% SrSrS\S'   SrS\S'   S	\S
'   SrS\S'   Sr	S	\S'   Sr
S\S'   S\S'   S&S jr S'   S(S jjr S)   S*S jjrS+S jrS'S,S jjr\S-S j5       r\S.S j5       rS/S jrS/S jr\  S0S j5       r\S1S j5       r\          S2S j5       r\        S3S j5       r\        S4S j5       r        S4S  jrS5S! jrS6S" jr\S7S# j5       r\R<                  S8S$ j5       rS%r g)9ResultInternali  r/   NOptional[Result[Any]]_real_resultTr   _generate_rowsOptional[Callable[[Any], Any]]_row_logging_fnz Optional[_UniqueFilterStateType]_unique_filter_state_post_creational_filterFr-   	_metadata_source_supports_scalarsc                    [        5       er?   rH   rA   s    rC   _fetchiter_implResultInternal._fetchiter_impl  rN   rF   c                    [        5       er?   rH   rB   
hard_closes     rC   _fetchone_implResultInternal._fetchone_impl  rd   rF   c                    [        5       er?   rH   rB   sizes     rC   _fetchmany_implResultInternal._fetchmany_impl  rd   rF   c                    [        5       er?   rH   rA   s    rC   _fetchall_implResultInternal._fetchall_impl  rN   rF   c                    [        5       er?   rH   rB   hards     rC   _soft_closeResultInternal._soft_close  rN   rF   c                X  ^^	^
^^ U R                   (       a  U R                   O[        SU 5      nUR                  (       a+  U R                  (       d  g [        m          SU4S jjnO[        nU R
                  nUR                  nUR                  nUR                  nU(       aC  UR                  (       d2  U(       a  U" U5      n[        R                  " X#XT5      m
UmSU
U4S jjnO[        R                  " X#XT5      nUR                  (       a  UR                  mUm	SUU	4S jjnU$ )NResult[Any]c                   > T" XX#45      $ r?   r/   )metadata
processorskey_to_index
scalar_obj_procs       rC   process_row/ResultInternal._row_getter.<locals>.process_row  s     ! lM rF   c                    > T" T" U 5      5      $ r?   r/   )row_make_row_origfixed_tfs    rC   make_row,ResultInternal._row_getter.<locals>.make_row  s    %hsm44rF   c                    > T" T" U 5      5      $ r?   r/   )r,  _log_row	_make_rows    rC   r/  r0    s    	#//rF   )
r$  r-   r%  r:   r&  r<   r'  r   r   zRow[Any])r,  z_InterimRowType[Row[Any]]r   r(   )r  r   r  r  r   r
  r=   r   r1   r   r   r  )rB   real_resultr)  r$  r&  r%  tfr/  r2  r3  r-  r(  r.  s           @@@@@rC   _row_getterResultInternal._row_getter  s-       mT* 	 //&&, 9 #9 !$	
   K>>--33
""k::
^
090A0Az1N H5 5 !((zH &&"22H I0 0 rF   c                   ^^^^ U R                   mU R                  mU R                  (       a  U R                  u  mmSUUUU4S jjnU$ SUU4S jjnU$ )Nc              3     >#    U R                  5        HQ  nT(       a  T" U5      OUnT(       a  T" U5      OUnUT;   a  M-  TR                  U5        T(       a  T" U5      nUv   MS     g 7fr?   )r  add)rB   raw_rowobjhashedr/  post_creational_filterstrategyuniquess       rC   iterrows1ResultInternal._iterator_getter.<locals>.iterrows  sb     #335G-5)7  /7Xc]CF( KK'-4S9I  6s   A'A*c              3     >#    U R                  5        H'  nT(       a  T" U5      OUnT(       a  T" U5      nUv   M)     g 7fr?   )r  )rB   r;  r,  r/  r>  s      rC   rA  rB    s>     #335G-5)7  .4S9I  6s   =A )rB   r"  r   Iterator[_R]r6  r	  r  _unique_strategy)rB   rA  r/  r>  r?  r@  s     @@@@rC   _iterator_getterResultInternal._iterator_getter  sU    ##!%!=!=$$ $ 5 5GX 0   rF   c                ~    U R                   nUc   eU R                  5       nU Vs/ s H
  o1" U5      PM     sn$ s  snf r?   )r6  r  )rB   r/  rowsr,  s       rC   _raw_all_rowsResultInternal._raw_all_rows  sC    #####""$)-.#...s   :c                   U R                   nU R                  nU R                  5       nU(       a  U Vs/ s H
  oB" U5      PM     nnOUnU R                  (       af  U R                  u  pgU Vs/ s H  nUU(       a  U" U5      OU4PM     sn VV	s/ s H&  u  pX;  d  M  UR                  U	5      (       a  M$  UPM(     n
nn	OUn
U(       a  U
 Vs/ s H
  oA" U5      PM     n
nU
$ s  snf s  snf s  sn	nf s  snf r?   )r	  r6  r  r  rF  r:  )rB   r>  r/  rJ  r,  	made_rowsr@  r?  made_rowsig_rowinterim_rowss              rC   _allrowsResultInternal._allrows  s   !%!=!=##""$267$3#$I7II $$ $ 5 5G %.*
 %. !.6*H %.*
*%H )  3:++g2F *  
L %L!7C7C&s+|   7 8*
s#   C#-C(C-C-7C-C3c                   ^^^^ U R                   mU R                  mU R                  (       a  U R                  u  mmSUUUU4S jjnU$ SUU4S jjnU$ )Nc                   > U R                   n U" 5       nUc  [        $ T(       a  T" U5      OUnT(       a  T" U5      OUnUT;   a  M;  TR                  U5        T(       a  T" U5      nU$ r?   )r  r   r:  )	rB   _onerowr,  r<  r=  r/  r>  r?  r@  s	        rC   onerow-ResultInternal._onerow_getter.<locals>.onerowO  sl    --!)C{& .6HSM3  3;#!W,$#KK/1"8"=C"
rF   c                z   > U R                  5       nUc  [        $ T(       a  T" U5      OUnT(       a  T" U5      nU$ r?   )r  r   )rB   r,  interim_rowr/  r>  s      rC   rW  rX  d  sB    ))+;"N *2s   .&<[&I&&rF   )rB   r"  r   zUnion[_NoRow, _R]rE  )rB   rW  r/  r>  r?  r@  s     @@@@rC   _onerow_getterResultInternal._onerow_getterD  sX     ##!%!=!=$$ $ 5 5GX# #B 
' 
' rF   c                   ^^^^^ U R                   mU R                  mU R                  (       a2  U R                  u  mm          SS jm      SUUUUU4S jjnU$       SUU4S jjnU$ )Nc                   ^ U (       a  U Vs/ s H
  o@" U5      PM     nnT(       a  U4S jU 5       nO	S U 5       nU VVs/ s H&  u  pgXs;  d  M  UR                  U5      (       a  M$  UPM(     snn$ s  snf s  snnf )Nc              3  6   >#    U  H  oT" U5      4v   M     g 7fr?   r/   ).0rO  r?  s     rC   	<genexpr>EResultInternal._manyrow_getter.<locals>.filterrows.<locals>.<genexpr>  s      !GK88H#56ts   c              3  (   #    U  H  oU4v   M
     g 7fr?   r/   )r`  rO  s     rC   ra  rb    s      Kd(H!5ds   )r:  )r/  rJ  r?  r@  r,  rN  rO  rP  s     `     rC   
filterrows2ResultInternal._manyrow_getter.<locals>.filterrows{  s     59:TcHSMTD:!GK!I !Ld KI .7-6)- 6=kk'6J -6  ;s   A3A8A8)A8c                "  > / nU R                   nUc  U R                  (       a  U R                  O[        SU 5      nUR                  (       a  UR                  =pQOCU" U5      n[	        U5      nT	c   eUR                  T" T	UTT5      5        U[	        U5      -
  nOUnUc   eU(       aA  U" U5      nU(       d  O1UR                  T" T	UTT5      5        U[	        U5      -
  nU(       a  MA  T
(       a  U Vs/ s H  nT
" U5      PM     nnU$ s  snf Nr"  )r  r  r   
_yield_perr   extend)rB   numcollect	_manyrowsr4  num_requiredrJ  r,  rd  r/  r>  r?  r@  s           rC   manyrows0ResultInternal._manyrow_getter.<locals>.manyrows  s    %' 00	;  ,, ))!-6  
 #---8-C-CCs(~!$i'333&xxI (+S\'9#&L&"$\2DNN"8T8WE $'W#5L #l *FMNgs5c:gGN Os   6Dc                *  > Uc5  U R                   (       a  U R                   O[        SU 5      nUR                  nU R                  U5      nT(       a  U Vs/ s H  nT" U5      PM     nnT(       a  U Vs/ s H  nT" U5      PM     nnU$ s  snf s  snf rg  )r  r   rh  r  )rB   rj  r4  rJ  r,  r/  r>  s        rC   rn  ro    s     ;  ,, ))!-6  
 &00C373G3G3L59:TcHSMTD:)CGH4C2374DH ;Hs   B5B)
r/  Optional[Callable[..., _R]]rJ  z	List[Any]r?  z$Optional[Callable[[List[Any]], Any]]r@  zSet[Any]r   List[_R])rB   zResultInternal[_R]rj  r   r   rr  rE  )rB   rn  rd  r/  r>  r?  r@  s     @@@@@rC   _manyrow_getterResultInternal._manyrow_getterr  s    ##!%!=!=$$ $ 5 5GX5 ? "	
 *-(-/<-- -F %(/< $ rF   c                    g r?   r/   rB   raise_for_second_rowraise_for_nonescalars       rC   _only_one_rowResultInternal._only_one_row  s     rF   c                    g r?   r/   rv  s       rC   rz  r{    s     rF   c                    g r?   r/   rv  s       rC   rz  r{    s     rF   c                b   U R                   nU" SS9nUc  U(       a  [        R                  " S5      eg U(       a  U R                  (       a
  SU l        S nOU R
                  n U(       a  U" U5      OUnU(       a  U R                  (       aj  U R                  u  pxU(       a  U" U5      OUn	 U" SS9n
U
c  [        n
OI U(       a  U" U
5      OU
n
U(       a  U
[        Ld   eX" U
5      :X  a  MB  OXZ:X  a  MJ  OU" SS9n
U
c  [        n
U
[        La2  U R                  SS9  [        R                  " U(       a  S5      eS5      eOU R                  SS9  U(       d  U R                  nU(       a  U" U5      nU(       a  U(       a  US   $ U$ !   U R                  SS9  e = f!   U R                  SS9  e = f)	NTr  z&No row was found when one was requiredFr  z6Multiple rows were found when exactly one was requiredz6Multiple rows were found when one or none was requiredr   )r  r   NoResultFoundr  r  r6  r  r  rF  r   MultipleResultsFoundr	  )rB   rw  rx  ry  rW  r,  r/  r@  r?  existing_row_hashnext_rowr>  s               rC   rz  r{    s    $$.4.E;''<  d33"'DH''H	#+(3-C
  (( %)$9$9!5=HSM3!$*d$;H'#*9A8H#5x##+7#::#:0HX4FF (  G _$
 "T2#&Hw&  d +..% M #  ' $'%)%A%A"%,S1hq6MJu	$'6((d(3s   #F =.F -F FF.c                $    U R                  U 5      $ r?   )rG  rA   s    rC   
_iter_implResultInternal._iter_implB  s    $$T**rF   c                N    U R                  U 5      nU[        L a
  [        5       eU$ r?   )r[  r   StopIterationrB   r,  s     rC   
_next_implResultInternal._next_implE  s&    !!$''>/!JrF   c                    U R                   (       a  U R                   O[        SU 5      nUR                  (       a  [        U5      S:w  a   U R                  R                  U5      U l        U R                  (       d   eU $ )Nr"  r   )r  r   r  r   r
  rm   r  )rB   rv   r4  s      rC   _column_slicesResultInternal._column_slicesL  sg        mT* 	 33s7|q7H!^^33G<DN""""rF   c                   U R                   c   eU R                   u  pU R                  b  U R                  O[        SU 5      nU(       d  U R                  R                  (       a  UR
                  (       a-  U R                  (       d  U R                  R                  S   nX4$ U R                  R                  nU R                  R                  (       a  U R                  R                  U5      n[        R                  " SU5      nX4$ )Nr"  r   _filter_on_values)
r  r  r   r
  r5   r  r  r1   rp   methodcaller)rB   r@  r?  r4  filterss        rC   rF  ResultInternal._unique_strategy[  s    ((444 55   , mT* 	 DNN::44++>>99!<    ..88>>.."nn99'BG#001DgN  rF   )r  r
  r   z#Iterator[_InterimRowType[Row[Any]]]Fr  r   r   z#Optional[_InterimRowType[Row[Any]]]r?   r  r   r   List[_InterimRowType[Row[Any]]]r   r  r  r   r   r   )r   rq  )r   zCallable[..., Iterator[_R]])r   rr  )r   z1Callable[..., Union[Literal[_NoRow._NO_ROW], _R]])r   zCallable[..., List[_R]])
rB   zResultInternal[Row[Any]]rw  r   rx  r   ry  r   r   r   )rw  r   rx  r   ry  r   r   r(   )rw  r   rx  r   ry  r   r   Optional[_R]r   rD  r   r(   )rv   r   r   r$   )r   _UniqueFilterStateType)!r   r   r   r   r   r  r   r  r  r	  
_is_cursorr  r  r  r  r  r    r6  rG  rK  rR  r[  rs  r   rz  r  r  r   r  r   memoized_attributerF  r   r/   rF   rC   r  r    s   I*.L'.ND33=A:A>B;BJ""$ "'$$	,$ %)$!$	($
$$ '9 '9v '  ' D/#J '+	:+ '+Z '` '`D &"  	
 
  " & 	
 
  "  	
 
 S"S S 	S
 
Sj+   ##! $!rF   r  c                  .    \ rS rSr% SrS\S'   SS jrSrg)	_WithKeysiu  r/   r-   r
  c                .    U R                   R                  $ )a  Return an iterable view which yields the string keys that would
be represented by each :class:`_engine.Row`.

The keys can represent the labels of the columns returned by a core
statement or the names of the orm classes returned by an orm
execution.

The view also can be tested for key containment using the Python
``in`` operator, which will test both for the string keys represented
in the view, as well as for alternate keys such as column objects.

.. versionchanged:: 1.4 a key view object is returned rather than a
   plain list.


)r
  rD   rA   s    rC   rD   _WithKeys.keys{  s    " ~~"""rF   Nr   )r   r   r   r   r   r   rD   r   r/   rF   rC   r  r  u  s    I#rF   r  c                     \ rS rSr% SrSrSrS\S'   SrS\S	'   Sr	S
\S'   \
R                  " 5       rS\S'   S7S jrS8S jrS9S jrS:S jr\S;S j5       r\S;S j5       r\S<S j5       r\S=S>S jj5       rS?S jr\S@S j5       r\      SAS j5       r\SBSCS jj5       rSBSCS jjr SD     SES jjrSFS jrSGS jr\SHS j5       rSHS jrSIS  jrSJS! jr SKS" jr! S=   SLS# jjr"SMS$ jr#SNS% jr$S=SOS& jjr%SMS' jr&SNS( jr'SNS) jr(\SPS* j5       r)\SQS+ j5       r)SQS, jr)\SRS- j5       r*\SSS. j5       r*SSS/ jr*SKS0 jr+\SRS1 j5       r,\SQS2 j5       r,SQS3 jr,STS4 jr-SUS5 jr.S6r/g)VResulti  a  Represent a set of database results.

.. versionadded:: 1.4  The :class:`_engine.Result` object provides a
   completely updated usage model and calling facade for SQLAlchemy
   Core and SQLAlchemy ORM.   In Core, it forms the basis of the
   :class:`_engine.CursorResult` object which replaces the previous
   :class:`_engine.ResultProxy` interface.   When using the ORM, a
   higher level object called :class:`_engine.ChunkedIteratorResult`
   is normally used.

.. note:: In SQLAlchemy 1.4 and above, this object is
   used for ORM results returned by :meth:`_orm.Session.execute`, which can
   yield instances of ORM mapped objects either individually or within
   tuple-like rows. Note that the :class:`_engine.Result` object does 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:`_engine.Result.unique` modifier
   method.

.. seealso::

    :ref:`tutorial_fetching_rows` - in the :doc:`/tutorial/index`

)r
  __dict__Nz(Optional[Callable[[Row[Any]], Row[Any]]]r  Fr   r  r   rh  zutil.immutabledict[Any, Any]_attributesc                    Xl         g r?   )r
  )rB   cursor_metadatas     rC   r   Result.__init__  s    (rF   c                    U $ r?   r/   rA   s    rC   	__enter__Result.__enter__      rF   c                $    U R                  5         g r?   )closerB   type_value	tracebacks       rC   __exit__Result.__exit__  s    

rF   c                "    U R                  SS9  g)a  close this :class:`_engine.Result`.

The behavior of this method is implementation specific, and is
not implemented by default.    The method should generally end
the resources in use by the result object and also cause any
subsequent iteration or row fetching to raise
:class:`.ResourceClosedError`.

.. versionadded:: 1.4.27 - ``.close()`` was previously not generally
   available for all :class:`_engine.Result` classes, instead only
   being available on the :class:`_engine.CursorResult` returned for
   Core statement executions. As most other result objects, namely the
   ones used by the ORM, are proxying a :class:`_engine.CursorResult`
   in any case, this allows the underlying cursor result to be closed
   from the outside facade for the case when the ORM query is using
   the ``yield_per`` execution option where it does not immediately
   exhaust and autoclose the database cursor.

Tr  N)r  rA   s    rC   r  Result.close  s    ( 	d#rF   c                    [        5       er?   rH   rA   s    rC   _soft_closedResult._soft_closed  s    !##rF   c                    [        5       e)z[return ``True`` if this :class:`_engine.Result` reports .closed

.. versionadded:: 1.4.43

rH   rA   s    rC   closedResult.closed       "##rF   c                    Xl         U $ )a  Configure the row-fetching strategy to fetch ``num`` rows at a time.

This impacts the underlying behavior of the result when iterating over
the result object, or otherwise making use of  methods such as
:meth:`_engine.Result.fetchone` that return one row at a time.   Data
from the underlying cursor or other data source will be buffered up to
this many rows in memory, and the buffered collection will then be
yielded out one row at a time or as many rows are requested. Each time
the buffer clears, it will be refreshed to this many rows or as many
rows remain if fewer remain.

The :meth:`_engine.Result.yield_per` method is generally used in
conjunction with the
:paramref:`_engine.Connection.execution_options.stream_results`
execution option, which will allow the database dialect in use to make
use of a server side cursor, if the DBAPI supports a specific "server
side cursor" mode separate from its default mode of operation.

.. tip::

    Consider using the
    :paramref:`_engine.Connection.execution_options.yield_per`
    execution option, which will simultaneously set
    :paramref:`_engine.Connection.execution_options.stream_results`
    to ensure the use of server side cursors, as well as automatically
    invoke the :meth:`_engine.Result.yield_per` method to establish
    a fixed row buffer size at once.

    The :paramref:`_engine.Connection.execution_options.yield_per`
    execution option is available for ORM operations, with
    :class:`_orm.Session`-oriented use described at
    :ref:`orm_queryguide_yield_per`. The Core-only version which works
    with :class:`_engine.Connection` is new as of SQLAlchemy 1.4.40.

.. versionadded:: 1.4

:param num: number of rows to fetch each time the buffer is refilled.
 If set to a value below 1, fetches all rows for the next buffer.

.. seealso::

    :ref:`engine_stream_results` - describes Core behavior for
    :meth:`_engine.Result.yield_per`

    :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel`

)rh  rB   rj  s     rC   	yield_perResult.yield_per  s    b rF   c                (    [        5       U4U l        U $ )a-  Apply unique filtering to the objects returned by this
:class:`_engine.Result`.

When this filter is applied with no arguments, the rows or objects
returned will filtered such that each row is returned uniquely. The
algorithm used to determine this uniqueness is by default the Python
hashing identity of the whole tuple.   In some cases a specialized
per-entity hashing scheme may be used, such as when using the ORM, a
scheme is applied which  works against the primary key identity of
returned objects.

The unique filter is applied **after all other filters**, which means
if the columns returned have been refined using a method such as the
:meth:`_engine.Result.columns` or :meth:`_engine.Result.scalars`
method, the uniquing is applied to **only the column or columns
returned**.   This occurs regardless of the order in which these
methods have been called upon the :class:`_engine.Result` object.

The unique filter also changes the calculus used for methods like
:meth:`_engine.Result.fetchmany` and :meth:`_engine.Result.partitions`.
When using :meth:`_engine.Result.unique`, these methods will continue
to yield the number of rows or objects requested, after uniquing
has been applied.  However, this necessarily impacts the buffering
behavior of the underlying cursor or datasource, such that multiple
underlying calls to ``cursor.fetchmany()`` may be necessary in order
to accumulate enough objects in order to provide a unique collection
of the requested size.

:param strategy: a callable that will be applied to rows or objects
 being iterated, which should return an object that represents the
 unique value of the row.   A Python ``set()`` is used to store
 these identities.   If not passed, a default uniqueness strategy
 is used which may have been assembled by the source of this
 :class:`_engine.Result` object.

setr  rB   r?  s     rC   uniqueResult.unique  s    L &)UH$5!rF   c                $    U R                  U5      $ )a  Establish the columns that should be returned in each row.

This method may be used to limit the columns returned as well
as to reorder them.   The given list of expressions are normally
a series of integers or string key names.   They may also be
appropriate :class:`.ColumnElement` objects which correspond to
a given statement construct.

.. versionchanged:: 2.0  Due to a bug in 1.4, the
   :meth:`_engine.Result.columns` method had an incorrect behavior
   where calling upon the method with just one index would cause the
   :class:`_engine.Result` object to yield scalar values rather than
   :class:`_engine.Row` objects.   In version 2.0, this behavior
   has been corrected such that calling upon
   :meth:`_engine.Result.columns` with a single index will
   produce a :class:`_engine.Result` object that continues
   to yield :class:`_engine.Row` objects, which include
   only a single column.

E.g.::

    statement = select(table.c.x, table.c.y, table.c.z)
    result = connection.execute(statement)

    for z, y in result.columns("z", "y"):
        ...

Example of using the column objects from the statement itself::

    for z, y in result.columns(
        statement.selected_columns.c.z, statement.selected_columns.c.y
    ):
        ...

.. versionadded:: 1.4

:param \*col_expressions: indicates columns to be returned.  Elements
 may be integer row indexes, string column names, or appropriate
 :class:`.ColumnElement` objects corresponding to a select construct.

:return: this :class:`_engine.Result` object with the modifications
 given.

r  rB   col_expressionss     rC   columnsResult.columns<  s    Z ""?33rF   c                    g r?   r/   rA   s    rC   scalarsResult.scalarsk  s    >ArF   c                    g r?   r/   rB   rr   s     rC   r  r  n       rF   c                    g r?   r/   r  s     rC   r  r  s  s    FIrF   c                    [        X5      $ )a  Return a :class:`_engine.ScalarResult` filtering object which
will return single elements rather than :class:`_row.Row` objects.

E.g.::

    >>> result = conn.execute(text("select int_id from table"))
    >>> result.scalars().all()
    [1, 2, 3]

When results are fetched from the :class:`_engine.ScalarResult`
filtering object, the single column-row that would be returned by the
:class:`_engine.Result` is instead returned as the column's value.

.. versionadded:: 1.4

: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:`_engine.ScalarResult` filtering object referring
 to this :class:`_engine.Result` object.

)ScalarResultr  s     rC   r  r  v  s    . D((rF   c                p    U R                   (       a  [        S5      eU R                  R                  X5      $ )zQreturn a callable that will retrieve the given key from a
:class:`_engine.Row`.

.can't use this function in 'only scalars' mode)r  rI   r
  rs   ra   s      rC   rs   Result._getter  s4     ((%@  ~~%%c44rF   c                p    U R                   (       a  [        S5      eU R                  R                  U5      $ )zRreturn a callable that will retrieve the given keys from a
:class:`_engine.Row`.

r  )r  rI   r
  rw   rf   s     rC   _tuple_getterResult._tuple_getter  s4    
 ((%@  ~~22488rF   c                    [        U 5      $ )as  Apply a mappings filter to returned rows, returning an instance of
:class:`_engine.MappingResult`.

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

.. versionadded:: 1.4

:return: a new :class:`_engine.MappingResult` filtering object
 referring to this :class:`_engine.Result` object.

)MappingResultrA   s    rC   mappingsResult.mappings  s     T""rF   c                    U $ )zApply a "typed tuple" typing filter to returned rows.

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

.. versionadded:: 2.0

r/   rA   s    rC   tResult.t  s	     rF   c                    U $ )a  Apply a "typed tuple" typing filter to returned rows.

This method returns the same :class:`_engine.Result` object
at runtime,
however annotates as returning a :class:`_engine.TupleResult` 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:`_engine.TupleResult` type at typing time.

.. seealso::

    :attr:`_engine.Result.t` - shorter synonym

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

r/   rA   s    rC   tuplesResult.tuples  s	    0 rF   c                    [        5       e)zReturn a safe iterator that yields raw row data.

This is used by the :meth:`_engine.Result.merge` method
to merge multiple compatible results together.

rH   rA   s    rC   _raw_row_iteratorResult._raw_row_iterator  r  rF   c                "    U R                  5       $ r?   r  rA   s    rC   r   Result.__iter__        rF   c                "    U R                  5       $ r?   r  rA   s    rC   __next__Result.__next__  r  rF   c              #  R   #    U R                   n U" X5      nU(       a  Uv   OgM  7f)a  Iterate through sub-lists of rows of the size given.

Each list will be of the size given, excluding the last list to
be yielded, which may have a small number of rows.  No empty
lists will be yielded.

The result object is automatically closed when the iterator
is fully consumed.

Note that the backend driver will usually buffer the entire result
ahead of time unless the
:paramref:`.Connection.execution_options.stream_results` execution
option is used indicating that the driver should not pre-buffer
results, if possible.   Not all drivers support this option and
the option is silently ignored for those who do not.

When using the ORM, the :meth:`_engine.Result.partitions` method
is typically more effective from a memory perspective when it is
combined with use of the
:ref:`yield_per execution option <orm_queryguide_yield_per>`,
which instructs both the DBAPI driver to use server side cursors,
if available, as well as instructs the ORM loading internals to only
build a certain amount of ORM objects from a result at a time before
yielding them out.

.. versionadded:: 1.4

:param size: indicate the maximum number of rows to be present
 in each list yielded.  If None, makes use of the value set by
 the :meth:`_engine.Result.yield_per`, method, if it were called,
 or the :paramref:`_engine.Connection.execution_options.yield_per`
 execution option, which is equivalent in this regard.  If
 yield_per weren't set, it makes use of the
 :meth:`_engine.Result.fetchmany` default, which may be backend
 specific and not well defined.

:return: iterator of lists

.. seealso::

    :ref:`engine_stream_results`

    :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel`

Nrs  rB   r  getter	partitions       rC   
partitionsResult.partitions  s0     b %%t*I    %'c                "    U R                  5       $ )z4A synonym for the :meth:`_engine.Result.all` method.rR  rA   s    rC   fetchallResult.fetchall'       }}rF   c                <    U R                  U 5      nU[        L a  gU$ )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:`_engine.Result.first` method.  To iterate through all
rows, iterate the :class:`_engine.Result` object directly.

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

Nr[  r   r  s     rC   fetchoneResult.fetchone,  s#      !!$''>JrF   c                $    U R                  X5      $ )aN  Fetch many rows.

When all rows are exhausted, returns an empty sequence.

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

To fetch rows in groups, use the :meth:`_engine.Result.partitions`
method.

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

.. seealso::

    :meth:`_engine.Result.partitions`

r  r  s     rC   	fetchmanyResult.fetchmanyB  s    & ##D//rF   c                "    U R                  5       $ )aN  Return all rows in a sequence.

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

.. versionadded:: 1.4

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

.. seealso::

    :ref:`engine_stream_results` - How to stream a large result set
    without loading it completely in python.

r  rA   s    rC   all
Result.allW  s    " }}rF   c                $    U R                  SSSS9$ )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:`_engine.Result.scalar` method,
   or combine :meth:`_engine.Result.scalars` and
   :meth:`_engine.Result.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:`_engine.Result`;
   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:`_engine.Result.scalar`

    :meth:`_engine.Result.one`

Frw  rx  ry  rz  rA   s    rC   firstResult.firstj  s$    F !!!&uU " 
 	
rF   c                $    U R                  SSSS9$ )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:`_engine.Result.first`

    :meth:`_engine.Result.one`

TFr  r  rA   s    rC   one_or_noneResult.one_or_none  s#    * !!!%eE " 
 	
rF   c                    g r?   r/   rA   s    rC   
scalar_oneResult.scalar_one      36rF   c                    g r?   r/   rA   s    rC   r  r        !$rF   c                $    U R                  SSSS9$ )zReturn exactly one scalar result or raise an exception.

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

.. seealso::

    :meth:`_engine.ScalarResult.one`

    :meth:`_engine.Result.scalars`

Tr  r  rA   s    rC   r  r    s#     !!!%d4 " 
 	
rF   c                    g r?   r/   rA   s    rC   scalar_one_or_noneResult.scalar_one_or_none  s    EHrF   c                    g r?   r/   rA   s    rC   r  r    r  rF   c                $    U R                  SSSS9$ )a   Return exactly one scalar result or ``None``.

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

.. seealso::

    :meth:`_engine.ScalarResult.one_or_none`

    :meth:`_engine.Result.scalars`

TFr  r  rA   s    rC   r  r    s#     !!!%eD " 
 	
rF   c                $    U R                  SSSS9$ )a  Return exactly one row or raise an exception.

Raises :class:`_exc.NoResultFound` if the result returns no
rows, or :class:`_exc.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:`_engine.Result.scalar_one` method, or combine
   :meth:`_engine.Result.scalars` and
   :meth:`_engine.Result.one`.

.. versionadded:: 1.4

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

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

.. seealso::

    :meth:`_engine.Result.first`

    :meth:`_engine.Result.one_or_none`

    :meth:`_engine.Result.scalar_one`

TFr  r  rA   s    rC   one
Result.one  s#    : !!!%d5 " 
 	
rF   c                    g r?   r/   rA   s    rC   ry  Result.scalar  s    9<rF   c                    g r?   r/   rA   s    rC   ry  r%    s     rF   c                $    U R                  SSSS9$ )av  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.

FTr  r  rA   s    rC   ry  r%    s#     !!!&uT " 
 	
rF   c                    [        U 5      $ )a  Return a callable object that will produce copies of this
:class:`_engine.Result` 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.

)FrozenResultrA   s    rC   freezeResult.freeze  s    * D!!rF   c                6    [        U R                  U 4U-   5      $ )a  Merge this :class:`_engine.Result` with other compatible result
objects.

The object returned is an instance of :class:`_engine.MergedResult`,
which will be composed of iterators from the given result
objects.

The new result will use the metadata from this result object.
The subsequent result objects must be against an identical
set of result / cursor metadata, otherwise the behavior is
undefined.

)MergedResultr
  )rB   otherss     rC   mergeResult.merge(  s     DNNTGf,<==rF   )r
  r  rh  )r  r-   r   r$   r  r   r  r   r  r   r   r   r   r   r   r   rj  r   r   r$   r?   r?  zOptional[_UniqueFilterType]r   r$   r  r   r   r$   )rB   Result[Tuple[_T]]r   ScalarResult[_T])rB   r8  rr   z
Literal[0]r   r9  )r   )rr   r   r   zScalarResult[Any]r   )rK   r   rU   r   r   r   r   )r   r  )r   zTupleResult[_TP]r   zIterator[_RowData])r   zIterator[Row[_TP]])r   zRow[_TP])r  r   r   zIterator[Sequence[Row[_TP]]])r   Sequence[Row[_TP]])r   zOptional[Row[_TP]])r  r   r   r;  )rB   r8  r   r*   r   r   )rB   r8  r   Optional[_T]r   Optional[Any])r   FrozenResult[_TP])r.  r"  r   zMergedResult[_TP])0r   r   r   r   r   r   r  r   r  rh  r   immutabledictr  r   r  r  r  r   r  r  r   r  r  r  r   r  rs   r  r  r  r  r  r   r  r  r   r  r  r  r  r  r  r  r"  ry  r*  r/  r   r/   rF   rC   r  r    s   2 *I@DO=D%*d* $J$040B0B0DK-D)$, $ $ $ $ 1 1f & &P-4^ A A(2	  I I)4 485 5,05	,5	9#" 	 	4$!! %)8!8	%8t
,0*&%
N
2 6 6$ $
" H H6 6
"
B < <   
$".>rF   r  c                      \ rS rSr% SrSrS\S'   S\S'   SS jrSS	 jr\	SS
 j5       r
SSS jjr\SS j5       r\SS j5       rSS jr\SS j5       rSS jr S   SS jjrS S jr S!   S"S jjrSrg)#FilterResulti9  aF  A wrapper for a :class:`_engine.Result` that returns objects other than
:class:`_engine.Row` objects, such as dictionaries or scalar objects.

:class:`_engine.FilterResult` is the common base for additional result
APIs including :class:`_engine.MappingResult`,
:class:`_engine.ScalarResult` and :class:`_engine.AsyncResult`.

)r  r	  r
  r  r  r  r	  r"  r  c                    U $ r?   r/   rA   s    rC   r  FilterResult.__enter__O  r  rF   c                <    U R                   R                  XU5        g r?   )r  r  r  s       rC   r  FilterResult.__exit__R  s    ""5;rF   c                F    U R                   R                  U5      U l         U $ )a7  Configure the row-fetching strategy to fetch ``num`` rows at a time.

The :meth:`_engine.FilterResult.yield_per` method is a pass through
to the :meth:`_engine.Result.yield_per` method.  See that method's
documentation for usage notes.

.. versionadded:: 1.4.40 - added :meth:`_engine.FilterResult.yield_per`
   so that the method is available on all result set implementations

.. seealso::

    :ref:`engine_stream_results` - describes Core behavior for
    :meth:`_engine.Result.yield_per`

    :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel`

)r  r  r  s     rC   r  FilterResult.yield_perU  s"    & !--77<rF   c                6    U R                   R                  US9  g Nr  )r  r  r  s     rC   r  FilterResult._soft_closek  s    %%4%0rF   c                .    U R                   R                  $ r?   )r  r  rA   s    rC   r  FilterResult._soft_closedn  s      ---rF   c                .    U R                   R                  $ )zdReturn ``True`` if the underlying :class:`_engine.Result` reports
closed

.. versionadded:: 1.4.43

)r  r  rA   s    rC   r  FilterResult.closedr  s       '''rF   c                8    U R                   R                  5         g)zEClose this :class:`_engine.FilterResult`.

.. versionadded:: 1.4.43

N)r  r  rA   s    rC   r  FilterResult.close|  s     	!rF   c                .    U R                   R                  $ r?   )r  r  rA   s    rC   r  FilterResult._attributes  s      ,,,rF   c                6    U R                   R                  5       $ r?   )r  r  rA   s    rC   r  FilterResult._fetchiter_impl  s      0022rF   c                4    U R                   R                  US9$ )Nr  )r  r  r  s     rC   r  FilterResult._fetchone_impl  s       //:/FFrF   c                6    U R                   R                  5       $ r?   )r  r  rA   s    rC   r  FilterResult._fetchall_impl  s      //11rF   Nc                4    U R                   R                  US9$ Nr  )r  r  r  s     rC   r  FilterResult._fetchmany_impl  s       00d0;;rF   )r  r1  r2  r5  r  r  r4  r3  )r   zDict[Any, Any]r  r  r  r?   r  )r   r   r   r   r   r   r   r  r  r   r  r  r   r  r  r  r  r  r  r  r  r   r/   rF   rC   rC  rC  9  s    I <;<  *1 . . ( (" - -3 "'GG	,G
2 %)<!<	(< <rF   rC  c                      \ rS rSr% SrSrSrS\S'   SS jrSSS	 jjr	SSS
 jjr
SS jrSSS jjrSS jrSS jrSS jrSS jrSS jrSS jrSrg)r  i  ai  A wrapper for a :class:`_engine.Result` that returns scalar values
rather than :class:`_row.Row` values.

The :class:`_engine.ScalarResult` object is acquired by calling the
:meth:`_engine.Result.scalars` method.

A special limitation of :class:`_engine.ScalarResult` is that it has
no ``fetchone()`` method; since the semantics of ``fetchone()`` are that
the ``None`` value indicates no more results, this is not compatible
with :class:`_engine.ScalarResult` since there is no way to distinguish
between ``None`` as a row value versus ``None`` as an indicator.  Use
``next(result)`` to receive values individually.

r/   Fr  r	  c                    Xl         UR                  (       a  UR                  U l        S U l        O<UR                  R	                  U/5      U l        [
        R                  " S5      U l        UR                  U l        g r   )r  r  r
  r	  rm   rp   rq   r  )rB   r4  rr   s      rC   r   ScalarResult.__init__  sa    '//(22DN+/D((22::E7CDN+3+>+>q+AD($/$D$D!rF   Nc                (    [        5       U4U l        U $ )zApply unique filtering to the objects returned by this
:class:`_engine.ScalarResult`.

See :meth:`_engine.Result.unique` for usage details.

r  r  s     rC   r  ScalarResult.unique       &)UH$5!rF   c              #  R   #    U R                   n U" X5      nU(       a  Uv   OgM  7f)zIterate through sub-lists of elements of the size given.

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

Nr  r  s       rC   r  ScalarResult.partitions  s/      %%t*I r  c                "    U R                  5       $ ):A synonym for the :meth:`_engine.ScalarResult.all` method.r  rA   s    rC   r   ScalarResult.fetchall  r  rF   c                $    U R                  X5      $ )zFetch many objects.

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

r  r  s     rC   r  ScalarResult.fetchmany  s     ##D//rF   c                "    U R                  5       $ )zReturn all scalar values in a sequence.

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

r  rA   s    rC   r  ScalarResult.all  s     }}rF   c                "    U R                  5       $ r?   r  rA   s    rC   r   ScalarResult.__iter__  r  rF   c                "    U R                  5       $ r?   r  rA   s    rC   r  ScalarResult.__next__  r  rF   c                $    U R                  SSSS9$ )zFetch the first object or ``None`` if no object is present.

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


Fr  r  rA   s    rC   r  ScalarResult.first  #     !!!&uU " 
 	
rF   c                $    U R                  SSSS9$ )zReturn at most one object or raise an exception.

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

TFr  r  rA   s    rC   r  ScalarResult.one_or_none  #     !!!%eE " 
 	
rF   c                $    U R                  SSSS9$ )zReturn exactly one object or raise an exception.

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

TFr  r  rA   s    rC   r"  ScalarResult.one  #     !!!%d5 " 
 	
rF   )r
  r	  r  r  )r4  r"  rr   r   r?   r6  r  r   r   zIterator[Sequence[_R]]r   Sequence[_R]r  r   r   r}  r  r  r   r  )r   r   r   r   r   r   r  r   r   r  r  r   r  r  r   r  r  r  r"  r   r/   rF   rC   r  r    sQ     IN;;
E$
0!!




rF   r  c                  B   \ rS rSrSrSr\(       a   S   SS jjrSS jrSS jr	SSS jjr
SS	 jrSS
 jrSS jrSS jrSS jrSS jr\SS j5       r\S S j5       rS S jr\    S!S j5       r\S"S j5       rS"S jr\S!S j5       r\S S j5       rS S jrSrgSrg)#TupleResulti  zA :class:`_engine.Result` 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:`_engine.Result` is
still used at runtime.

r/   Nc                    g)zIterate through sub-lists of elements of the size given.

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

Nr/   r  s     rC   r  TupleResult.partitions*  s     rF   c                    g)zFetch one tuple.

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

Nr/   rA   s    rC   r  TupleResult.fetchone6       rF   c                    g)rh  Nr/   rA   s    rC   r   TupleResult.fetchall@  s    rF   c                    g)zFetch many objects.

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

Nr/   r  s     rC   r  TupleResult.fetchmanyD  r  rF   c                    g)zReturn all scalar values in a sequence.

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

Nr/   rA   s    rC   r  TupleResult.allN  r  rF   c                    g r?   r/   rA   s    rC   r   TupleResult.__iter__X  s    CrF   c                    g r?   r/   rA   s    rC   r  TupleResult.__next__Z  s    #rF   c                    g)zFetch the first object or ``None`` if no object is present.

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


Nr/   rA   s    rC   r  TupleResult.first\  s     rF   c                    g)zReturn at most one object or raise an exception.

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

Nr/   rA   s    rC   r  TupleResult.one_or_noneg  r  rF   c                    g)zReturn exactly one object or raise an exception.

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

Nr/   rA   s    rC   r"  TupleResult.oneq  r  rF   c                    g r?   r/   rA   s    rC   r  TupleResult.scalar_one{  s    <?rF   c                    g r?   r/   rA   s    rC   r  r  ~  s    %(rF   c                    g)zReturn exactly one scalar result or raise an exception.

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

.. seealso::

    :meth:`_engine.ScalarResult.one`

    :meth:`_engine.Result.scalars`

Nr/   rA   s    rC   r  r         rF   c                    g r?   r/   rA   s    rC   r  TupleResult.scalar_one_or_none  r  rF   c                    g r?   r/   rA   s    rC   r  r    s    7:rF   c                    g)zReturn exactly one or no scalar result.

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

.. seealso::

    :meth:`_engine.ScalarResult.one_or_none`

    :meth:`_engine.Result.scalars`

Nr/   rA   s    rC   r  r    r  rF   c                    g r?   r/   rA   s    rC   ry  TupleResult.scalar  s    BErF   c                    g r?   r/   rA   s    rC   ry  r    r  rF   c                    g)aw  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/   rA   s    rC   ry  r    s     rF   r?   r{  r  r|  r~  r  r  )rB   TupleResult[Tuple[_T]]r   r*   r<  )rB   r  r   r=  r>  )r   r   r   r   r   r   r   r  r  r   r  r  r   r  r  r  r"  r   r  r  ry  r   r/   rF   rC   r  r    s     I )-
	%
	#
					 	0%				 
? 
?	( 
(	 
	(		 
	 
: 
:	 
E 
E	$ 
$	K rF   r  c                      \ rS rSrSrSrSr\R                  " S5      r	SS jr
SSS jjrSS	 jr S   SS
 jjrSS jrSS jrSSS jjrSS jrSS jrSS jrSS jrSS jrSS jrSrg)r  i  zA wrapper for a :class:`_engine.Result` that returns dictionary values
rather than :class:`_engine.Row` values.

The :class:`_engine.MappingResult` object is acquired by calling the
:meth:`_engine.Result.mappings` method.

r/   T_mappingc                    Xl         UR                  U l        UR                  U l        UR                  (       a"  U R                  R	                  S/5      U l        g g r   )r  r  r
  r  rm   rB   results     rC   r   MappingResult.__init__  sI    "$*$?$?!))**!^^33QC8DN +rF   Nc                (    [        5       U4U l        U $ )zApply unique filtering to the objects returned by this
:class:`_engine.MappingResult`.

See :meth:`_engine.Result.unique` for usage details.

r  r  s     rC   r  MappingResult.unique  rd  rF   c                $    U R                  U5      $ )z:Establish the columns that should be returned in each row.r  r  s     rC   r  MappingResult.columns  s    ""?33rF   c              #  R   #    U R                   n U" X5      nU(       a  Uv   OgM  7f)zIterate through sub-lists of elements of the size given.

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

Nr  r  s       rC   r  MappingResult.partitions  s/      %%t*I r  c                "    U R                  5       $ )z;A synonym for the :meth:`_engine.MappingResult.all` method.r  rA   s    rC   r   MappingResult.fetchall  r  rF   c                <    U R                  U 5      nU[        L a  gU$ )zFetch one object.

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

Nr  r  s     rC   r  MappingResult.fetchone  s#     !!$''>JrF   c                $    U R                  X5      $ )zFetch many objects.

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

r  r  s     rC   r  MappingResult.fetchmany  s     ##D//rF   c                "    U R                  5       $ )zReturn all scalar values in a sequence.

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

r  rA   s    rC   r  MappingResult.all  s     }}rF   c                "    U R                  5       $ r?   r  rA   s    rC   r   MappingResult.__iter__!  r  rF   c                "    U R                  5       $ r?   r  rA   s    rC   r  MappingResult.__next__$  r  rF   c                $    U R                  SSSS9$ )zFetch the first object or ``None`` if no object is present.

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


Fr  r  rA   s    rC   r  MappingResult.first'  rt  rF   c                $    U R                  SSSS9$ )zReturn at most one object or raise an exception.

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

TFr  r  rA   s    rC   r  MappingResult.one_or_none4  rw  rF   c                $    U R                  SSSS9$ )zReturn exactly one object or raise an exception.

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

TFr  r  rA   s    rC   r"  MappingResult.one@  rz  rF   )r
  r  r  )r  r"  r?   r6  r7  )r  r   r   zIterator[Sequence[RowMapping]])r   Sequence[RowMapping])r   zOptional[RowMapping])r  r   r   r  )r   zIterator[RowMapping])r   r   )r   r   r   r   r   r   r  rp   
attrgetterr	  r   r  r  r  r   r  r  r  r   r  r  r  r"  r   r/   rF   rC   r  r    sz     IN&11*=94
 %)!	'(
	0	!!




rF   r  c                  T    \ rS rSr% SrS\S'   SS jrSS jr    SS jrSS jr	S	r
g
)r)  iM  a  Represents a :class:`_engine.Result` object in a "frozen" state suitable
for caching.

The :class:`_engine.FrozenResult` object is returned from the
:meth:`_engine.Result.freeze` method of any :class:`_engine.Result`
object.

A new iterable :class:`_engine.Result` object is generated from a fixed
set of data each time the :class:`_engine.FrozenResult` is invoked as
a callable::


    result = connection.execute(query)

    frozen = result.freeze()

    unfrozen_result_one = frozen()

    for row in unfrozen_result_one:
        print(row)

    unfrozen_result_two = frozen()
    rows = unfrozen_result_two.all()

    # ... etc

.. versionadded:: 1.4

.. seealso::

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

    :func:`_orm.loading.merge_frozen_result` - ORM function to merge
    a frozen result back into a :class:`_orm.Session`.

r   datac                   UR                   R                  5       U l        UR                  U l        UR                  U l        U R                  (       a  [        UR                  5       5      U l        g UR                  5       U l        g r?   )	r
  rP   r$  r  r  r   r  r  r   r  s     rC   r   FrozenResult.__init__v  s`    ((446(.(G(G%!--((V5578DI)DIrF   c                    U R                   (       a  U R                   Vs/ s H  o/PM     sn$ U R                   Vs/ s H  n[        U5      PM     sn$ s  snf s  snf r?   )r  r  r   )rB   elemr,  s      rC   rewrite_rowsFrozenResult.rewrite_rows  sI    (('+yy1ytFy11)-3#DI33 23s
   AAc                   [         R                  [         5      nU R                  Ul        U R                  Ul        U R                  Ul        U R                  (       a  U Vs/ s H  o3S   PM	     snUl        U$ Xl        U$ s  snf r   )r)  __new__r$  r  r  r  )rB   
tuple_datafrds       rC   with_new_rowsFrozenResult.with_new_rows  ss     !!,/mm))&*&C&C#((%/0ZtZ0BG 	 !G	 1s   "Bc                    [        U R                  [        U R                  5      5      nU R                  Ul        U R
                  Ul        U$ r?   )IteratorResultr$  r   r  r  r  r  s     rC   __call__FrozenResult.__call__  s@    &4MM4		?'
 "--*.*G*G'rF   )r  r  r  r$  N)r  Result[_TP])r   zSequence[Sequence[Any]])r  r;  r   r@  )r   r  )r   r   r   r   r   r   r   r  r  r  r   r/   rF   rC   r)  r)  M  s4    $L *4,	rF   r)  c                      \ rS rSrSrSrSr  S       SS jjr\SS j5       r	SSS jjr
SS jrSS	 jrSS
 jr S   SS jjrSS jr S   SS jjrSrg)r  i  zA :class:`_engine.Result` that gets data from a Python iterator of
:class:`_engine.Row` objects or similar row-like data.

.. versionadded:: 1.4

FNc                4    Xl         X l        X0l        X@l        g r?   )r
  iteratorrawr  )rB   r  r  r  r  s        rC   r   IteratorResult.__init__  s     ) (@%rF   c                    U R                   $ )zcReturn ``True`` if this :class:`_engine.IteratorResult` has
been closed

.. versionadded:: 1.4.43

)_hard_closedrA   s    rC   r  IteratorResult.closed  s        rF   c                    U(       a  SU l         U R                  b  U R                  R                  " SSU0UD6  [        / 5      U l        U R                  5         SU l        g )NTr  r/   )r  r  r  r   r  _reset_memoizationsr  )rB   r  kws      rC   r  IteratorResult._soft_close  sP     $D88HH  1d1b1R  " rF   c                .    [         R                  " S5      e)NzThis result object is closed.)r   ResourceClosedErrorrA   s    rC   _raise_hard_closed!IteratorResult._raise_hard_closed  s    %%&EFFrF   c                    U R                   $ r?   )r  rA   s    rC   r   IteratorResult._raw_row_iterator  s    }}rF   c                \    U R                   (       a  U R                  5         U R                  $ r?   )r  r  r  rA   s    rC   r  IteratorResult._fetchiter_impl  s!    ##%}}rF   c                    U R                   (       a  U R                  5         [        U R                  [        5      nU[        L a  U R                  US9  g U$ rK  )r  r  nextr  r   r  )rB   r  r,  s      rC   r  IteratorResult._fetchone_impl  sI     ##%4=='*'>*-JrF   c                    U R                   (       a  U R                  5          [        U R                  5      U R	                  5         $ ! U R	                  5         f = fr?   )r  r  r   r  r  rA   s    rC   r  IteratorResult._fetchall_impl  sA    ##%	&Ds   A Ac                    U R                   (       a  U R                  5         [        [        R                  " U R
                  SU5      5      $ r   )r  r  r   	itertoolsislicer  r  s     rC   r  IteratorResult._fetchmany_impl  s7     ##%I$$T]]At<==rF   )r  r
  r  r  r  r  r   )r  r-   r  (Iterator[_InterimSupportsScalarsRowType]r  r  r  r   r4  r  r  r   r  r   r   r   )r   r   r:  )r   r  r  r  r?   r  )r   r   r   r   r   r  r  r   r   r  r  r  r  r  r  r  r  r   r/   rF   rC   r  r    s     LL &*).
A'
A ;
A #	
A
 #'
A ! !!G "'	, %)>!>	(> >rF   r  c                 >    [        [        / 5      [        / 5      5      $ r?   )r  r   r   r/   rF   rC   null_resultr    s    .r2DH==rF   c                     ^  \ rS rSrSr   S         S	S jjr\S
S j5       rSSU 4S jjjr S   SU 4S jjjr	Sr
U =r$ )ChunkedIteratorResulti  a  An :class:`_engine.IteratorResult` that works from an
iterator-producing callable.

The given ``chunks`` argument is a function that is given a number of rows
to return in each chunk, or ``None`` for all rows.  The function should
then return an un-consumed iterator of lists, each list of the requested
size.

The function can be called at any time again, in which case it should
continue from the same result set but adjust the chunk size as given.

.. versionadded:: 1.4

c                    Xl         X l        X0l        X@l        [        R
                  R                  U R                  S 5      5      U l        XPl        g r?   )	r
  chunksr  r  r  chainfrom_iterabler  dynamic_yield_per)rB   r  r  source_supports_scalarsr  r   s         rC   r   ChunkedIteratorResult.__init__	  s>     )(?%!55dkk$6GH!2rF   c                x    Xl         [        R                  R                  U R	                  U5      5      U l        U $ r?   )rh  r  r  r  r  r  r  s     rC   r  ChunkedIteratorResult.yield_per	  s-     !55dkk#6FGrF   c                :   > [         TU ]  " SSU0UD6  S U l        g )Nr  c                    / $ r?   r/   r]  s    rC   <lambda>3ChunkedIteratorResult._soft_close.<locals>.<lambda>#	  s    2rF   r/   )superr  r  )rB   r  r  r   s      rC   r  !ChunkedIteratorResult._soft_close!	  s    ,,,%rF   c                   > U R                   (       a3  [        R                  R                  U R	                  U5      5      U l        [        TU ]  US9$ r\  )r   r  r  r  r  r  r	  r  )rB   r  r   s     rC   r  %ChunkedIteratorResult._fetchmany_impl%	  s@     !!%OO99$++d:KLDMw&D&11rF   )r
  r  rh  r  r   r  r  )FNF)
r  r-   r  zBCallable[[Optional[int]], Iterator[Sequence[_InterimRowType[_R]]]]r  r   r  r  r   r   r5  r  r  r?   r  )r   r   r   r   r   r   r   r  r  r  r   __classcell__r   s   @rC   r  r    s    * ).%)"'3'3
3 "&3 #3  3" 	 	& &
 %)2!2	(2 2rF   r  c                  V   ^  \ rS rSr% SrSrS\S'       S	U 4S jjrS
SS jjrSr	U =r
$ )r-  i-	  zA :class:`_engine.Result` that is merged from any number of
:class:`_engine.Result` objects.

Returned by the :meth:`_engine.Result.merge` method.

.. versionadded:: 1.4

Fr   rowcountc                l  > X l         [        TU ]	  U[        R                  R                  S U 5       5      5        US   R                  U l        US   R                  U l        US   R                  U l        U R                  R                  " U Vs/ s H  o3R                  PM     sn6 U l	        g s  snf )Nc              3  @   #    U  H  oR                  5       v   M     g 7fr?   )r  )r`  rs     rC   ra  (MergedResult.__init__.<locals>.<genexpr>@	  s      */6!##%%ws   r   )_resultsr	  r   r  r  r  r  rh  r  r  
merge_with)rB   r  resultsr  r   s       rC   r   MergedResult.__init__:	  s      OO)) */6* 	
 %,AJ$C$C!!!*// )0
(K(K%++66%,-WmmW-
-s   B1c                p    U R                    H  nUR                  " SSU0UD6  M     U(       a  SU l        g g )Nr  Tr/   )r  r  r  )rB   r  r  r  s       rC   r  MergedResult._soft_closeO	  s3    AMM*t*r* DK rF   )r  r  r  r  rh  r  )r  r-   r  zSequence[Result[_TP]]r  r  )r   r   r   r   r   r  r   r   r  r   r  r  s   @rC   r-  r-  -	  s4     F
-
8M
* rF   r-  r?   )r   r8   r   r?  r   z#Callable[[Iterable[Any]], Row[Any]])r   zIteratorResult[Any])Xr   
__future__r   enumr   r   r  rp   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r,  r   r    r   r   sql.baser   r   r   r    r!   util._has_cyr"   util.typingr#   r$   _py_rowr%   "sqlalchemy.cyextension.resultproxysql.elementsr&   sql.type_apir'   r   _KeyTyper   r   r   r6   _RowData_RawRowTyper(   r*   r+   _InterimRowType_InterimSupportsScalarsRowType_ProcessorsTyper   _UniqueFilterTyper  r-   KeysViewr@   r   r   r   r   r  r  r  rC  r  
TypingOnlyr  r  r)  r  r  r  r-  r/   rF   rC   <module>r/     s   , "                             " " ( 4  * ! 	3M	03../hm$ h./ S:s*+ CHo ;T"Te5c?+K(
 "'s3x}!5 8$?@AXc]OXc]:; cUCZ( s3x2C)DDE u$ u$p)$ )DK> K^ 37"/(T  ..Z!& Z!z# #4g
>Ys3x0 g
>T]<>"% ]<@@
<# @
F`,r"DOO `FK
I|J7 K
\M73< M`P>VC[ P>f>62N3/ 62r&>#& &rF   