
    ph?                     *   % S SK r S SKrS SKJr  S SKJrJrJr  S SKJ	r	J
r
JrJrJrJr  S SKJrJrJrJrJrJr  \R,                  R.                  S:  a!  \R,                  R0                  S:  a  S SKJr  OS SKJr  S	S
KJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.  S	SKJ/r/  SSK0J1r1  SSK2J3r3J4r4  Sr5Sr6Sr7Sr8\\S.r9S\$0r:\ Rv                  " \<5      r= " S S\5      r> " S S\>5      r? " S S\>5      r@ " S S5      rASrBSrCSrDS rES!rFS"rG\D\E\F\G4rH\D\\AR                  4\E\\AR                  4\F\\AR                  4\G\\AR                  4\C\\AR                  40rL\M\N\O\P\   \
4   4   \QS#'    " S$ S%\5      rR " S& S'\5      rS " S( S)\@5      rTg)*    N)ABC)IncompleteReadErrorStreamReaderTimeoutError)	AwaitableCallableListOptionalProtocolUnion)MaintenanceNotificationNodeFailedOverNotificationNodeFailingOverNotificationNodeMigratedNotificationNodeMigratingNotificationNodeMovingNotification      )timeout   )AskErrorAuthenticationError$AuthenticationWrongNumberOfArgsErrorBusyLoadingErrorClusterCrossSlotErrorClusterDownErrorConnectionErrorExecAbortErrorExternalAuthProviderErrorMasterDownErrorModuleError
MovedErrorNoPermissionErrorNoScriptErrorOutOfMemoryErrorReadOnlyError
RedisErrorResponseErrorTryAgainError)
EncodableT   )Encoder)SERVER_CLOSED_CONNECTION_ERRORSocketBufferz:Error loading the extension. Please check the server logs.z5Error unloading module: no such module with that namez/Error unloading module: operation not possible.z[Error unloading module: the module exports one or more module-side data types, can't unload)zxAUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?z(Client sent AUTH, but no password is setzproblem with LDAP servicec                   |    \ rS rSrS\S\S\S\\\\	\\
\\\0\E\E\\\\\\\\\\\\\\S.r\S 5       rS rS	 rS
rg)
BaseParserG   zmax number of clients reachedzinvalid passwordz,wrong number of arguments for 'auth' commandz,wrong number of arguments for 'AUTH' command)ERROOM	WRONGPASS	EXECABORTLOADINGNOSCRIPTREADONLYNOAUTHNOPERMASKTRYAGAINMOVEDCLUSTERDOWN	CROSSSLOT
MASTERDOWNc                    UR                  S5      S   nX R                  ;   aS  U[        U5      S-   S nU R                  U   n[        U[        5      (       a  UR                  U[        5      nU" U5      $ [        U5      $ )zParse an error response r   r+   N)splitEXCEPTION_CLASSESlen
isinstancedictgetr(   )clsresponse
error_codeexception_classs       M/home/james-whalen/.local/lib/python3.13/site-packages/redis/_parsers/base.pyparse_errorBaseParser.parse_errork   s~     ^^C(+
...J! 3 56H!33J?O/400"1"5"5h"N"8,,X&&    c                     [        5       eNNotImplementedErrorselfs    rM   on_disconnectBaseParser.on_disconnectw       !##rP   c                     [        5       erR   rS   rV   
connections     rM   
on_connectBaseParser.on_connectz   rY   rP    N) __name__
__module____qualname____firstlineno__r   r   r   MODULE_LOAD_ERRORr!   MODULE_EXPORTS_DATA_TYPES_ERRORNO_SUCH_MODULE_ERROR MODULE_UNLOAD_NOT_POSSIBLE_ERRORNO_AUTH_SET_ERROREXTERNAL_AUTH_PROVIDER_ERRORr%   r   r   r$   r&   r#   r   r)   r"   r   r   r    rD   classmethodrN   rW   r]   __static_attributes__r_   rP   rM   r0   r0   G   s     ,_ 3!"F!"F{+[ +,k
  
  +!
$  (##!!%#!'*%A!F 	' 	'$$rP   r0   c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
	_RESPBase~   z&Base class for sync-based resp parsingc                 :    Xl         S U l        S U l        S U l        g rR   )socket_read_sizeencoder_sock_bufferrV   rp   s     rM   __init___RESPBase.__init__   s     0
rP   c                 F     U R                  5         g ! [         a     g f = frR   )rW   	ExceptionrU   s    rM   __del___RESPBase.__del__   s%    	  		s    
  c                     UR                   U l         [        U R                   U R                  UR                  5      U l        UR
                  U l        g)zCalled when the socket connectsN)rr   r.   rp   socket_timeoutrs   rq   r[   s     rM   r]   _RESPBase.on_connect   sA    %%
#JJ--z/H/H
 "))rP   c                 |    SU l         U R                  b!  U R                  R                  5         SU l        SU l        g)z"Called when the socket disconnectsN)rr   rs   closerq   rU   s    rM   rW   _RESPBase.on_disconnect   s1    
<<#LL DLrP   c                 ^    U R                   =(       a    U R                   R                  U5      $ rR   )rs   can_read)rV   r   s     rM   r   _RESPBase.can_read   s     ||> 5 5g >>rP   )rs   rr   rq   rp   N)r`   ra   rb   rc   __doc__ru   ry   r]   rW   r   rk   r_   rP   rM   rm   rm   ~   s    0*?rP   rm   c            
       d    \ rS rSrSrSrS\4S jrS\4S jr	 SS\S\
\\S	\\   4   4S
 jjrSrg	)AsyncBaseParser   z5Base parsing class for the python-backed async parser_stream
_read_sizerp   c                     S U l         Xl        g rR   r   rt   s     rM   ru   AsyncBaseParser.__init__   s    /3*rP   returnc                    #    [        5       e7frR   rS   rU   s    rM   can_read_destructive$AsyncBaseParser.can_read_destructive   s     !##   disable_decodingNc                    #    [        5       e7frR   rS   )rV   r   s     rM   read_responseAsyncBaseParser.read_response   s      "##r   )r   r   )F)r`   ra   rb   rc   r   	__slots__intru   boolr   r   r*   r(   r	   r   rk   r_   rP   rM   r   r      sT    ?'I+ +$D $ (-$ $$	z=$Z0@@	A$ $rP   r   c                   H    \ rS rSrSr\S 5       r\S 5       r\S 5       rSr	g)MaintenanceNotificationsParser   zEProtocol defining maintenance push notification parsing functionalityc                 &    U S   nU S   nU" X#5      $ )Nr+   r   r_   )rJ   notification_typeidttls       rM   parse_maintenance_start_msg:MaintenanceNotificationsParser.parse_maintenance_start_msg   s!     a[qk ))rP   c                     U S   nU" U5      $ )Nr+   r_   )rJ   r   r   s      rM   parse_maintenance_completed_msg>MaintenanceNotificationsParser.parse_maintenance_completed_msg   s     a[ $$rP   c                     U S   nU S   nU S   c  Su  p4OMU S   n[        U[        5      (       a  UR                  5       nUR                  S5      u  p4Ub  [	        U5      OS n[        XXB5      $ )Nr+   r   r   )NN:)rF   bytesdecoderC   r   r   )rJ   r   r   hostportvalues         rM   parse_moving_msg/MaintenanceNotificationsParser.parse_moving_msg   sw     a[qkA;#JD$QKE%''S)JD $ 03t9dD%b::rP   r_   N)
r`   ra   rb   rc   r   staticmethodr   r   r   rk   r_   rP   rM   r   r      s?    O* * % %
 ; ;rP   r   
invalidateMOVING	MIGRATINGMIGRATEDFAILING_OVERFAILED_OVER-MSG_TYPE_TO_MAINT_NOTIFICATION_PARSER_MAPPINGc                       \ rS rSr% Sr\\S'   Sr\\   \S'   Sr	\\   \S'   Sr
\\   \S'   S rS	 rS
 rS rS rS rSrg)PushNotificationsParser   z6Protocol defining RESP3-specific parsing functionalitypubsub_push_handler_funcNinvalidation_push_handler_funcnode_moving_push_handler_funcmaintenance_push_handler_funcc                     [        5       e)zHandle pubsub push responsesrS   rV   rJ   s     rM   handle_pubsub_push_response3PushNotificationsParser.handle_pubsub_push_response  s    !##rP   c                    US   n[        U[        5      (       a  UR                  5       nU[        /[        Q[
        P7;  a  U R                  U5      $  U[        :X  a"  U R                  (       a  U R                  U5      $ U[
        :X  a6  U R                  (       a%  [        U   S   nU" U5      nU R                  U5      $ U[        ;   aE  U R                  (       a4  [        U   S   n[        U   S   nU" X5      nUb  U R                  U5      $ g ! [         a/  n[        R                  SR                  X1U5      5         S nAg S nAff = f)Nr   r+   "Error handling {} message ({}): {}rF   r   r   _INVALIDATION_MESSAGE_MAINTENANCE_MESSAGES_MOVING_MESSAGEr   r   r   r   r   rx   loggererrorformatrV   rJ   kwargsmsg_typeparser_functionnotificationr   es           rM   handle_push_response,PushNotificationsParser.handle_push_response  sc   A;h&&(H!
"
 
 

 00::	1177::8DD?*t/Q/Q"O##  /x899,GG00T5W5W"O## %R%%!  /xK+==lKK   	LL4;;HPQR  	s%   +D ?D AD 
E
%EE
c                     Xl         g rR   r   rV   r   s     rM   set_pubsub_push_handler/PushNotificationsParser.set_pubsub_push_handler5  s    (@%rP   c                     Xl         g rR   r   rV   r   s     rM   set_invalidation_push_handler5PushNotificationsParser.set_invalidation_push_handler8  s    .L+rP   c                     Xl         g rR   r   rV   r   s     rM   set_node_moving_push_handler4PushNotificationsParser.set_node_moving_push_handler;      -J*rP   c                     Xl         g rR   r   rV   r   s     rM   set_maintenance_push_handler4PushNotificationsParser.set_maintenance_push_handler>  r   rP   r   r   r   r   )r`   ra   rb   rc   r   r   __annotations__r   r
   r   r   r   r   r   r   r   r   rk   r_   rP   rM   r   r      s^    @&&9="HX$6=8<!8H#5<8<!8H#5<$+ZAMKKrP   r   c                       \ rS rSr% Sr\\S'   Sr\\   \S'   Sr	\\S\
S   4      \S'   Sr\\S\
S   4      \S'   S	 rS
 rS rS rS rS rSrg)AsyncPushNotificationsParseriB  z<Protocol defining async RESP3-specific parsing functionalityr   Nr   .r   r   c                    #    [        5       e7f)z+Handle pubsub push responses asynchronouslyrS   r   s     rM   r   8AsyncPushNotificationsParser.handle_pubsub_push_responseJ  s     !##r   c                 <  #    US   n[        U[        5      (       a  UR                  5       nU[        /[        Q[
        P7;  a  U R                  U5      I Sh  vN $  U[        :X  a*  U R                  (       a  U R                  U5      I Sh  vN $ [        U[        5      (       a  UR                  5       nU[
        :X  a>  U R                  (       a-  [        U   S   nU" U5      nU R                  U5      I Sh  vN $ U[        ;   aM  U R                  (       a<  [        U   S   n[        U   S   nU" X5      nUb  U R                  U5      I Sh  vN $ g N N N` N! [         a/  n[        R                  SR                  X1U5      5         SnAgSnAff = f7f)z$Handle push responses asynchronouslyr   Nr+   r   r   r   s           rM   r   1AsyncPushNotificationsParser.handle_push_responseN  s     A;h&&(H!
"
 
 

 66x@@@	1177!@@JJJ(E**#??,?*t/Q/Q"O##  /x8!??MMM00T5W5W"O## %R%%!  /xK+!%!C!CL!QQQ G A K N R 	LL4;;HPQR  	s   AFEF/E  EE  FA(E  ;E<E  ?F AE  EE  FE  E  E   
F*%FFFFc                     Xl         g)z$Set the pubsub push handler functionNr   r   s     rM   r   4AsyncPushNotificationsParser.set_pubsub_push_handler  s    (@%rP   c                     Xl         g)z*Set the invalidation push handler functionNr   r   s     rM   r   :AsyncPushNotificationsParser.set_invalidation_push_handler  s    .L+rP   c                     Xl         g rR   r   r   s     rM   r   9AsyncPushNotificationsParser.set_node_moving_push_handler  r   rP   c                     Xl         g rR   r   r   s     rM   r   9AsyncPushNotificationsParser.set_maintenance_push_handler  r   rP   r   )r`   ra   rb   rc   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   rk   r_   rP   rM   r   r   B  sz    F&&9="HX$6=NR!8HS)D/5I,J#KRNR!8HS)D/5I,J#KR$/bAMKKrP   r   c                      ^  \ rS rSrSr\R                  S-   rS\4U 4S jjrS r	S r
S rS	\4S
 jrS\S	\4S jrS	\4S jrSrU =r$ )_AsyncRESPBasei  z!Base class for async resp parsing)rq   rs   _pos_chunksrp   c                 \   > [         TU ]  U5        S U l        SU l        / U l        SU l        g )NrP   r   )superru   rq   rs   r   r   )rV   rp   	__class__s     rM   ru   _AsyncRESPBase.__init__  s-    )**.	rP   c                 F    SU l         U R                  R                  5         g )NrP   )rs   r   clearrU   s    rM   _clear_AsyncRESPBase._clear  s    rP   c                     UR                   U l        U R                  c  [        S5      eUR                  U l        U R	                  5         SU l        g)zCalled when the stream connectsNBuffer is closed.T)_readerr   r'   rq   r  
_connectedr[   s     rM   r]   _AsyncRESPBase.on_connect  sB    !))<<011!))rP   c                     SU l         g)z"Called when the stream disconnectsFN)r  rU   s    rM   rW   _AsyncRESPBase.on_disconnect  s	    rP   r   c                 B  #    U R                   (       d  [        S5      eU R                  (       a  g [        S5       IS h  vN   U R                  R                  5       sS S S 5      IS h  vN   $  N/ N! , IS h  vN  (       d  f       g = f! [         a     gf = f7f)Nr  Tr   F)r  r'   rs   async_timeoutr   at_eofr   rU   s    rM   r   #_AsyncRESPBase.can_read_destructive  sg     011<<	$Q''||**, (''''' 		s|   /BB A1B A5B +A3,B 0B1B 3B 5B;A><BB BB 
BBBBlengthc                   #    US-   nU R                   U-   n[        U R                  5      U:  a  U R                  U R                   US-
   nOkU R                  U R                   S n U R                  R	                  U[        U5      -
  5      I Sh  vN nXV-   SS nU R                  R                  U5        U =R                   U-  sl         U$  N=! [
         a  n[        [        5      UeSnAff = f7f)z
        Read `length` bytes of data.  These are assumed to be followed
        by a '
' terminator which is subsequently discarded.
        r   N)
r   rE   rs   r   readexactlyr   r   r-   r   append)rV   r  wantendresulttaildatar   s           rM   _read_AsyncRESPBase._read  s     
 zii$t||#\\$))cAg6F<<		,DQ!\\55dSY6FGG k3B'FLL%		T	 H& Q%&DE5PQs<   A$C3'*C CC 9C3C 
C0C++C00C3c                   #    U R                   R                  SU R                  5      nUS:  a  U R                   U R                  U nOU R                   U R                  S nU R                  R	                  5       I Sh  vN nUR                  S5      (       d  [        [        5      eX4-   SS nU R                  R                  U5        U =R                  [        U5      S-   -  sl        U$  Nn7f)zq
        read an unknown number of bytes up to the next '
'
        line separator, which is discarded.
        s   
r   Nr  r   )rs   findr   r   readlineendswithr   r-   r   r  rE   )rV   foundr  r  r  s        rM   	_readline_AsyncRESPBase._readline  s     
 !!'4995A:\\$))e4F<<		,D..00D==))%&DEEk3B'FLL%		S[1_$	 1s   A=C0?C. A/C0)rs   r   r  r   r   rq   )r`   ra   rb   rc   r   r   r   r   ru   r  r]   rW   r   r   r   r  r  rk   __classcell__)r   s   @rM   r   r     sb    +)),UUI  	D 	# % (  rP   r   )Uloggingsysabcr   asyncior   r   r   typingr   r   r	   r
   r   r   redis.maint_notificationsr   r   r   r   r   r   version_infomajorminorr   r  
exceptionsr   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   encodersr,   socketr-   r.   rd   rf   rg   re   rh   ri   	getLoggerr`   r   r0   rm   r   r   r   r   _MIGRATING_MESSAGE_MIGRATED_MESSAGE_FAILING_OVER_MESSAGE_FAILED_OVER_MESSAGEr   r   r   r   r   rG   strtupletyper   r   r   r   r_   rP   rM   <module>r6     s    
  C C G G  Q3#3#3#9#9R#?06     *    @P N #T     ':0C   !:   
		8	$4$ 4$n ?
  ?F$j $$; ;B %    & $  	  !&BB  &FF #&BB "&FF &77# .tt+,h6	770 4CKh CKLIK8 IKXL_ LrP   