+
     h,+  c                   s    ^ RI HtHtHtHtHtHt ^ RIHtH	t	 ^ RI
Ht ]'       d   ^ RIHt  ! R R4      t ! R R]4      t ! R	 R
]4      tR# )    )TYPE_CHECKINGAnyDictOptionalTupleUnion)
RedisErrorResponseError)str_if_bytes)ClusterNodec                   s,   a  ] tR t^
t o R tR tRtV tR# )AbstractCommandsParserc                sR   \        V4      ^8  d   R# V Uu. uF  p\        V4      NK  	  ppV^ ,          P                  4       pRpVR8X  d*   V^,          P                  4       pVR9   d
   VR,          pV# VR9   d   \        VR,          4      pV# VR9   d   V^,          .pV# u upi )z
Get the keys from pubsub command.
Although PubSub commands have predetermined key locations, they are not
supported in the 'COMMAND's output, so the key positions are hardcoded
in this method
NZPUBSUB:   NNi   NN)ZCHANNELSZNUMSUBZSHARDCHANNELSZSHARDNUMSUB)Z	SUBSCRIBEZ
PSUBSCRIBEZUNSUBSCRIBEZPUNSUBSCRIBE)ZPUBLISHZSPUBLISH)lenr	   upperlist)selfargsZargcommandkeysZpubsub_types   &*    </usr/lib/python3.14/site-packages/redis/_parsers/commands.py_get_pubsub_keysZ'AbstractCommandsParser._get_pubsub_keys   s     t9q=-12TcS!T2q'--/h q'--/KTTBx  RR R>D
 	 // G9D# 3s   B$c                sd   / p\        V^ ,          4      pWCR&   \        V^,          4      VR&   V^,           Uu. uF  p\        V4      NK  	  upVR&   V^,          VR&   V^,          VR&   V^,          VR&   \        V4      ^8  d%   V^,          VR&   V^,          VR&   V^	,          VR	&   V# u upi )
r    nameZarityflagsfirst_key_poslast_key_pos
step_countZtipsZkey_specificationssubcommands)r	   Zintr   )r   r   ZoptionsZcmd_dictcmd_nameZflags   &&,   r   parse_subcommandZ'AbstractCommandsParser.parse_subcommand(   s    
+#
O<CAJGJD\$/JG$+AJ!#*1: !(w<!&qzHV-4QZH)*&-ajH]# Hs   B- N)__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell____classdict__   @r   r   r   
   s     :     r   c                   s<   a  ] tR t^8t o RtR tR tR tR tRt	V t
R# )CommandsParserz
Parses Redis commands to get command keys.
COMMAND output is used to determine key locations.
Commands that do not have a predefined key location are flagged with
'movablekeys', and these commands' keys are determined by the command
'COMMAND GETKEYS'.
c                s6    / V n         V P                  V4       R # N)commands
initialize)r   Zredis_connections   &&r   __init__ZCommandsParser.__init__A   s    ()r)   c                s6   VP                  4       p. pV FP  p\        ;QJ d    R  V 4       F  '       g   K   RM	  RM! R  V 4       4      '       g   K?  VP                  V4       KR  	  V F$  pVP                  V4      W$P	                  4       &   K&  	  W n        R# )c              3   s@   "   T F  qP                  4       x  K  	  R # 5ir+   )Zisupper)Z.0Zxs   & r   Z	<genexpr>Z,CommandsParser.initialize.<locals>.<genexpr>I   s     ,199;;s   TFN)r   ZanyZappendZpoplowerr,   )r   Zrr,   Zuppercase_commandscmd   &&   r   r-   ZCommandsParser.initializeE   st    99;Cs,,sss,,,,"))#.  &C$,LL$5HYY[! & r)   c                s`   \        V4      ^8  d   R# V^ ,          P                  4       pW0P                  9  d   VP                  4       pV^ ,          pW0P                  9   d   V\	        VR,          4      ,           pM=V P                  V4       W0P                  9  d   \        VP                  4        R24      hV P                  P                  V4      pRVR,          9   d   V P                  ! V.VO5!  pV# RVR,          9   g   VR,          R8X  d   V P                  ! V!  pV# VR,          ^ 8X  d   VR	,          ^ 8X  dz   VR
,          ^ 8X  dl   RpRV9   dY   V RV^,          P                  4        2pVR,           F/  p	\        V	^ ,          4      V8X  g   K  V P                  V	4      pRpK1  	  V'       g   R# VR
,          p
V
^ 8  d   \        V4      \        V
4      ,
          p
\	        \        VR	,          V
^,           VR,          4      4      pV Uu. uF  qV,          NK  	  ppV# u upi a8  
Get the keys from the passed command.

NOTE: Due to a bug in redis<7.0, this function does not work properly
for EVAL or EVALSHA when the `numkeys` arg is 0.
 - issue: https://github.com/redis/redis/issues/9493
 - fix: https://github.com/redis/redis/pull/9733

So, don't use this function with EVAL or EVALSHA.
Nr   z( command doesn't exist in Redis commandsZmovablekeysr   Zpubsubr   r   r   r   Fr   Z|Tr   r/   r,   splitr   r-   r   r   Zget_get_moveable_keysr   r	   r   ZabsZrange)r   
redis_connr   r   cmd_name_splitr   r   	is_subcmdsubcmd_namesubcmdr   keys_posposs   &&*          r   get_keysZCommandsParser.get_keysR   s    t9q=7==?==( &^^-N%a(H==(%T"X6 
+==0$#>>+,,TU  --##H-GG,,**:==D8 7 ))WV_-H(($/D4 / %*O,1N+q0!	 G+%-JaQ/@"AK")-"8"8'q	2kA&*&;&;F&CG(,I #9 !">2La"4y3|+<<go.q0@',BWXH *22#IID2 3s   H+c                s    V^ ,          P                  4       \        VR,          4      ,           p VP                  ! R.VO5!  pV#   \         d,   pTP	                  4       pRT9   g   RT9   d    Rp?R# ThRp?ii ; i)a  
NOTE: Due to a bug in redis<7.0, this function does not work properly
for EVAL or EVALSHA when the `numkeys` arg is 0.
 - issue: https://github.com/redis/redis/issues/9493
 - fix: https://github.com/redis/redis/pull/9733

So, don't use this function with EVAL or EVALSHA.
r   COMMAND GETKEYSInvalid arguments The command has no key argumentsN)r4   r   execute_commandr   __str__)r   r6   r   Zpiecesr   emessages   &&*    r   r5   Z!CommandsParser._get_moveable_keys   sw     a4R>1
	--.?I&ID   	iikG#w.5@	s   A A<A75A77A<r,   N)r    r!   r"   r#   __doc__r.   r-   r=   r5   r$   r%   r&   r(   r   r*   r*   8   s$     *!?B r)   r*   c                   st   a  ] tR t^t o RtR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# )AsyncCommandsParsera  
Parses Redis commands to get command keys.

COMMAND output is used to determine key locations.
Commands that do not have a predefined key location are flagged with 'movablekeys',
and these commands' keys are determined by the command 'COMMAND GETKEYS'.

NOTE: Due to a bug in redis<7.0, this does not work properly
for EVAL or EVALSHA when the `numkeys` arg is 0.
 - issue: https://github.com/redis/redis/issues/9493
 - fix: https://github.com/redis/redis/pull/9733

So, don't use this with EVAL or EVALSHA.
c                s   < V ^8  d   QhRR/# )r   returnNr   Zformatr'      "r   __annotate__ AsyncCommandsParser.__annotate__   s     B B$ Br)   c                s    / V n         R # r+   rE   )r   s   &r   r.   ZAsyncCommandsParser.__init__   s	    ?Ar)   Nc                s2   < V ^8  d   QhRS[ R,          RR/# )r   noder
   rH   N)r   rI   rJ   r   rK   rL      s$     T TXm%< T Tr)   c                s   "   V'       d   Wn         V P                   P                  R 4      G Rj  xL
 pVP                  4        UUu/ uF  w  r4VP                  4       VbK  	  uppV n        R#  L>u uppi 5i)ZCOMMANDN)rM   rA   Zitemsr/   r,   )r   rM   r,   r0   r   r1   r   r-   ZAsyncCommandsParser.initialize   sX     I229==BJ..BRSBR,#g-BRS >Ss!   -A6A.A6A0#A60A6c                J   < V ^8  d   QhRS[ RS[S[S[R3,          ,          /# r   r   rH   .r   r   r   ZstrrI   rJ   r   rK   rL      s(     ? ?C ?HU38_,E ?r)   c                s  "   \        V4      ^8  d   R# V^ ,          P                  4       pW P                  9  d   VP                  4       pV^ ,          pW P                  9   d   V\	        VR,          4      ,           pMDV P                  4       G Rj  xL
  W P                  9  d   \        VP                  4        R24      hV P                  P                  V4      pRVR,          9   d   V P                  ! V!  G Rj  xL
 pV# RVR,          9   g   VR,          R8X  d   V P                  ! V!  pV# VR,          ^ 8X  d   VR	,          ^ 8X  dz   VR
,          ^ 8X  dl   RpRV9   dY   V RV^,          P                  4        2pVR,           F/  p\        V^ ,          4      V8X  g   K  V P                  V4      pRpK1  	  V'       g   R# VR
,          p	V	^ 8  d   \        V4      \        V	4      ,
          p	\	        \        VR	,          V	^,           VR,          4      4      p
V
 Uu. uF  qV,          NK  	  ppV#  EL EL<u upi 5ir2   r3   )r   r   r   r7   r   r   r8   r9   r:   r   r;   r<   s   &*          r   r=   ZAsyncCommandsParser.get_keys   s     t9q=7==?==( &^^-N%a(H==(%T"X6 oo'''==0$#>>+,,TU  --##H-GG,,00$77D8 7 ))WV_-H(($/D4 / %*O,1N+q0!	 G+%-JaQ/@"AK")-"8"8'q	2kA&*&;&;F&CG(,I #9 !">2La"4y3|+<<go.q0@',BWXH *22#IID2I ( 84 3sE   BIH8A,I?H; B#I(IAI#H>4I;I>Ic                rN   rO   rP   rI   rJ   r   rK   rL     s(      c huS#X6O r)   c                s   "    V P                   P                  ! R .VO5!  G Rj  xL
 pV#  L  \         d,   pTP                  4       pRT9   g   RT9   d    Rp?R# ThRp?ii ; i5i)r>   Nr?   r@   )rM   rA   r   rB   )r   r   r   rC   rD   s   &*   r   r5   Z&AsyncCommandsParser._get_moveable_keys  sf     
	223DLtLLD  M 	iikG#w.5@	s<   A'!. ,. A'. A$AA'AA$$A')r,   rM   r+   )r    r!   r"   r#   rF   Z	__slots__r.   r-   r=   r5   r$   r%   r&   r(   r   rG   rG      s>      %IB BT T? ?B r)   rG   N)Ztypingr   r   r   r   r   r   Zredis.exceptionsr   r   Zredis.utilsr	   Zredis.asyncio.clusterr
   r   r*   rG   r   r)   r   <module>rQ      sA    C C 6 $1+ +\r+ rjl0 lr)   