+
     h  c                   s  a  R= ta0 t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHtHtHtHt ^ RIHtH t H!t!H"t" ^RI#H$t$ ]PJ                  R>8  d   ^ RIH&t' M^ RI'H&t' ^ R	I(H)t) ^ R
I*H+t+ ^ RI,H-t- ^ RI.H/t/H0t0 ^ RI1H2t2H3t3H4t4H5t5H6t6H7t7H8t8 ^ RI9H:t: ^ RI;H<t<H=t=H>t> ^RI?H@t@HAtAHBtBHCtCHDtD RtERtFRtGRtHRtI ! R R]P                  4      tK]KP                  tM] ^ k ]<'       d   ]BtNM]CtN ! R R]4      tO ! R R]4      tP]]O]P3,          tQ ! R R4      tR ! R R]R4      tS ! R  R!]S4      tT ! R" R#4      tU ! R$ R%]R4      tVR?tWR& R' ltX]! R(]YR)]ZR*]ZR+]XR,]XR-]YR.]YR/]XR0]Z/	4      t[] ^k  ! R1 R2]R3R47      t\R5 R6 lt]]! R7R8R97      t^ ! R: R84      t_ ! R; R<]_4      t`R# )@    N)abstractmethod)chain)MappingProxyType)AnyCallableIterableListMappingOptionalProtocolSetTupleType	TypedDictTypeVarUnion)ParseResultparse_qsunquoteurlparse)format_error_message)timeout)Retry)	NoBackoff)DEFAULT_RESP_VERSION)CredentialProvider"UsernamePasswordCredentialProvider)AuthenticationError$AuthenticationWrongNumberOfArgsErrorConnectionError	DataError
RedisErrorResponseErrorTimeoutError)
EncodableT)HIREDIS_AVAILABLEget_lib_versionstr_if_bytes)
BaseParserEncoder_AsyncHiredisParser_AsyncRESP2Parser_AsyncRESP3Parsers   *s   $s   
s   
    c                   s$    ] tR t^Ft]! 4       tRtR# )	_Sentinel N)__name__
__module____qualname____firstlineno__objectsentinel__static_attributes__r.   r,   =/usr/lib/python3.14/site-packages/redis/asyncio/connection.pyr-   r-   F   s	    xHr,   r-   c                   s2   a  ] tR t^Tt o V 3R lR ltRtV tR# )ConnectCallbackProtocolc                   < V ^8  d   QhRR/#    
connectionAbstractConnectionr.   format__classdict__   "r6   __annotate__Z$ConnectCallbackProtocol.__annotate__U   s    ==#7=r,   c                    R # Nr.   selfr;      &&r6   __call__Z ConnectCallbackProtocol.__call__U   s    #r,   r.   Nr/   r0   r1   r2   rG   r5   __classdictcell__r?      @r6   r7   r7   T   s     ==r,   r7   c                   s2   a  ] tR t^Xt o V 3R lR ltRtV tR# )AsyncConnectCallbackProtocolc                r8   r9   r.   r=   r@   r6   rA   Z)AsyncConnectCallbackProtocol.__annotate__Y   s    CC)=Cr,   c                   "   R # 5irC   r.   rD   rF   r6   rG   Z%AsyncConnectCallbackProtocol.__call__Y   s        r.   NrH   rJ   rK   r6   rL   rL   X   s     CCr,   rL   c            *       s  a  ] tR t^_t o RtRIt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]! 4       RRRRRRR]	RRR^/V 3R lR llt
]3V 3R lR  lltR! tR" t]R# 4       t]R$ 4       tR% tR& tV 3R' lR( ltR) t]R* 4       t]V 3R+ lR, l4       tV 3R- lR. ltV 3R/ lR0 ltRJV 3R1 lR2 lltR3 tR4 tR5 tV 3R6 lR7 ltRKV 3R9 lR: llt V 3R; lR< lt!R= t"RLR>R8R?R/V 3R@ lRA lllt#V 3RB lRC lt$V 3RD lRE lt%RF t&RG t'RHt(V t)R# )Mr<   z0Manages communication to and from a Redis serverdbusernameclient_namelib_namelib_versioncredential_providerpasswordsocket_timeoutsocket_connect_timeoutredis_connect_funcretry_on_timeoutretry_on_errorhealth_check_intervalprotocolNFencodingutf-8encoding_errorsstrictdecode_responsesparser_classsocket_read_sizei   zredis-pyretryencoder_classc          +      s  < V ^8  d   QhRS[ S[S[3,          RS[S[,          RS[S[,          RS[S[,          RS[RS[ S[S[3,          RS[RS[R	S[R
S[S[	,          RS[RS[RS[S[,          RS[S[,          RS[S[,          RS[S[,          RS[S[
,          RS[S[,          RS[S[,          RS[S[,          RS[S[,          /# )r:   rO   rU   rV   rW   rY   rZ   r]   r_   ra   rb   rc   r[   rQ   rR   rS   rP   rd   rX   re   rT   r\   )r   strintr	   floatboolZlistr-   r   r'   r   ConnectCallbackTr(   r   r=   r@   r6   rA   AbstractConnection.__annotate__   s@    P% P% #s(OP% 3-	P%
 !P% !)P% P% dIo.P% P% P% P% :&P% P%  %P% c]P%  3-!P%" c]#P%$ 3-%P%& 'P%( %%56)P%* G}+P%, &&89-P%. 3-/P%r,   c               sN   V'       g	   V'       d   Ve   \        R4      hWn        Wn        Wn        Wn        VV n        W n        VV n        W0n        Vf   TpW@n	        WPn
        V\        J d   . pV'       dT   VP                  \        4       VP                  \        P                  4       VP                  \         P                  4       W`n        V'       g	   V'       dZ   V'       g   \%        \'        4       ^4      V n        M\*        P,                  ! V4      V n        V P(                  P/                  V4       M\%        \'        4       ^ 4      V n        Wn        RV n        V! WxV	4      V n        VV n        R V n        R V n        Wn        V P?                  V
4       . V n         RV n!         \E        V4      pT^8  g   T^8  d   \M        R4      hTT n'        R #   \F         d
    \H        p L5\J         d    \M        R4      hi ; i  X^8  g   T^8  d   \M        R4      hTT n'        i ; i)Nz'username' and 'password' cannot be passed along with 'credential_provider'. Please provide only one of the following arguments: 
1. 'password' and (optional) 'username'
2. 'credential_provider'ip  zprotocol must be an integerzprotocol must be either 2 or 3)(r   rO   rQ   rR   rS   rT   rU   rP   rV   rW   rY   SENTINELappendr"   socketr   asynciorZ   r   r   rd   copyZdeepcopyZupdate_supported_errorsr[   next_health_checkencoderrX   _reader_writer_socket_read_size
set_parser_connect_callbacks_buffer_cutoffrg   	TypeErrorr   
ValueErrorr   r\   )rE   rO   rU   rV   rW   rY   rZ   r]   r_   ra   rb   rc   r[   rQ   rR   rS   rP   rd   rX   re   rT   r\   Zps   &$$$$$$$$$$$$$$$$$$$$$ r6   __init__ZAbstractConnection.__init__   s   2 &9&E+  & &#6   ,!)%3"&<# 0X%N!!,/!!&..1!!'"6"67,N"9;2
 "]]51
JJ..~>y{A.DJ%:"(*$X@PQ"47;7;!1%NP"		%HA 1uA%&FGG$DM  	%$A 	A!"?@@	A 1uA%&FGG$DMs*   )G G?'H )G?2G??H "H$c                    < V ^8  d   QhRS[ /# )r:   	_warningsr   r=   r@   r6   rA   rk      s       r,   c                s    \        V R R4      '       dE   VP                  RV : 2\        V R7        \        P                  ! 4        V P                  4        R# R#   \         d     R# i ; i)ru   Nzunclosed Connection )Zsource)ZgetattrZwarnZResourceWarningrp   get_running_loop_closeZRuntimeError)rE   r~   rF   r6   __del__ZAbstractConnection.__del__   se     4D))NN&th/  ((* *   s   %A A)(A)c                s~    V P                   '       d+   V P                   P                  4        R;V n         V n        R# R# )zB
Internal method to silently close the connection without waiting
N)ru   closert   rE      &r6   r   ZAbstractConnection._close   s0     <<<LL *..DL4< r,   c                s    R P                  R V P                  4        4       4      pRV P                  P                   RV P                  P                   RV R2# )Z,c              3   s4   "   T F  w  rV R V 2x  K  	  R# 5i)Z=Nr.   ).0kv   &  r6   	<genexpr>Z.AbstractConnection.__repr__.<locals>.<genexpr>   s     H5GTQ1QCj5Gs   <.()>)joinrepr_pieces	__class__r0   r/   )rE   Z	repr_args   & r6   __repr__ZAbstractConnection.__repr__   sQ    HHHT5E5E5GHI	4>>,,-Qt~~/F/F.GqSUVVr,   c                rB   rC   r.   r   r   r6   r   ZAbstractConnection.repr_pieces       r,   c                sJ    V P                   R J;'       d    V P                  R J# rC   )rt   ru   r   r   r6   is_connectedZAbstractConnection.is_connected   s"    ||4'DDDLL,DDr,   c                s    \         P                  ! V4      pW P                  9  d   V P                  P                  V4       R# R# )a.  
Register a callback to be called when the connection is established either
initially or reconnected.  This allows listeners to issue commands that
are ephemeral to the connection, for example pub/sub subscription or
key tracking.  The callback must be a _method_ and will be kept as
a weak reference.
N)weakref
WeakMethodrx   rn   )rE   callbackZwm   && r6   register_connect_callbackZ,AbstractConnection.register_connect_callback   s9     ),,,##**2. -r,   c                s     V P                   P                  \        P                  ! V4      4       R#   \         d     R# i ; i)z
De-register a previously registered callback.  It will no-longer receive
notifications on connection events.  Calling this is not required when the
listener goes away, since the callbacks are kept as weak methods.
N)rx   remover   r   r{   )rE   r   rF   r6   deregister_connect_callbackZ.AbstractConnection.deregister_connect_callback  s8    	##**7+=+=h+GH 		s   /3 AAc                4   < V ^8  d   QhRS[ S[,          RR/# )r:   rb   returnN)r   r'   r=   r@   r6   rA   rk     s$     M MtJ'7 MD Mr,   c                s6    V! V P                   R7      V n        R# )z
Creates a new instance of parser_class with socket size:
_socket_read_size and assigns it to the parser for the connection
:param parser_class: The required parser class
)rc   N)rv   _parser)rE   rb   rF   r6   rw   ZAbstractConnection.set_parser  s     $T5K5KLr,   c                s  a "   S P                   '       d   R#  S P                  P                  V 3R lV 3R l4      G Rj  xL
   S P                  '       g   S P                  4       G Rj  xL
  MP\        P                  ! S P                  4      '       d   S P                  S 4      G Rj  xL
 MS P                  S 4       S P"                   Uu. uF  q3! 4       '       g   K  TNK  	  upS n        S P"                   FD  pT! 4       pT! S 4      pT'       g   K  \$        P&                  ! T4      '       g   K:  TG Rj  xL
  KF  	  R#  EL  \        P                   d    h \
        P                  \        P                  3 d    \        R4      h\         d    p\        S P                  T4      4      hRp?i\         d   p\        T4      ThRp?ii ; i ELi EL,  \         d    S P!                  4       G Rj  xL 
  h i ; iu upi  L5i)z5Connects to the Redis server if not already connectedNc                  s$   < S P                  4       # rC   )_connectr   s   r6   <lambda>,AbstractConnection.connect.<locals>.<lambda>  s    r,   c                 s$   < SP                  4       # rC   
disconnect)errorrE   s   &r6   r   r     s    t7Hr,   zTimeout connecting to server)r   rd   call_with_retryrp   ZCancelledErrorro   r   r"   OSErrorr   _error_messageZ	ExceptionrX   
on_connectZiscoroutinefunctionr    r   rx   inspectZisawaitable)rE   eexcZrefr   Ztasks   f     r6   connectZAbstractConnection.connect  s    	0**,,')H  	***oo'''
 2243J3JKK 11$777006 372I2I"S2I3SU332I"S**CuHD>Dt++D11

	 +A %% 	 4 45 	?=>> 	:!$"5"5a"899 	0!#&C/	0 ( 8  	//###	 #T
 s   H
'E	  EE	 G G +G,G 0H
1%G G +G,G H
H"H(+H
H
6H
;H<
H
E	 	8GGGF22G?G GGH
G G H 8G;9H  	H
c                rM   rC   r.   r   r   r6   r   ZAbstractConnection._connect?  s     rN   c                r}   r:   r   rf   r=   r@   r6   rA   rk   D  s      S r,   c                rB   rC   r.   r   r   r6   _host_errorZAbstractConnection._host_errorC  r   r,   c                s&   < V ^8  d   QhRS[ RS[/# )r:   	exceptionr   )BaseExceptionrf   r=   r@   r6   rA   rk   G  s     C C C# Cr,   c                s6    \        V P                  4       V4      # rC   )r   r   )rE   r   rF   r6   r   Z!AbstractConnection._error_messageG  s    #D$4$4$6	BBr,   c                r8   r:   r   Nr.   r=   r@   r6   rA   rk   J  s     U: U:$ U:r,   c                s(
  "   V P                   P                  V 4       V P                   pRpV P                  '       g%   V P                  '       g   V P                  '       dE   V P                  ;'       g!    \        V P                  V P                  4      pVP                  4       pV'       Ed8   V P                  R9  Ed&   \        V P                   \        4      '       dL   V P                  \        4       VP                  V P                   n        V P                   P                  V 4       \        V4      ^8X  d   RV^ ,          .pV P                  ! RV P                  R.VO5!  G Rj  xL
  V P                  4       G Rj  xL
 pVP!                  R4      \#        V P                  4      8w  d5   VP!                  R4      \#        V P                  4      8w  d   \%        R4      hEMV'       dT   V P                  ! R.VO5RR	/ G Rj  xL
   V P                  4       G Rj  xL
 p\)        V4      R8w  d   \+        R4      hMV P                  R9  d   \        V P                   \        4      '       dL   V P                  \        4       VP                  V P                   n        V P                   P                  V 4       V P                  RV P                  4      G Rj  xL
  V P                  4       G Rj  xL
 pV P,                  '       dW   V P                  RRV P,                  4      G Rj  xL
  \)        V P                  4       G Rj  xL
 4      R8w  d   \%        R4      hV P.                  '       d'   V P                  RRRV P.                  4      G Rj  xL
  V P0                  '       d'   V P                  RRRV P0                  4      G Rj  xL
  V P2                  '       d%   V P                  RV P2                  4      G Rj  xL
  R V P.                  V P0                  3 4        F  p V P                  4       G Rj  xL
  K  	  V P2                  '       d4   \)        V P                  4       G Rj  xL
 4      R8w  d   \%        R4      hR# R#  EL# EL EL ELv  \&         dB    T P                  RTR,          R	R
7      G Rj  xL 
  T P                  4       G Rj  xL 
 p ELi ; i EL EL EL EL EL` EL+ L L  \4         d     K  i ; i L5i)z=Initialize the connection, authenticate and select a databaseNZdefaultZHELLOZAUTHs   protoZprotozInvalid RESP versioncheck_healthFr   ZOKzInvalid Username or PasswordZCLIENTZSETNAMEzError setting client nameZSETINFOzLIB-NAMEzLIB-VERZSELECTc              3   s8   "   T F  q'       g   K  Vx  K  	  R # 5irC   r.   )r   Zsentr   r6   r   Z0AbstractConnection.on_connect.<locals>.<genexpr>  s     M#D4$$#Ds   	
zInvalid Database)r:   Z2rl   )r   r   rT   rP   rU   r   Zget_credentialsr\   
isinstancer*   rw   r+   ZEXCEPTION_CLASSESlensend_commandread_responsegetrg   r   r   r&   r   rQ   rR   rS   rO   r!   )rE   parserZ	auth_argsZcred_providerresponseZauth_responseZ_s   &      r6   r   ZAbstractConnection.on_connectJ  s    %	###(( T T5dmmT]]S  &557I 9h6$,,(9:: 12171I1I.''-9~"&	!5	##GT]]FOYOOO!//11H||H%T]]);;AT]]#A$ &&<== ##FKYKUKKK;&*&8&8&: : M*d2)*HII 3 ]](*$,,(9:: 12171I1I.''-##GT]];;;!//11H ##Hi9I9IJJJ$"4"4"6674?%&ABB ===##HiT]]SSS##HiDDTDTUUU777##Hdgg666 NDMM43C3C#DMA((*** N 777$"4"4"6674?%&899 @ y P1 L !;7 ;
 ''	"E'RRR&*&8&8&: : :;$ <1 K6
 TU 7
 +   7s}  ATT"T59T/B;T*R+TRA*T.TRTR  R!R %B7TS(T4S+5T T+S.,TS1	)T3!TS4T+!TS7T#TS:&T*S>=S<>S>TT0T1TTTR )S%SS%SS%!T$S%%T+T.T1T4T7T:T<S>>T	TTTc                s$   < V ^8  d   QhRS[ RR/# )r:   nowaitr   Nri   r=   r@   r6   rA   rk     s      t  r,   c                s  "    \        V P                  4      ;_uu_4       GRj  xL
  V P                  P                  4        V P                  '       g    RRR4      GRj  xL
  R#  V P
                  P                  4        V'       g#   V P
                  P                  4       G Rj  xL
  RT n	        RT n        RRR4      GRj  xL
  R#  L Lm L(  \         d     L3i ; i  RT n	        RT n        i ; i L0  + GRj  xL 
 '       g   i     R# ; i  \        P                   d    \        RT P                   24      Rhi ; i5i)z!Disconnects from the Redis serverNz#Timed out closing connection after )async_timeoutrW   r   Zon_disconnectr   ru   r   Zwait_closedr   rt   rp   r"   )rE   r   rF   r6   r   ZAbstractConnection.disconnect  s    	$T%@%@AAA**,((( BAA
(LL&&( ""ll66888 $(DL#'DL BAA 9  $(DL#'DL BAAA ## 	5d6Q6Q5RS	s   E	!D CD .C:D "C#D 'E	*?C)C*C.C:<D C8D E	D D CC"C%!C""C%%C55C:8D :D	 D
D	D	D E	D /EE	c                s   "   V P                  RRR7      G Rj  xL
  \        V P                  4       G Rj  xL
 4      R8w  d   \        R4      hR#  L7 L5i)z Send PING, expect PONG in returnZPINGFr   NZPONGz#Bad response from PING health check)r   r&   r   r   r   r   r6   
_send_pingZAbstractConnection._send_ping  sP     U;;;d00223v=!"GHH > 	<2s   AAAAAAc                B   "   V P                  4       G Rj  xL
  R#  L5i)z Function to call when PING failsNr   )rE   r   rF   r6   _ping_failedZAbstractConnection._ping_failed       oo   c                s  "   V P                   '       do   \        P                  ! 4       P                  4       V P                  8  d;   V P
                  P                  V P                  V P                  4      G Rj  xL
  R# R# R#  L
5i)z3Check the health of the connection with a PING/PONGN)	r[   rp   r   timerr   rd   r   r   r   r   r   r6   r   ZAbstractConnection.check_health  sh      &&&((*//1D4J4JJ**,,T__d>O>OPPP K ' Qs   A8B:B;Bc                r   )r:   commandr   N)r   bytesr=   r@   r6   rA   rk     s     # #(5/ #d #r,   c                s   "   V P                   P                  V4       V P                   P                  4       G R j  xL
  R #  L5irC   )ru   
writelinesdrain)rE   r   rF   r6   _send_packed_commandZ'AbstractConnection._send_packed_command  s-     (ll  """s   9AAATc                sT   < V ^8  d   QhRS[ S[S[S[S[,          3,          RS[RR/# )r:   r   r   r   N)r   r   rf   r   ri   r=   r@   r6   rA   rk     s5     ' 'UC%89'IM'	'r,   c                s4  "   V P                   '       g   V P                  4       G R j  xL
  M V'       d   V P                  4       G R j  xL
   \        V\        4      '       d   VP                  4       p\        V\        4      '       d   V.pV P                  '       d;   \        P                  ! V P                  V4      V P                  4      G R j  xL
  R # V P                  P                  V4       V P                  P                  4       G R j  xL
  R #  L L LI L  \        P                   d)    T P                  RR7      G R j  xL 
  \        R4      R h\          d   pT P                  RR7      G R j  xL 
  \#        TP$                  4      ^8X  d   RTP$                  ^ ,          rTM&TP$                  ^ ,          pTP$                  ^,          p\'        RT RT R24      ThR p?i\(         d    T P                  RR7      G R j  xL 
  h i ; i5i)NTr   zTimeout writing to socketZUNKNOWNzError z while writing to socket. r   )r   r   r   r   rf   encoder   rV   rp   wait_forr   ru   r   r   r"   r   r   r   argsr   r   )rE   r   r   r   Zerr_noZerrmsgs   &&&   r6   send_packed_commandZ&AbstractConnection.send_packed_command  s        ,,.  ##%%%	'3''!..*'5))")"""&&--g68K8K   ''0ll((*** !%
 +## 	F///...:;E 		///...166{a!*AFF1I! :6(!D  	
 ///...	s   &HDHH	D
HAD!  3D! DD! H8D! DD! HHD! D! !*HEH&H'G*<E?=A-G**H7HHHHc                s*   < V ^8  d   QhRS[ RS[ RR/# )r:   r   kwargsr   Nr   r=   r@   r6   rA   rk     s"     
 
 
s 
t 
r,   c                s   "   V P                  V P                  ! V!  VP                  RR4      R7      G Rj  xL
  R#  L5i)z+Pack and send a command to the Redis serverr   Tr   N)r   pack_commandr   )rE   r   r   s   &*,r6   r   ZAbstractConnection.send_command  s=     &&t$6::nd3S ' 
 	
 	
s   5A >A c                s  "    V P                   P                  4       G Rj  xL
 #  L  \         dL   pT P                  RR7      G Rj  xL 
  T P	                  4       p\        RT RTP                   24      hRp?ii ; i5i)z8Poll the socket to see if there's data that can be read.NTr   Error while reading from z: )r   can_read_destructiver   r   r   r   r   )rE   r   
host_errorr   r6   r   Z'AbstractConnection.can_read_destructive  st     	V::<<<< 	V///...))+J!$=j\AFF8"TUU	Vs<   B( &( B( A>A9A	0A99A>>Bdisconnect_on_errorpush_requestc          	      sR   < V ^8  d   QhRS[ RS[S[,          RS[ RS[S[ ,          /# )r:   disable_decodingr   r   r   )ri   r	   rh   r=   r@   r6   rA   rk     s;     < << %<
 "< tn<r,   c               s  "   Ve   TMV P                   pV P                  4       p Veo   V P                  R	9   d^   \        '       gR   \	        V4      ;_uu_4       GRj  xL
  V P
                  P                  WR7      G Rj  xL
 pRRR4      GRj  xL
  MVeR   \	        V4      ;_uu_4       GRj  xL
  V P
                  P                  VR7      G Rj  xL
 pRRR4      GRj  xL
  MgV P                  R	9   d2   \        '       g&   V P
                  P                  WR7      G Rj  xL
 pM%V P
                  P                  VR7      G Rj  xL
 p V P                  '       d;   \        P                  ! 4       P!                  4       V P                  ,           p	Wn        \%        X\&        4      '       d   VRhV#  EL] EL< EL/  + GRj  xL 
 '       g   i     L; i EL- EL L  + GRj  xL 
 '       g   i     L; i L L  \        P                   d:    Te    R# T'       d   T P                  RR7      G Rj  xL 
  \        RT 24      h\         dD   pT'       d   T P                  RR7      G Rj  xL 
  \        RT RTP                   24      hRp?i\         d&    T'       d   T P                  RR7      G Rj  xL 
  h i ; i5i)
z0Read the response from a previously sent commandN)r   r   )r   Tr   zTimeout reading from r   z : )Z3   )rV   r   r\   r$   r   r   r   rp   r"   r   r   r   r   r   r[   r   r   rr   r   r!   )
rE   r   r   r   r   Zread_timeoutr   r   r   Z	next_times
   &&&$$     r6   r   Z AbstractConnection.read_response  sS     #*"5w4;N;N%%'
)	(MMX-))(666%)\\%?%?)9 &@ &  H 766 )(666%)\\%?%?)9 &@ &  H 766 (*3D3D!%!;!;%5 "< "  "&!;!;%5 "< " . %%%002779D<V<VVI%."h..$W 7  7666
 7  7666
 ## 	E""ooTo222!6zlCDD 	W"ooTo222!$=j\QVVH"UVV 	 #ooTo222	s  #K H H F;H " GF>GH GH KH 3G 4H 7 G(G#G(H 'G&(H ,K-H 
H )H*H .K/H HH K&AK;H >GH G	
G
G	G	H KH #G(&H (H	.G1/
H	:H	<H  KH H K!K$K,KIKKJ<I?= JK*K3KK	KKc                s6   < V ^8  d   QhRS[ RS[S[,          /# )r:   r   r   )r#   r   r   r=   r@   r6   rA   rk   D  s     , ,* ,e ,r,   c           	     s*   . p\        V^ ,          \        4      '       d   Q h\        V^ ,          \        4      '       d>   \        V^ ,          P	                  4       P                  4       4      VR,          ,           pM<RV^ ,          9   d/   \        V^ ,          P                  4       4      VR,          ,           p\        P                  \        \        \        V4      4      P	                  4       \        34      pV P                  p\        V P                  P                  V4       F  p\        V4      p\        V4      V8  g   Wd8  g   \        V\        4      '       dc   \        P                  V\        \        V4      P	                  4       \        34      pVP!                  V4       VP!                  V4       \        pK  \        P                  V\        \        V4      P	                  4       \        V\        34      pK  	  VP!                  V4       V# )z2Pack a series of arguments into the Redis protocol:i   NNs    )r   rh   rf   Ztupler   Zsplit	SYM_EMPTYr   SYM_STARr   SYM_CRLFry   Zmaprs   
memoryview
SYM_DOLLARrn   )rE   r   outputZbuffbuffer_cutoffZargZ
arg_lengths   &*     r6   r   ZAbstractConnection.pack_commandD  s    d1gu----d1gs##a)//12T"X=DT!W_a)DH4D~~xSY)>)>)@(KL++t||**D1C SJD	M)-c:.. ~~:s:'='='?J d#c" ~~"J..0  	! 24 	dr,   c                sV   < V ^8  d   QhRS[ S[ S[,          ,          RS[S[,          /# )r:   commandsr   )r   r#   r   r   r=   r@   r6   rA   rk   r  s)      hx
/C&D e r,   c                s   . p. p^ pV P                   pV F  pV P                  ! V!   F  p\        V4      pWE8  g   W8  g   \        V\        4      '       d1   V'       d%   VP                  \        P                  V4      4       ^ p. pW8  g   \        V\        4      '       d   VP                  V4       K  VP                  V4       WH,          pK  	  K  	  V'       d%   VP                  \        P                  V4      4       V# )z.Pack multiple commands into the Redis protocol)ry   r   r   r   r   rn   r   r   )	rE   r   r   piecesZbuffer_lengthr   ZcmdZchunkZchunklens	   &&       r6   pack_commandsZ AbstractConnection.pack_commandsr  s      ++C**C0u:!1/!%44innV&<=$%MF+z%/L/LMM%(MM%(!-M! 1 & MM)..01r,   c                sF    \        V P                  P                  4      ^ 8H  # )zCheck if the socket is empty)r   rt   Z_bufferr   r   r6   _socket_is_emptyZ#AbstractConnection._socket_is_empty  s    4<<''(A--r,   c                sv   "   V P                  4       '       g   V P                  R R7      G Rj  xL
  K2  R#  L5i)T)r   N)r   r   r   r   r6   process_invalidation_messagesZ0AbstractConnection.process_invalidation_messages  s3     ''))$$$$777 *7s   997	9)ry   rx   r   rt   rv   ru   rQ   rT   rO   rs   r[   rR   rS   rr   rU   r\   rX   rd   rZ   rY   rW   rV   rP   )rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   rr   Zlast_active_atrs   ssl_contextr\   rt   ru   r   rx   ry   Z_lockrv   Z__dict__)FT)FN)*r/   r0   r1   r2   __doc__	__slots__rm   DefaultParserr%   r(   r|   warningsr   r   r   r   r   propertyr   r   r   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r5   rI   rJ   rK   r6   r<   r<   _   s+    :I:P%  P% #'	P%
 +/P% 37P% "'P% 2:P%  P%  (P% "'P% *7P% !&P% ()P% &*P%  #-!P%" &5%6#P%$ #'%P%& "&'P%( :>)P%* (/+P%, =A-P%. #$/P% P%d (0   /W   E E
/	M M)V    C CU: U:n .I Q# #' 'R
 
V<
 %)< (-< <|, ,\ <.8 8r,   r<   c            
       s   a a ] tR tRt oRtRRRRRRR	R
R^ /V3R lV 3R llltR tV3R lR ltR tV3R lR lt	Rt
VtV ;t# )
Connectioni  z4Manages TCP communication to and from a Redis serverhostZ	localhostporti  socket_keepaliveFsocket_keepalive_optionsNsocket_typec                s   < V ^8  d   QhRS[ RS[S[ S[3,          RS[RS[S[S[S[S[S[3,          3,          ,          RS[/# )r:   r   r   r   r   r   )rf   r   rg   ri   r	   r   r   r=   r@   r6   rA   Connection.__annotate__  s_     # # # CHo	#
 # #+73c5j8I3I+J"K# #r,   c               s   < Wn         \        V4      V n        W0n        T;'       g    / V n        WPn        \        SV `  ! R/ VB  R # Nr.   )r   rg   r   r   r   r   superr|   )rE   r   r   r   r   r   r   r   s   &$$$$$,r6   r|   ZConnection.__init__  sA     	I	 0(@(F(FB%&"6"r,   c                s    R V P                   3RV P                  3RV P                  3.pV P                  '       d   VP	                  RV P                  34       V# )r   r   rO   rQ   )r   r   rO   rQ   rn   rE   r   r   r6   r   ZConnection.repr_pieces  sP    499%		':T477OLMM=$*:*:;<r,   c                r}   r   r   r=   r@   r6   rA   r     s     6 6w 6r,   c                s6    R V P                   RV P                  /# r   r   r   r   r   r6   _connection_argumentsZ Connection._connection_arguments  s    		649955r,   c                s>  "   \        V P                  4      ;_uu_4       GRj  xL
  \        P                  ! R/ V P	                  4       B G Rj  xL
 w  rRRR4      GRj  xL
  XV n        XV n        VP                  P                  R4      pV'       d   VP                  \        P                  \        P                  ^4        V P                  '       du   VP                  \        P                  \        P                  ^4       V P                   P#                  4        F%  w  rEVP                  \        P$                  WE4       K'  	  R# R# R#  EL. EL L  + GRj  xL 
 '       g   i     EL; i  \&        \(        3 d    TP+                  4        h i ; i5i)zCreate a TCP socket connectionNro   r.   )r   rW   rp   Zopen_connectionr   rt   ru   Z	transportZget_extra_infoZ
setsockoptro   ZIPPROTO_TCPZTCP_NODELAYr   Z
SOL_SOCKETZSO_KEEPALIVEr   itemsZSOL_TCPr   rz   r   )rE   readerwriterZsockr   r   s   &     r6   r   ZConnection._connect  s.     !<!<===#*#:#: $,,.$ NF >= ..x8OOF..0B0BAF(((OOF$5$5v7J7JAN $ = = C C E= !F )	  > >===  Y'  	s   "FEF(EEEF"E#4F/FE7 A2E7 FEFE4	 E#!
E4	,E4	.	F7#FFc                r}   r   r   r=   r@   r6   rA   r     s     * *S *r,   c                s8    V P                    R V P                   2# )Z:r   r   r   r6   r   ZConnection._host_error  s    ))Adii[))r,   )rt   ru   r   r   r   r   r   )r/   r0   r1   r2   r   r|   r   r   r   r   r5   rI   __classcell__r   r?      @@r6   r   r     si     :#  # !%	#
 "'# OS# # #"6 60* * *r,   r   c                   s   a a ] tR tRt oRtRV3R lV 3R llltV3R lV 3R llt]R 4       t]R 4       t	]R	 4       t
]R
 4       t]R 4       t]R 4       t]R 4       tRtVtV ;t# )SSLConnectioni  zManages SSL connections to and from the Redis server(s).
This class extends the Connection class, adding SSL functionality, and making
use of ssl.SSLContext (https://docs.python.org/3/library/ssl.html#ssl.SSLContext)
c                s   < V ^8  d   QhRS[ S[,          RS[ S[,          RS[RS[ S[,          RS[ S[,          RS[RS[ S[P                  ,          RS[ S[,          /# )	r:   ssl_keyfilessl_certfilessl_cert_reqsssl_ca_certsssl_ca_datassl_check_hostnamessl_min_versionssl_ciphersr	   rf   ri   sslZ
TLSVersionr=   r@   r6   rA   SSLConnection.__annotate__  sx     # #c]# sm# 	#
 sm# c]# !# "#..1# c]#r,   c	                sX   < \        VVVVVVVVR 7      V n        \        S
V `  ! R/ V	B  R# ))keyfilecertfile	cert_reqsca_certsca_datacheck_hostnamemin_versionciphersNr.   )RedisSSLContextr   r   r|   )rE   r   r  r  r  r  r  r  r  r   r   s   &&&&&&&&&,r6   r|   ZSSLConnection.__init__  s<     -<!#!-'	-
 	"6"r,   c                r}   r   r   r=   r@   r6   rA   r
    s      w r,   c                s^   < \         SV `  4       pV P                  P                  4       VR &   V# )r	  )r   r   r   r   )rE   r   r   s   & r6   r   Z#SSLConnection._connection_arguments  s-    .0((,,.ur,   c                .    V P                   P                  # rC   )r   r  r   r   r6   r  ZSSLConnection.keyfile      '''r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.certfile      (((r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.cert_reqs  s    )))r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.ca_certs  r  r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.ca_data  r  r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.check_hostname	  s    ...r,   c                r  rC   )r   r  r   r   r6   r  ZSSLConnection.min_version  s    +++r,   )r   )NNrequiredNNFNN)r/   r0   r1   r2   r   r|   r   r   r  r  r  r  r  r  r  r5   rI   r   r   r   r6   r   r     s     
# #0 
 ( ( ) ) * * ) ) ( ( / / , , ,r,   r   c                   sL   a  ] tR tRt o RtR	V 3R lR lltV 3R lR ltRtV tR# )
r  i  Nc                s   < V ^8  d   QhRS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[RS[ S[P                  ,          RS[ S[,          /# )	r:   r  r  r  r  r  r  r  r  r  r=   r@   r6   rA   RedisSSLContext.__annotate__  s|     6 6#6 3-6 C=	6
 3-6 #6 6 cnn-6 #6r,   c	                sn   Wn         W n        Vf   \        P                  V n        Mi\        V\        4      '       dT   R\        P                  R\        P                  R\        P                  /p	W99  d   \        RV 24      hW,          V n        W@n
        WPn        W`n        Wpn        Wn        R V n        R # )NZnoneZoptionalr  z+Invalid SSL Certificate Requirements Flag: )r  r  r	  Z	CERT_NONEr  r   rf   ZCERT_OPTIONALZCERT_REQUIREDr    r  r  r  r  r  context)
rE   r  r  r  r  r  r  r  r  Z	CERT_REQSs
   &&&&&&&&& r6   r|   ZRedisSSLContext.__init__  s       ]]DN	3''C--C--I
 ) A)M  '1DN ,&15r,   c                s4   < V ^8  d   QhRS[ P                  /# r   )r	  Z
SSLContextr=   r@   r6   rA   r  @  s      S^^ r,   c                sv   V P                   '       Eg   \        P                  ! 4       pV P                  Vn        V P                  Vn        V P                  '       d:   V P                  '       d(   VP                  V P                  V P                  R 7       V P                  '       g   V P                  '       d(   VP                  V P                  V P                  R7       V P                  e   V P                  Vn        V P                  e   VP                  V P                  4       Wn         V P                   # ))r  r  )ZcafileZcadata)r  r	  Zcreate_default_contextr  r  Zverify_moder  r  Zload_cert_chainr  r  Zload_verify_locationsr  Zminimum_versionr  Zset_ciphers)rE   r  r   r6   r   ZRedisSSLContext.get@  s    |||002G%)%8%8G""&..G}}}'''U}}}--T]]4<<-X+*.*:*:'||'##DLL1"L||r,   )	r  r  r  r  r  r  r  r  r  )	r  r  r  r  r  r  r  r  r  )NNNNNFNN)	r/   r0   r1   r2   r   r|   r   r5   rI   rJ   rK   r6   r  r    s!     
I6 6B r,   r  c                   st   a a ] tR tRt oRtRR/V3R lV 3R llltV3R lR ltR	 tV3R
 lR ltRt	Vt
V ;t# )UnixDomainSocketConnectioniQ  z4Manages UDS communication to and from a Redis serverpath c                r}   )r:   r  r   r=   r@   r6   rA   'UnixDomainSocketConnection.__annotate__T  s     # # #r,   c               s4   < Wn         \        SV `  ! R/ VB  R # r   )r  r   r|   )rE   r  r   r   s   &$,r6   r|   Z#UnixDomainSocketConnection.__init__T  s    	"6"r,   c                s\   < V ^8  d   QhRS[ S[S[S[S[S[3,          3,          ,          /# r   )r   r   rf   r   rg   r=   r@   r6   rA   r  X  s+      XeCsCx,@&AB r,   c                s    R V P                   3RV P                  3.pV P                  '       d   VP                  RV P                  34       V# )r  rO   rQ   )r  rO   rQ   rn   r   r   r6   r   Z&UnixDomainSocketConnection.repr_piecesX  sE    499%dgg7MM=$*:*:;<r,   c                sd  "   \        V P                  4      ;_uu_4       GR j  xL
  \        P                  ! V P                  R7      G R j  xL
 w  rR R R 4      GR j  xL
  XV n        XV n        V P                  4       G R j  xL
  R #  Lg L@ L0  + GR j  xL 
 '       g   i     LG; i L(5i)Nr  )r   rW   rp   Zopen_unix_connectionr  rt   ru   r   )rE   r   r   r   r6   r   Z#UnixDomainSocketConnection._connect^  st      !<!<===#*#?#?TYY#OONF >=oo	 >O >=== 	 sh   "B0BB0%BBBB0B %B0B.B0BB0B+	B
B+	$B+	&	B0c                r}   r   r   r=   r@   r6   rA   r  e  s      S r,   c                s    V P                   # rC   r  r   r   r6   r   Z&UnixDomainSocketConnection._host_errore  s    yyr,   )rt   ru   r  )r/   r0   r1   r2   r   r|   r   r   r   r5   rI   r   r   r   r6   r  r  Q  s7     :#b # #    r,   r  c                s:    V ^8  d   QhR\         \        ,          /# r   )r	   ri   r>      "r6   rA   rA   l  s      htn r,   c                 s    V e   V R8X  d   R # \        V \        4      '       d   V P                  4       \        9   d   R# \	        V 4      # )Nr  F)r   rf   ZupperFALSE_STRINGSri   )valuer   r6   to_boolr#  l  s7    }%%++-="@;r,   rO   rV   rW   r   rY   max_connectionsr[   r  r   c                   s,   a  ] tR tRt o V 3R ltRtV tR# )ConnectKwargsi  c                s~   < V ^8  d   Qh/ S[ ;R&   S[ ;R&   S[S[,          ;R&   S[ ;R&   S[;R&   S[;R&   S[ ;R&   # )r:   rP   rU   connection_classr   r   rO   r  )rf   r   r<   rg   r=   r@   r6   rA   ZConnectKwargs.__annotate__  s\     M M  -..  I	 
 I  	G  I r,   r.   N)r/   r0   r1   r2   Z__annotate_func__r5   rI   rJ   rK   r6   r%  r%    s      r,   r%  F)Ztotalc                s0    V ^8  d   QhR\         R\        /# )r:   urlr   )rf   r%  r  r   r6   rA   rA     s     1 13 1= 1r,   c                 s   \        V 4      p/ p\        VP                  4      P                  4        Fa  w  r4V'       g   K  \	        V4      ^ 8  g   K!  \        V^ ,          4      p\        P                  V4      pV'       d    V! V4      W#&   K]  WRV&   Kc  	  VP                  '       d   \        VP                  4      VR&   VP                  '       d   \        VP                  4      VR&   VP                  R8X  d6   VP                  '       d   \        VP                  4      VR&   \        VR&   V# VP                  R9   d   VP                  '       d   \        VP                  4      VR	&   VP                   '       d   \#        VP                   4      VR
&   VP                  '       d:   RV9  d3    \#        \        VP                  4      P%                  RR4      4      VR&   VP                  R8X  d
   \(        VR&   V# Rp\        RV R24      h  \        \        3 d    \        RT R24      hi ; i  \&        \        3 d     Ldi ; i)r    zInvalid value for 'z' in connection URL.rP   rU   Zunixr  r&  redissr   r   rO   Z/r  zredis://, rediss://, unix://z5Redis URL must specify one of the following schemes (Z))Zredisr(  )r   r   Zqueryr   r   r   URL_QUERY_ARGUMENT_PARSERSr   rz   r{   rP   rU   Zschemer  r  Zhostnamer   rg   ZreplaceZAttributeErrorr   )r'  Zparsedr   ZnameZ
value_listr"  r   Zvalid_schemess   &       r6   	parse_urlr*    s   "3-FF$V\\288::#j/A-JqM*E/33D9FW#)%=FL  %t ; $V__5z$V__5z }};;;$V[[1F6N%?!"0 M- 
-	-???$V__5F6N;;; -F6N ;;;4v-"76;;#7#?#?R#HIt ==H$)6F%& M 7CM?RST
 	
E ":. W$':4&@T%UVVW6 #J/ s   
H/1H1 !H.1II_CPConnectionPool)Zboundc                   s   a  ] tR tRt o Rt]V 3R lR l4       t]R3V 3R lR lltR t	R	 t
V 3R
 lR ltR tR tR tR tV 3R lR ltV 3R lR ltRV 3R lR lltV 3R lR ltV 3R lR ltRtV tR# )r,  i  a  
Create a connection pool. ``If max_connections`` is set, then this
object raises :py:class:`~redis.ConnectionError` when the pool's
limit is reached.

By default, TCP connections are created unless ``connection_class``
is specified. Use :py:class:`~redis.UnixDomainSocketConnection` for
unix sockets.

Any additional keyword arguments are passed to the constructor of
``connection_class``.
c                s<   < V ^8  d   QhRS[ S[,          RS[RS[/# )r:   clsr'  r   )r   r+  rf   r=   r@   r6   rA   ConnectionPool.__annotate__  s&     , ,d3i ,c , ,r,   c                sJ    \        V4      pVP                  V4       V ! R/ VB # )a'  
Return a connection pool configured from the given URL.

For example::

    redis://[[username]:[password]]@localhost:6379/0
    rediss://[[username]:[password]]@localhost:6379/0
    unix://[username@]/path/to/socket.sock?db=0[&password=password]

Three URL schemes are supported:

- `redis://` creates a TCP socket connection. See more at:
  <https://www.iana.org/assignments/uri-schemes/prov/redis>
- `rediss://` creates a SSL wrapped TCP socket connection. See more at:
  <https://www.iana.org/assignments/uri-schemes/prov/rediss>
- ``unix://``: creates a Unix Domain Socket connection.

The username, password, hostname, path and all querystring values
are passed through urllib.parse.unquote in order to replace any
percent-encoded values with their corresponding characters.

There are several ways to specify a database number. The first value
found will be used:

1. A ``db`` querystring option, e.g. redis://localhost?db=0

2. If using the redis:// or rediss:// schemes, the path argument
       of the url, e.g. redis://localhost/0

3. A ``db`` keyword argument to this function.

If none of these options are specified, the default db=0 is used.

All querystring options are cast to their appropriate Python types.
Boolean arguments can be specified with string values "True"/"False"
or "Yes"/"No". Values that cannot be properly cast cause a
``ValueError`` to be raised. Once parsed, the querystring arguments
and keyword arguments are passed to the ``ConnectionPool``'s
class initializer. In the case of conflicting arguments, querystring
arguments always win.
r.   )r*  Zupdate)r-  r'  r   Zurl_optionss   &&, r6   from_urlZConnectionPool.from_url  s&    V  nk"}V}r,   Nc                sF   < V ^8  d   QhRS[ S[,          RS[S[,          /# )r:   r&  r$  )r   r<   r	   rg   r=   r@   r6   rA   r.    s-     R R12R "#Rr,   c                s   T;'       g    Rp\        V\        4      '       d   V^ 8  d   \        R4      hWn        W0n        W n        . V n        \        4       V n        V P                  P                  R\        4      V n        R# )r:   z,"max_connections" must be a positive integerre   Nl        )r   rg   r{   r&  connection_kwargsr$  _available_connectionsZset_in_use_connectionsr   r(   re   )rE   r&  r$  r0  s   &&&,r6   r|   ZConnectionPool.__init__  sp     *22U/3//?Q3FKLL 0!2.@B#<?E !3377Qr,   c           
     s    R V P                   P                   RV P                   P                   RV P                  ! R/ V P                  B : R2# )r   r   r   r   r.   )r   r0   r/   r&  r0  r   r   r6   r   ZConnectionPool.__repr__  sN    ))*!DNN,C,C+D%%?(>(>?B"F	
r,   c                sH    . V n         \        P                  ! 4       V n        R # rC   )r1  r   ZWeakSetr2  r   r   r6   resetZConnectionPool.reset  s    &(##*??#4 r,   c                r}   r   r   r=   r@   r6   rA   r.    s     
 
D 
r,   c                sn    V P                   ;'       g#    \        V P                  4      V P                  8  # )z;Return True if a connection can be retrieved from the pool.)r1  r   r2  r$  r   r   r6   can_get_connectionZ!ConnectionPool.can_get_connection  s7     '' D D4++,t/C/CC	
r,   c                s   "   V P                  4       p V P                  V4      G Rj  xL
  V#  L  \         d    T P                  T4      G Rj  xL 
  h i ; i5i)z(Get a connected connection from the poolN)get_available_connectionensure_connectionr   release)rE   command_namekeysoptionsr;   s   &&*, r6   get_connectionZConnectionPool.get_connection$  s\     224
	((444
  5 	,,z***	s1   A1 /1 A1 AAAAc                s    V P                   P                  4       pV P                  P                  V4       V#   \         dD    \        T P                  4      T P
                  8  d   \        R4      RhT P                  4       p Lji ; i)zCGet a connection from the pool, without making sure it is connectedzToo many connectionsN)	r1  ZpopZ
IndexErrorr   r2  r$  r   make_connectionZaddrD   r   r6   r5  Z'ConnectionPool.get_available_connection/  s}    	04488:J
 	  $$Z0  	04++,0D0DD%&<=4G--/J	0s   9 ABBc                s    V P                   pV P                  VP                  RR4      VP                  RR4      VP                  RR4      R7      # )z,Return an encoder based on encoding settingsr]   r^   r_   r`   ra   F)r]   r_   ra   )r0  re   r   )rE   r   r   r6   get_encoderZConnectionPool.get_encoder:  sQ    ''!!ZZ
G4"JJ'8(C#ZZ(:EB " 
 	
r,   c                s:    V P                   ! R/ V P                  B # )z=Create a new connection.  Can be overridden by child classes.r.   )r&  r0  r   r   r6   r<  ZConnectionPool.make_connectionC  s    $$>t'='=>>r,   c                r}   r:   r;   r<   r=   r@   r6   rA   r.  G  s     H H2D Hr,   c                s  "   VP                  4       G Rj  xL
   VP                  4       G Rj  xL
 '       d   \        R4      RhR#  L1 L  \        \        3 db    TP	                  4       G Rj  xL 
  TP                  4       G Rj  xL 
  TP                  4       G Rj  xL 
 '       d   \        R4      Rh R# i ; i5i)z8Ensure that the connection object is connected and validNzConnection has datazConnection not ready)r   r   r   r   r   rD   rF   r6   r6  Z ConnectionPool.ensure_connectionG  s       """
	H44666%&;<$F 7 	# 7) 	H'')))$$&&&44666%&<=4G 7	Hsq   CACA A
	A A C
A $B>0A31B>	B
B>"B%#
B>.B>:C=B>>Cc                r}   r>  r?  r=   r@   r6   rA   r.  W  s     7 7(: 7r,   c                sz   "   V P                   P                  V4       V P                  P                  V4       R# 5i)z(Releases the connection back to the poolN)r2  r   r1  rn   rD   rF   r6   r7  ZConnectionPool.releaseW  s/      	  ''
3##**:6s   9;c                r}   )r:   inuse_connectionsr   r=   r@   r6   rA   r.  ^  s      $ r,   c                s   "   V'       d"   \        V P                  V P                  4      pMV P                  p\        P                  ! R V 4       RR/ G Rj  xL
 p\        R V 4       R4      pV'       d   VhR#  L#5i)z
Disconnects connections in the pool

If ``inuse_connections`` is True, disconnect connections that are
current in use, potentially by other tasks. Otherwise only disconnect
connections that are idle in the pool.
c              3   s@   "   T F  qP                  4       x  K  	  R # 5irC   r   )r   r;   r   r6   r   ,ConnectionPool.disconnect.<locals>.<genexpr>m  s     D*##%%s   Zreturn_exceptionsTNc              3   sV   "   T F  p\        V\        4      '       g   K  Vx  K!  	  R # 5irC   )r   r   )r   Zrr   r6   r   rA  p  s     Dt!z!]'CAAts   )
))r   r1  r2  rp   ZgatherZnext)rE   r@  ZconnectionsZrespr   s   &&   r6   r   ZConnectionPool.disconnect^  s{      8=++T-E-E9K 55K^^DD
"
 
 DtDdKI 
s   AA>A<$A>c                r8   r   r.   r=   r@   r6   rA   r.  t  s        d  r,   c                r   )z-Close the pool, disconnecting all connectionsNr   r   r   r6   acloseZConnectionPool.acloset  r   r   c                s"   < V ^8  d   QhRRRR/# )r:   rd   r   r   Nr.   r=   r@   r6   rA   r.  x  s      w 4 r,   c                sj    V P                    F	  pWn        K  	  V P                   F	  pWn        K  	  R # rC   )r1  rd   r2  )rE   rd   Zconnr   r6   	set_retryZConnectionPool.set_retryx  s,    //DJ 0,,DJ -r,   )r1  r2  r&  r0  re   r$  r   )r/   r0   r1   r2   r   Zclassmethodr/  r   r|   r   r3  r4  r;  r5  r=  r<  r6  r7  r   rB  rC  r5   rI   rJ   rK   r6   r,  r,    s      , ,` 6@)-R R$
5
 
		
?H H 7 7 ,    r,   c                   s   a a ] tR tRt oRt^2^]]P                  3V3R lV 3R llltV 3R lt	V3R lV 3R llt
RtVtV ;t# )	BlockingConnectionPooli  a  
A blocking connection pool::

    >>> from redis.asyncio import Redis, BlockingConnectionPool
    >>> client = Redis.from_pool(BlockingConnectionPool())

It performs the same function as the default
:py:class:`~redis.asyncio.ConnectionPool` implementation, in that,
it maintains a pool of reusable connections that can be shared by
multiple async redis clients.

The difference is that, in the event that a client tries to get a
connection from the pool when all of connections are in use, rather than
raising a :py:class:`~redis.ConnectionError` (as the default
:py:class:`~redis.asyncio.ConnectionPool` implementation does), it
blocks the current `Task` for a specified number of seconds until
a connection becomes available.

Use ``max_connections`` to increase / decrease the pool size::

    >>> pool = BlockingConnectionPool(max_connections=10)

Use ``timeout`` to tell it either how many seconds to wait for a connection
to become available, or to block forever:

    >>> # Block forever.
    >>> pool = BlockingConnectionPool(timeout=None)

    >>> # Raise a ``ConnectionError`` after five seconds if a connection is
    >>> # not available.
    >>> pool = BlockingConnectionPool(timeout=5)
c          	      sv   < V ^8  d   QhRS[ RS[S[ ,          RS[S[,          RS[S[P
                  ,          /# )r:   r$  r   r&  queue_class)rg   r	   r   r<   rp   ZQueuer=   r@   r6   rA   #BlockingConnectionPool.__annotate__  sF       # 12	
 '--(r,   c                sp   < \         SV `  ! RR VRV/VB  \        P                  ! 4       V n        W n        R# )r&  r$  Nr.   )r   r|   rp   Z	Condition
_conditionr   )rE   r$  r   r&  rE  r0  r   s   &&&&&,r6   r|   ZBlockingConnectionPool.__init__  sC     	 	
-	
+	
  	

 "++-r,   c           
     s  <"    V P                   ;_uu_4       GRj  xL
  \        V P                  4      ;_uu_4       GRj  xL
  V P                   P                  V P                  4      G Rj  xL
  \
        SV `  4       pRRR4      GRj  xL
  RRR4      GRj  xL
   T P                  X4      G Rj  xL
  T#  L L} LR L6  + GRj  xL 
 '       g   i     LM; i LD  + GRj  xL 
 '       g   i     L[; i  \        P                   d   p\        R4      ThRp?ii ; i Lq  \         d    T P                  X4      G Rj  xL 
  h i ; i5i)z@Gets a connection from the pool, blocking until one is availableNzNo connection available.)rG  r   r   r   r4  r   r5  rp   r"   r   r6  r   r7  )rE   r8  r9  r:  r;   Zerrr   s   &&*,  r6   r;  Z%BlockingConnectionPool.get_connection  s     	G(666//2243J3JKKK!&!A!CJ 76 '	((444 '6K 7666 ' ## 	G!"<=3F	G
 5 	,,z***	s  ED B?D "C%CC%)C	0C1C	C%CC%D C#D $D, 8D*9D, >E?D C%C	C%C C
C C C%#D %C>	+C.,
C>	7C>	9D =E>D D'D""D''E*D, ,EEEEc                r}   r>  r?  r=   r@   r6   rA   rF    s     % %(: %r,   c                s  <"   V P                   ;_uu_4       GRj  xL
  \        SV `	  V4      G Rj  xL
  V P                   P                  4        RRR4      GRj  xL
  R#  LG L2 L
  + GRj  xL 
 '       g   i     R# ; i5i)z)Releases the connection back to the pool.N)rG  r   r7  Znotify)rE   r;   r   s   &&r6   r7  ZBlockingConnectionPool.release  sJ     ????'/*---OO""$ #??- #???sZ   BA$BA*A&A*BA(B&A*(B*B	0A31
B	<B	>	B)rG  r   )r/   r0   r1   r2   r   r   rp   Z	LifoQueuer|   r;  r7  r5   rI   r   r   r   r6   rD  rD    s=     F  "!#5?+2+<+<  $% % %r,   rD  c                s    V ^8  d   Qh/ ^ \         9   d+   \        \        \        \        \
        3,          ,          ;R&   ^\         9   d(   \        \        \        R\        3,          3,          ;R&   # )r:   r   .r)  )
__conditional_annotations__r   r   r*   r+   r)   r   rf   r   r3   r  r   r6   rA   rA      sZ    X V UtE+->@SSTU UY f GC#v+)>$>? g r,   )r   i   r   )Z0ZFZFALSEZNZNO)brH  rp   rq   Zenumr   ro   r	  Zsysr   r   Zabcr   Z	itertoolsr   Ztypesr   Ztypingr   r   r   r   r   r	   r
   r   r   r   r   r   r   Zurllib.parser   r   r   r   Zutilsr   Zversion_infor   r   Zredis.asyncio.retryr   Zredis.backoffr   Zredis.connectionr   Zredis.credentialsr   r   Zredis.exceptionsr   r   r   r   r    r!   r"   Zredis.typingr#   Zredis.utilsr$   r%   r&   Z_parsersr'   r(   r)   r*   r+   r   r   r   ZSYM_LFr   ZEnumr-   r4   rm   r   r7   rL   rj   r<   r   r   r  r  r!  r#  rg   rh   r)  r%  r*  r+  r,  rD  rA   )rH  rK   r6   <module>rI     s        
 
     "    B A ( z!06 % # 1 T   $ H H  
				   V'M%M>h >D8 D 02NNO w8 w8t6*# 6*r=,J =,@< <~!3 0 / CSc% %GG3g5
C  IU 1h e+,x xvH%^ H%r,   