
    ng\j                       S SK Jr  S SK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  S SKJr  S SKJr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#  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/J0r0J1r1J2r2J3r3J4r4  SS
K5J6r6  SSK7J8r8J9r9  \(       a  S SK:J;r;  \<" / SQ5      r= " S S\5      r> " S S\>5      r? " S S\15      r@ " S S\@\+5      rA " S S\.5      rB " S S\B\)5      rC " S S\>\@\'\3\B\4\/\2\95      rD " S S\?\A\(\3\C\-\*\,\85      rEg)    )annotationsN)TYPE_CHECKINGAnyAsyncIterator	AwaitableDictIterableIteratorListLiteralMappingNoReturnSequenceoverload)key_slot)RedisClusterException
RedisError)AnyKeyTAsyncClientProtocolClusterCommandsProtocolClusterLinksResponseClusterNodeDetailClusterShardsResponse
EncodableTKeysTKeyTPatternT	ResponseTStralgoResponseSyncClientProtocol)deprecated_function   )ACLCommandsAsyncACLCommandsAsyncDataAccessCommandsAsyncFunctionCommandsAsyncManagementCommandsAsyncModuleCommandsAsyncScriptCommandsDataAccessCommandsFunctionCommandsHotkeysMetricsTypesManagementCommandsModuleCommandsPubSubCommandsScriptCommands)list_or_args)AsyncRedisModuleCommandsRedisModuleCommands)TargetNodesT)]BITCOUNTBITFIELD_ROBITPOSEVAL_RO
EVALSHA_ROFCALL_RODBSIZEDIGESTDUMPEXISTS
EXPIRETIMEPEXPIRETIMEKEYSSCANPTTL	RANDOMKEYTTLTYPEGETGETBITGETRANGEMGETSTRLENLCSGEODISTGEOHASHGEOPOS	GEOSEARCHHEXISTSHGETHGETALLHKEYSHLENHMGETHSTRLENHVALS
HRANDFIELDHEXPIRETIMEHPEXPIRETIMEHTTLHPTTLHSCANLINDEXLPOSLLENLRANGESCARDSDIFFSINTER
SINTERCARD	SISMEMBER
SMISMEMBERSMEMBERSSRANDMEMBERSUNIONSSCANZCARDZCOUNTZDIFFZINTER
ZINTERCARD	ZLEXCOUNTZMSCOREZRANDMEMBERZRANGEZRANGEBYLEXZRANGEBYSCOREZRANK	ZREVRANGEZREVRANGEBYLEXZREVRANGEBYSCOREZREVRANKZSCANZSCOREZUNIONXLENXPENDINGXRANGEXREAD	XREVRANGEzJSON.ARRINDEXzJSON.ARRLENzJSON.GETz	JSON.MGETzJSON.OBJKEYSzJSON.OBJLENz	JSON.RESPzJSON.STRLENz	JSON.TYPEz
FT.EXPLAINzFT.INFOz
FT.PROFILEz	FT.SEARCHc                  J   \ rS rSrS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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S j5       r\S S j5       rS!S jrSrg)"ClusterMultiKeyCommands   ;
A class containing commands that handle more than one key
c                    0 nU HH  n[        U R                  R                  U5      5      nUR                  U/ 5      R	                  U5        MJ     U$ )z@Split keys into a dictionary that maps a slot to a list of keys.)r   encoderencode
setdefaultappend)selfkeysslots_to_keyskeyslots        Q/home/edenadmin/noVNC/venv/lib/python3.13/site-packages/redis/commands/cluster.py_partition_keys_by_slot/ClusterMultiKeyCommands._partition_keys_by_slot   sO     CDLL//45D$$T2.55c:      c                    0 nUR                  5        HK  n[        U R                  R                  US   5      5      nUR	                  U/ 5      R                  U5        MM     U$ )zBSplit pairs into a dictionary that maps a slot to a list of pairs.r   )itemsr   r   r   r   extend)r   mappingslots_to_pairspairr   s        r   _partition_pairs_by_slot0ClusterMultiKeyCommands._partition_pairs_by_slot   sY    
 MMODDLL//Q89D%%dB/66t< $ r   c                *   U R                   =(       a	    U[        ;   nU R                  5       nUR                  5        VVs/ s H5  u  pVUR                  " U/UQ7SU R
                  R                  XS5      /06PM7       nnUR                  5       $ s  snnf Ntarget_nodes)read_from_replicasREAD_COMMANDSpipeliner   execute_commandnodes_managerget_node_from_slotexecuter   commandslots_to_argsr   piper   	slot_argss          r   _execute_pipeline_by_slot1ClusterMultiKeyCommands._execute_pipeline_by_slot   s     "44QM9Q}} $1#6#6#8		
 $9    &&99$S $9		
 ||~		
s    <Bc           
         [        UR                  5       U5       VVVVs0 s H  u  pE[        XE5        H  u  pgXg_M	     M     nnnnnU V	s/ s H  oU	   PM	     sn	$ s  snnnnf s  sn	f N)zipvalues)
r   r   r   	responsesslot_valuesresponsekvresultsr   s
             r   _reorder_keys_by_command0ClusterMultiKeyCommands._reorder_keys_by_command   sp     *-]-A-A-CY)O
)O%K2 D2 )O 	 

 )----

 .s   #A
A%c                    [        X5      nU R                  U5      nU R                  SU5      nU R                  XU5      $ )  
Splits the keys into different slots and then calls MGET
for the keys of every slot. This operation will not be atomic
if keys belong to more than one slot.

Returns a list of values ordered identically to ``keys``

For more information see https://redis.io/commands/mget
rJ   r1   r   r   r   r   r   argsr   ress        r   mget_nonatomic&ClusterMultiKeyCommands.mget_nonatomic   sI     D' 44T: ,,V]C ,,T#FFr   c                H    U R                  U5      nU R                  SU5      $ )  
Sets key/values based on a mapping. Mapping is a dictionary of
key/value pairs. Both keys and values should be strings or types that
can be cast to a string via str().

Splits the keys into different slots and then calls MSET
for the keys of every slot. This operation will not be atomic
if keys belong to more than one slot.

For more information see https://redis.io/commands/mset
MSETr   r   r   r   r   s      r   mset_nonatomic&ClusterMultiKeyCommands.mset_nonatomic   s)     66w? --fnEEr   c                X    U R                  U5      n[        U R                  X5      5      $ )^
Runs the given command once for the keys
of each slot. Returns the sum of the return values.
r   sumr   r   r   r   r   s       r   _split_command_across_slots3ClusterMultiKeyCommands._split_command_across_slots  s,     44T: 411'IJJr   c                    g r    r   r   s     r   existsClusterMultiKeyCommands.exists      >Ar   c                    g r   r   r   s     r   r   r          JMr   c                (    U R                   " S/UQ76 $ )z
Returns the number of ``names`` that exist in the
whole cluster. The keys are first split up into slots
and then an EXISTS command is sent for every slot

For more information see https://redis.io/commands/exists
r>   r   r   s     r   r   r   #  s     //@4@@r   c                    g r   r   r   s     r   deleteClusterMultiKeyCommands.delete-  r   r   c                    g r   r   r   s     r   r   r   0  r   r   c                (    U R                   " S/UQ76 $ )a  
Deletes the given keys in the cluster.
The keys are first split up into slots
and then an DEL command is sent for every slot

Non-existent keys are ignored.
Returns the number of keys that were deleted.

For more information see https://redis.io/commands/del
DELr   r   s     r   r   r   3  s     //===r   c                    g r   r   r   s     r   touchClusterMultiKeyCommands.touch@  s    =@r   c                    g r   r   r   s     r   r   r   C  s    ILr   c                (    U R                   " S/UQ76 $ )a!  
Updates the last access time of given keys across the
cluster.

The keys are first split up into slots
and then an TOUCH command is sent for every slot

Non-existent keys are ignored.
Returns the number of keys that were touched.

For more information see https://redis.io/commands/touch
TOUCHr   r   s     r   r   r   F  s     //?$??r   c                    g r   r   r   s     r   unlinkClusterMultiKeyCommands.unlinkU  r   r   c                    g r   r   r   s     r   r   r   X  r   r   c                (    U R                   " S/UQ76 $ )a  
Remove the specified keys in a different thread.

The keys are first split up into slots
and then an TOUCH command is sent for every slot

Non-existent keys are ignored.
Returns the number of keys that were unlinked.

For more information see https://redis.io/commands/unlink
UNLINKr   r   s     r   r   r   [  s     //@4@@r   r   N)r   Iterable[KeyT]returnzDict[int, List[KeyT]])r   Mapping[AnyKeyT, EncodableT]r   zDict[int, List[EncodableT]]r   strr   "Mapping[int, Iterable[EncodableT]]r   	List[Any])r   r   r   r   r   zIterable[Any]r   r   r   r   r   r   r   zList[Any | None]r   r   r   
List[bool]r   r   r   r   r   int)r   r    r   r   r   r   )r   r   r   r   r   Awaitable[int])r   r   r   int | Awaitable[int])__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r   r   r   r      s
   
3
	$
+M	".. :. !	.
 
.G.F&
K A AM MA A AM M> @ @L L@ A AM MAr   r   c                  L    \ rS rSrSrS	S jrS
S jrSS jr      SS jrSr	g)AsyncClusterMultiKeyCommandsij  r   c                   #    [        X5      nU R                  U5      nU R                  SU5      I Sh  vN nU R                  XU5      $  N7f)r   rJ   Nr   r   s        r   r   +AsyncClusterMultiKeyCommands.mget_nonatomico  sU      D' 44T: 226=II ,,T#FF Js   2AAAc                d   #    U R                  U5      nU R                  SU5      I Sh  vN $  N7f)r   r   Nr   r   s      r   r   +AsyncClusterMultiKeyCommands.mset_nonatomic  s2      66w? 33FNKKKKs   '0.0c                t   #    U R                  U5      n[        U R                  X5      I Sh  vN 5      $  N7f)r   Nr   r   s       r   r   8AsyncClusterMultiKeyCommands._split_command_across_slots  s5      44T: 77OOPPOs   +86	8c                  #    U R                   (       a  U R                  5       I S h  vN   U R                  =(       a	    U[        ;   nU R	                  5       nUR                  5        VVs/ s H5  u  pVUR                  " U/UQ7SU R                  R                  XS5      /06PM7       nnUR                  5       I S h  vN $  Ns  snnf  N7fr   )
_initialize
initializer   r   r   r   r   r   r   r   r   s          r   r   6AsyncClusterMultiKeyCommands._execute_pipeline_by_slot  s      //###!44QM9Q}} $1#6#6#8		
 $9    &&99$S $9		
 \\^## $		
 $s.   %CCAC+<C'C=C
>CCr   Nr   r   r   r   )
r   r   r   r   r   r   r   r   r   r  r   r   r   r  r  j  s6    G.L&
Q$$+M$	$r   r  c                  @	   \ rS rSrS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	\        SaS	 j5       r
\        SbS
 j5       r
      ScS jr
\        SaS j5       r\        SbS j5       r      ScS jr\SdS j5       r\      SeS j5       rSfS jr\SgS j5       r\      ShS j5       rSiS jrSjS jr\SkS j5       r\      SlS j5       rSmS jr\ Sn       SoS jj5       r\ Sn       SpS jj5       r Sn     SqS jjr\ Sn     SrS jj5       r\ Sn     SsS jj5       r Sn   StS jjr\SuS  j5       r\SvS! j5       rSwS" jr\ Sn         SxS# jj5       r\ Sn         SyS$ jj5       r Sn       SzS% 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5       r      SS+ jr\  S       SS, jj5       r\  S       SS- jj5       r S     SS. jjr\ Sn     SS/ jj5       r\ Sn     SS0 jj5       r Sn   SS1 jjr\        SS2 j5       r\        SS3 j5       r      SS4 jr\ Sn       SS5 jj5       r\ Sn       SS6 jj5       r Sn     SS7 jjr\            SS8 j5       r\            SS9 j5       r          SS: jr\SS; j5       r\      SS< j5       rSS= jr\ Sn       SS> jj5       r\ Sn       SS? jj5       r Sn     SS@ jjr\ Sn     SSA jj5       r\ Sn     SSB jj5       r Sn   SSC jjr\ Sn     SSD jj5       r\ Sn     SSE jj5       r Sn   SSF jjr\ Sn     SSG jj5       r\ Sn     SSH jj5       rSnSSI jjr\      SSJ j5       r \      SSK j5       r     SSL jr SnSSM jjr!SnSSN jjr"SnSSO jjr#SnSSP jjr$\%" SQSRSS9S/ STSTSTSTSU4               SSV jj5       r&\%" SQSRSS9S/ STSTSTSTSU4               SSW jj5       r'    S           SSX jjr(SSY jr)SSZ jr*SS[ jr+S\r,g)ClusterManagementCommandsi  
A class for Redis Cluster management commands

The class inherits from Redis's core ManagementCommands class and do the
required adjustments to work with cluster mode
c                    [        S5      e)z
Make the server a replica of another instance, or promote it as master.

For more information see https://redis.io/commands/slaveof
z(SLAVEOF is not supported in cluster moder   r   r   kwargss      r   slaveof!ClusterManagementCommands.slaveof  s     $$NOOr   c                    [        S5      e)z
Make the server a replica of another instance, or promote it as master.

For more information see https://redis.io/commands/replicaof
z*REPLICAOF is not supported in cluster moder  r  s      r   	replicaof#ClusterManagementCommands.replicaof  s     $$PQQr   c                    [        S5      e)zW
Swaps two Redis databases.

For more information see https://redis.io/commands/swapdb
z'SWAPDB is not supported in cluster moder  r  s      r   swapdb ClusterManagementCommands.swapdb  s     $$MNNr   c                    g r   r   r   target_nodes     r   cluster_myid&ClusterManagementCommands.cluster_myid       r   c                    g r   r   r  s     r   r   r!         "%r   c                "    U R                  SUS9$ )z
Returns the node's id.

:target_node: 'ClusterNode'
    The node to execute the command on

For more information check https://redis.io/commands/cluster-myid/
zCLUSTER MYIDr   r   r  s     r   r   r!    s     ##N#MMr   c                    g r   r   r   r  slotss      r   cluster_addslots*ClusterManagementCommands.cluster_addslots       r   c                    g r   r   r)  s      r   r+  r,         r   c                .    U R                   " S/UQ7SU06$ )z
Assign new hash slots to receiving node. Sends to specified node.

:target_node: 'ClusterNode'
    The node to execute the command on

For more information see https://redis.io/commands/cluster-addslots
zCLUSTER ADDSLOTSr   r'  r)  s      r   r+  r,    s*     ##
!&
5@
 	
r   c                    g r   r   r)  s      r   cluster_addslotsrange/ClusterManagementCommands.cluster_addslotsrange	  r-  r   c                    g r   r   r)  s      r   r2  r3    r/  r   c                .    U R                   " S/UQ7SU06$ )a  
Similar to the CLUSTER ADDSLOTS command.
The difference between the two commands is that ADDSLOTS takes a list of slots
to assign to the node, while ADDSLOTSRANGE takes a list of slot ranges
(specified by start and end slots) to assign to the node.

:target_node: 'ClusterNode'
    The node to execute the command on

For more information see https://redis.io/commands/cluster-addslotsrange
zCLUSTER ADDSLOTSRANGEr   r'  r)  s      r   r2  r3    s*     ###
&+
:E
 	
r   c                    g r   r   r   slot_ids     r   cluster_countkeysinslot1ClusterManagementCommands.cluster_countkeysinslot%      PSr   c                    g r   r   r7  s     r   r9  r:  (       r   c                &    U R                  SU5      $ )z
Return the number of local keys in the specified hash slot
Send to node based on specified slot_id

For more information see https://redis.io/commands/cluster-countkeysinslot
zCLUSTER COUNTKEYSINSLOTr'  r7  s     r   r9  r:  -  s     ##$=wGGr   c                    g r   r   r   node_ids     r   cluster_count_failure_report6ClusterManagementCommands.cluster_count_failure_report6      UXr   c                    g r   r   r@  s     r   rB  rC  9  r=  r   c                &    U R                  SU5      $ )z
Return the number of failure reports active for a given node
Sends to a random node

For more information see https://redis.io/commands/cluster-count-failure-reports
zCLUSTER COUNT-FAILURE-REPORTSr'  r@  s     r   rB  rC  >  s     ##$CWMMr   c                P    U Vs/ s H  o R                  SU5      PM     sn$ s  snf )
Set hash slots as unbound in the cluster.
It determines by it self what node the slot is in and sends it there

Returns a list of the results for each processed slot.

For more information see https://redis.io/commands/cluster-delslots
CLUSTER DELSLOTSr'  )r   r*  r   s      r   cluster_delslots*ClusterManagementCommands.cluster_delslotsG  s*     LQQ54$$%7>5QQQs   #c                    g r   r   r   r*  s     r   cluster_delslotsrange/ClusterManagementCommands.cluster_delslotsrangeR  rD  r   c                    g r   r   rM  s     r   rN  rO  U  r/  r   c                (    U R                   " S/UQ76 $ )a!  
Similar to the CLUSTER DELSLOTS command.
The difference is that CLUSTER DELSLOTS takes a list of hash slots to remove
from the node, while CLUSTER DELSLOTSRANGE takes a list of slot ranges to remove
from the node.

For more information see https://redis.io/commands/cluster-delslotsrange
zCLUSTER DELSLOTSRANGEr'  rM  s     r   rN  rO  Z  s     ##$;DeDDr   Nc                    g r   r   r   r  options      r   cluster_failover*ClusterManagementCommands.cluster_failovere      
 r   c                    g r   r   rS  s      r   rU  rV  l      
 r   c                    U(       a2  UR                  5       S;  a  [        SU 35      eU R                  SX!S9$ U R                  SUS9$ )z
Forces a slave to perform a manual failover of its master
Sends to specified node

:target_node: 'ClusterNode'
    The node to execute the command on

For more information see https://redis.io/commands/cluster-failover
)FORCETAKEOVERz-Invalid option for CLUSTER FAILOVER command: zCLUSTER FAILOVERr&  )upperr   r   rS  s      r   rU  rV  s  se     ||~%:: CF8L  ++& ,   ''(:'UUr   c                    g r   r   r   r   s     r   cluster_info&ClusterManagementCommands.cluster_info  r=  r   c                    g r   r   r_  s     r   r`  ra    s     %(r   c                "    U R                  SUS9$ )z
Provides info about Redis Cluster node state.
The command will be sent to a random node in the cluster if no target
node is specified.

For more information see https://redis.io/commands/cluster-info
zCLUSTER INFOr&  r'  r_  s     r   r`  ra    s     ##N#NNr   c                    g r   r   r   r   s     r   cluster_keyslot)ClusterManagementCommands.cluster_keyslot  s    DGr   c                    g r   r   re  s     r   rf  rg    r;  r   c                &    U R                  SU5      $ )z
Returns the hash slot of the specified key
Sends to random node in the cluster

For more information see https://redis.io/commands/cluster-keyslot
zCLUSTER KEYSLOTr'  re  s     r   rf  rg    s     ##$5s;;r   c                    g r   r   r   hostportr   s       r   cluster_meet&ClusterManagementCommands.cluster_meet  s     r   c                    g r   r   rk  s       r   rn  ro    s     r   c                $    U R                  SXUS9$ )z
Force a node cluster to handshake with another node.
Sends to specified node.

For more information see https://redis.io/commands/cluster-meet
zCLUSTER MEETr&  r'  rk  s       r   rn  ro    s#     ##D\ $ 
 	
r   c                    g r   r   r   s    r   cluster_nodes'ClusterManagementCommands.cluster_nodes  s    QTr   c                    g r   r   rs  s    r   rt  ru    s     36r   c                $    U R                  S5      $ )z
Get Cluster config for the node.
Sends to random node in the cluster

For more information see https://redis.io/commands/cluster-nodes
zCLUSTER NODESr'  rs  s    r   rt  ru    s     ##O44r   c                    g r   r   r   r   rA  s      r   cluster_replicate+ClusterManagementCommands.cluster_replicate  r-  r   c                    g r   r   ry  s      r   rz  r{    r/  r   c                "    U R                  SX!S9$ )z
Reconfigure a node as a slave of the specified master node

For more information see https://redis.io/commands/cluster-replicate
zCLUSTER REPLICATEr&  r'  ry  s      r   rz  r{    s!     ## $ 
 	
r   c                    g r   r   r   softr   s      r   cluster_reset'ClusterManagementCommands.cluster_reset  rW  r   c                    g r   r   r  s      r   r  r    rY  r   c                <    U R                  SU(       a  SUS9$ SUS9$ )z
Reset a Redis Cluster node

If 'soft' is True then it will send 'SOFT' argument
If 'soft' is False then it will send 'HARD' argument

For more information see https://redis.io/commands/cluster-reset
zCLUSTER RESETs   SOFTs   HARDr&  r'  r  s      r   r  r    s9     ##W $ 
 	
29 $ 
 	
r   c                    g r   r   r_  s     r   cluster_save_config-ClusterManagementCommands.cluster_save_config  r-  r   c                    g r   r   r_  s     r   r  r    r/  r   c                "    U R                  SUS9$ )zv
Forces the node to save cluster state on disk

For more information see https://redis.io/commands/cluster-saveconfig
zCLUSTER SAVECONFIGr&  r'  r_  s     r   r  r    s     ##$8|#TTr   c                    g r   r   r   r   num_keyss      r   cluster_get_keys_in_slot2ClusterManagementCommands.cluster_get_keys_in_slot'  s      r   c                    g r   r   r  s      r   r  r  ,  s     (+r   c                &    U R                  SX5      $ )z
Returns the number of keys in the specified cluster slot

For more information see https://redis.io/commands/cluster-getkeysinslot
zCLUSTER GETKEYSINSLOTr'  r  s      r   r  r  1  s     ##$;TLLr   c                    g r   r   r   epochr   s      r   cluster_set_config_epoch2ClusterManagementCommands.cluster_set_config_epoch;  r-  r   c                    g r   r   r  s      r   r  r  @  rY  r   c                "    U R                  SXS9$ )zx
Set the configuration epoch in a new node

For more information see https://redis.io/commands/cluster-set-config-epoch
zCLUSTER SET-CONFIG-EPOCHr&  r'  r  s      r   r  r  G  s!     ##& $ 
 	
r   c                    g r   r   r   r  rA  r8  states        r   cluster_setslot)ClusterManagementCommands.cluster_setslotS  s     r   c                    g r   r   r  s        r   r  r  \  s     r   c                    UR                  5       S;   a  U R                  SX4X!S9$ UR                  5       S:X  a  [        S5      e[        SU 35      e)z
Bind an hash slot to a specific node

:target_node: 'ClusterNode'
    The node to execute the command on

For more information see https://redis.io/commands/cluster-setslot
)	IMPORTINGNODE	MIGRATINGCLUSTER SETSLOTr&  STABLEz4For "stable" state please use cluster_setslot_stablezInvalid slot state: )r]  r   r   r  s        r   r  r  e  sa     ;;=>>''!77 (   [[]h&STT3E7;<<r   c                    g r   r   r7  s     r   cluster_setslot_stable0ClusterManagementCommands.cluster_setslot_stabley  r;  r   c                    g r   r   r7  s     r   r  r  |  r/  r   c                (    U R                  SUS5      $ )z
Clears migrating / importing state from the slot.
It determines by it self what node the slot is in and sends it there.

For more information see https://redis.io/commands/cluster-setslot
r  r  r'  r7  s     r   r  r    s     ##$5wIIr   c                    g r   r   r   rA  r   s      r   cluster_replicas*ClusterManagementCommands.cluster_replicas  s    
 (+r   c                    g r   r   r  s      r   r  r    s    
 36r   c                "    U R                  SXS9$ )z
Provides a list of replica nodes replicating from the specified primary
target node.

For more information see https://redis.io/commands/cluster-replicas
zCLUSTER REPLICASr&  r'  r  s      r   r  r    s!     ## $ 
 	
r   c                    g r   r   r_  s     r   cluster_slots'ClusterManagementCommands.cluster_slots  s     r   c                    g r   r   r_  s     r   r  r          #r   c                "    U R                  SUS9$ )zn
Get array of Cluster slot to node mappings

For more information see https://redis.io/commands/cluster-slots
zCLUSTER SLOTSr&  r'  r_  s     r   r  r    s     ##O,#OOr   c                    g r   r   r_  s     r   cluster_shards(ClusterManagementCommands.cluster_shards  s     !$r   c                    g r   r   r_  s     r   r  r    s     ,/r   c                "    U R                  SUS9$ )zu
Returns details about the shards of the cluster.

For more information see https://redis.io/commands/cluster-shards
zCLUSTER SHARDSr&  r'  r_  s     r   r  r    s     ##$4<#PPr   c                    g r   r   r_  s     r   cluster_myshardid+ClusterManagementCommands.cluster_myshardid  r"  r   c                    g r   r   r_  s     r   r  r    r$  r   c                "    U R                  SUS9$ )zj
Returns the shard ID of the node.

For more information see https://redis.io/commands/cluster-myshardid/
zCLUSTER MYSHARDIDr&  r'  r_  s     r   r  r    s     ##$7l#SSr   c                    g r   r   r  s     r   cluster_links'ClusterManagementCommands.cluster_links  r  r   c                    g r   r   r  s     r   r  r    s     +.r   c                "    U R                  SUS9$ )aV  
Each node in a Redis Cluster maintains a pair of long-lived TCP link with each
peer in the cluster: One for sending outbound messages towards the peer and one
for receiving inbound messages from the peer.

This command outputs information of all such peer links as an array.

For more information see https://redis.io/commands/cluster-links
zCLUSTER LINKSr&  r'  r  s     r   r  r    s     ##O+#NNr   c                    [        S5      e)NzBCLUSTER FLUSHSLOTS is intentionally not implemented in the client.NotImplementedErrorr_  s     r   cluster_flushslots,ClusterManagementCommands.cluster_flushslots  s    !P
 	
r   c                    [        S5      e)NzACLUSTER BUMPEPOCH is intentionally not implemented in the client.r  r_  s     r   cluster_bumpepoch+ClusterManagementCommands.cluster_bumpepoch  s    !O
 	
r   c                H    US:X  d  US:X  a  SU l         U R                  SUS9$ )z
Enables read queries.
The command will be sent to the default cluster node if target_nodes is
not specified.

For more information see https://redis.io/commands/readonly
replicasallTREADONLYr&  r   r   r_  s     r   readonly"ClusterManagementCommands.readonly  s3     :%)> '+D###J\#JJr   c                0    SU l         U R                  SUS9$ )z
Disables read queries.
The command will be sent to the default cluster node if target_nodes is
not specified.

For more information see https://redis.io/commands/readwrite
F	READWRITEr&  r  r_  s     r   	readwrite#ClusterManagementCommands.readwrite  s"     #(##Kl#KKr   7.2.0(Use client-side caching feature instead.versionreasonFr  c                .    U R                  SUUUUUUUS9$ )`  
Enables the tracking feature of the Redis server, that is used
for server assisted client side caching.

When clientid is provided - in target_nodes only the node that owns the
connection with this id should be provided.
When clientid is not provided - target_nodes can be any node.

For more information see https://redis.io/commands/client-tracking
Tr&  client_trackingr   clientidprefixbcastoptinoptoutnoloopr   s           r   client_tracking_on,ClusterManagementCommands.client_tracking_on  s4    0 ##% $ 	
 		
r   c                .    U R                  SUUUUUUUS9$ )a  
Disables the tracking feature of the Redis server, that is used
for server assisted client side caching.

When clientid is provided - in target_nodes only the node that owns the
connection with this id should be provided.
When clientid is not provided - target_nodes can be any node.

For more information see https://redis.io/commands/client-tracking
Fr&  r  r  s           r   client_tracking_off-ClusterManagementCommands.client_tracking_off@  s4    0 ##% $ 	
 		
r   c                    [        S5      ez
Cluster client does not support hotkeys command. Please use the non-cluster client.

For more information see https://redis.io/commands/hotkeys-start
VHOTKEYS commands are not supported in cluster mode. Please use the non-cluster client.r  r   metricscountdurationsample_ratior*  r  s          r   hotkeys_start'ClusterManagementCommands.hotkeys_startc  s     "d
 	
r   c                    [        S5      ez
Cluster client does not support hotkeys command. Please use the non-cluster client.

For more information see https://redis.io/commands/hotkeys-stop
r  r  r   r  s     r   hotkeys_stop&ClusterManagementCommands.hotkeys_stopu       "d
 	
r   c                    [        S5      ez
Cluster client does not support hotkeys command. Please use the non-cluster client.

For more information see https://redis.io/commands/hotkeys-reset
r  r  r  s     r   hotkeys_reset'ClusterManagementCommands.hotkeys_reset  r  r   c                    [        S5      ez
Cluster client does not support hotkeys command. Please use the non-cluster client.

For more information see https://redis.io/commands/hotkeys-get
r  r  r  s     r   hotkeys_get%ClusterManagementCommands.hotkeys_get  r  r   )r   )r   r   )r   r    r  'TargetNodesT'r   bytes | str)r   r   r  r  r   Awaitable[bytes | str])r  r  r   $bytes | str | Awaitable[bytes | str])r   r    r  r  r*  r   r   bool)r   r   r  r  r*  r   r   Awaitable[bool])r  r  r*  r   r   bool | Awaitable[bool])r   r    r8  r   r   r   )r   r   r8  r   r   r   )r8  r   r   r   )r   r    rA  r   r   r   )r   r   rA  r   r   r   )rA  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  rT  
str | Noner   r	  )r   r   r  r  rT  r  r   r
  )r  r  rT  r  r   r  )r   r    r   'TargetNodesT' | Noner   zdict[str, str])r   r   r   r  r   zAwaitable[dict[str, str]])r   r  r   z*dict[str, str] | Awaitable[dict[str, str]])r   r    r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   )
r   r    rl  r   rm  r   r   r  r   r	  )
r   r   rl  r   rm  r   r   r  r   r
  )rl  r   rm  r   r   r  r   r  )r   r    r   dict[str, ClusterNodeDetail])r   r   r   'Awaitable[dict[str, ClusterNodeDetail]])r   Fdict[str, ClusterNodeDetail] | Awaitable[dict[str, ClusterNodeDetail]])r   r    r   r  rA  r   r   r	  )r   r   r   r  rA  r   r   r
  )r   r  rA  r   r   r  )TN)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   r  r   r  )r   r    r   r   r  r   r   zlist[bytes | str])r   r   r   r   r  r   r   zAwaitable[list[bytes | str]])r   r   r  r   r   z0list[bytes | str] | Awaitable[list[bytes | str]])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  rA  r   r8  r   r  r   r   r	  )r   r   r  r  rA  r   r8  r   r  r   r   r
  )
r  r  rA  r   r8  r   r  r   r   r  )r   r    r8  r   r   r	  )r   r   r8  r   r   r
  )r8  r   r   r  )r   r    rA  r   r   r  r   r  )r   r   rA  r   r   r  r   r  )rA  r   r   r  r   r  )r   r    r   r  r   z	list[Any])r   r   r   r  r   zAwaitable[list[Any]])r   r  r   z list[Any] | Awaitable[list[Any]])r   r    r   r  r   r   )r   r   r   r  r   z Awaitable[ClusterShardsResponse])r   r  r   z8ClusterShardsResponse | Awaitable[ClusterShardsResponse])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   zAwaitable[ClusterLinksResponse])r  r  r   z6ClusterLinksResponse | Awaitable[ClusterLinksResponse])r   r  r   None)r   r  r   r   r  
int | Noner  zSequence[KeyT]r  r	  r  r	  r  r	  r  r	  r   r  r   r   NNNN)r  List[HotkeysMetricsTypes]r  r  r  r  r  r  r*  List[int] | Noner   str | bytes)r   r  )r   zlist[dict[str | bytes, Any]])-r   r   r   r   r   r  r  r  r   r   r+  r2  r9  rB  rJ  rN  rU  r`  rf  rn  rt  rz  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    s-   PRO  /=	  %!%0>%	% %N  /=GQ	  !0>HR	 
)
3=
	
  /=GQ	  !0>HR	 
)
3=
	
$ S S!,/	 H X X!,/	 N	R X X!+5	 	E  " #  
	   "!#  
	  AEV)V3=V	V0 HL 0E	  IM(!(1F(	"( (
 59
O1
O	3
O G GS S< 
 /3	   ,	
 
  
 /3	!  ,	
 
  KO

"
2G
	
 T T6!6	06 6	5	O	5  0>IL	  !1?JM	 

*

58

	

  .2  , 
	   .2! , 
	  HL

/D
	
 HL 0E	  IM!1F	 
 59U1U	U    (+ 7: 	    +!+),+8;+	%+ +MM#&M	9M TX ),<Q	   /3! , 
	  AE



(=

	

  #  	
  
  !#  	
  
 =)=47=BE=NQ=	=( S S!,/	 J  /3+ ++ ,+ 
&	+ +  /36!66 ,6 
1	6 6 CG

*?
	O
 HL 0E	  IM#!#1F#	# #
 59P1P	)P HL$ $0E$	$ $ IM/!/1F/	)/ /
 59Q1Q	AQ HL 0E	  IM%!%1F%	% %T # #/=#	# # .!.0>.	(. .O)O	?O



K
L 9  $!#.3

 
 	

 
 
 
 ,
 

	
> 9  $!#.3

 
 	

 
 
 
 ,
 

	
D !##'"&
*
 
 	

 !
  
 

$


r   r  c                     \ rS rSrSrSS jr\" SSS9S/ SSSSS	4               SS
 jj5       r\" SSS9S/ SSSSS	4               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rg)AsyncClusterManagementCommandsi  r  c                Z   ^ #    [         R                  " U 4S jU 5       6 I Sh  vN $  N7f)rH  c              3  p   >#    U  H+  n[         R                  " TR                  S U5      5      v   M-     g7f)rI  N)asynciocreate_taskr   ).0r   r   s     r   	<genexpr>BAsyncClusterManagementCommands.cluster_delslots.<locals>.<genexpr>  s4      !D ##D$8$89KT$RSS!s   36N)r  gatherrM  s   ` r   rJ  /AsyncClusterManagementCommands.cluster_delslots  s0      ^^!
 
 	
 
s   !+)+r  r  r  NFr  c                J   #    U R                  SUUUUUUUS9I Sh  vN $  N7f)r  Tr&  Nr  r  s           r   r  1AsyncClusterManagementCommands.client_tracking_on  sA     0 ))% * 	
 	
 		
 	
   #!#c                J   #    U R                  SUUUUUUUS9I Sh  vN $  N7f)r  Fr&  Nr  r  s           r   r  2AsyncClusterManagementCommands.client_tracking_off  sA     0 ))% * 	
 	
 		
 	
r&  c                    #    [        S5      e7fr  r  r  s          r   r  ,AsyncClusterManagementCommands.hotkeys_start  s      "d
 	
   c                    #    [        S5      e7fr  r  r  s     r   r  +AsyncClusterManagementCommands.hotkeys_stop        "d
 	
r+  c                    #    [        S5      e7fr  r  r  s     r   r  ,AsyncClusterManagementCommands.hotkeys_reset  r.  r+  c                    #    [        S5      e7fr  r  r  s     r   r  *AsyncClusterManagementCommands.hotkeys_get  r.  r+  r   r  r  r  )r  r  r  r  r  r  r  r  r*  r  r   Awaitable[str | bytes])r   r3  )r   z'Awaitable[list[dict[str | bytes, Any]]])r   r   r   r   r   rJ  r!   r  r  r  r  r  r  r  r   r   r   r  r    sq   
  9  $!#.3

 
 	

 
 
 
 ,
 

	
> 9  $!#.3

 
 	

 
 
 
 ,
 

	
D !##'"&
*
 
 	

 !
  
 
 
$


r   r  c                    ^  \ rS rSrSr\     S                   S	S jj5       r\     S                   S
S jj5       r     S                 SU 4S jjjr   S       SS jjrSrU =r	$ )ClusterDataAccessCommandsi%  
A class for Redis Cluster Data Access Commands

The class inherits from Redis's core DataAccessCommand class and do the
required adjustments to work with cluster mode
c	                    g r   r   
r   algovalue1value2specific_argumentlenidxminmatchlenwithmatchlenr  s
             r   stralgo!ClusterDataAccessCommands.stralgo-  s     r   c	                    g r   r   r8  s
             r   rA  rB  ;  s     &)r   c	           
        > U	R                  SS5      n
US:X  a  U
c  Sn
U	R                  SU
05        [        TU ]  " UUUUUUUU40 U	D6$ )a'  
Implements complex algorithms that operate on strings.
Right now the only algorithm implemented is the LCS algorithm
(longest common substring). However new algorithms could be
implemented in the future.

``algo`` Right now must be LCS
``value1`` and ``value2`` Can be two strings or two keys
``specific_argument`` Specifying if the arguments to the algorithm
will be keys or strings. strings is the default.
``len`` Returns just the len of the match.
``idx`` Returns the match positions in each string.
``minmatchlen`` Restrict the list of matches to the ones of a given
minimal length. Can be provided only when ``idx`` set to True.
``withmatchlen`` Returns the matches with the len of the match.
Can be provided only when ``idx`` set to True.

For more information see https://redis.io/commands/stralgo
r   Nstringszdefault-node)popupdatesuperrA  )r   r9  r:  r;  r<  r=  r>  r?  r@  r  r   	__class__s              r   rA  rB  I  sk    > zz.$7	)l.B)L~|45w

 

 
	
r   c           
   +  b  #    U R                   " SXUS.UD6u  pVU S h  vN   UR                  5        VVs0 s H  u  pxUS:w  d  M  Xx_M     nnnU(       a  UR                  5        Vs0 s H  owU R                  US9_M     n	nUR	                  SS 5        U(       a{  UR                  5        H1  u  pxU R                   " SUUUUX   S.UD6u  pU S h  vN   X   XW'   M3     UR                  5        VVs0 s H  u  pxUS:w  d  M  Xx_M     nnnU(       a  Mz  g g g  Ns  snnf s  snf  NSs  snnf 7fN)matchr  _typer   )	node_namer   )cursorrL  r  rM  r   r   scanr   r   get_noderF  )r   rL  r  rM  r  cursorsdatanamerO  nodescurs              r   	scan_iter#ClusterDataAccessCommands.scan_iterx  s6     		R%R6R4;MMOSOLDvQR{<4<OSEL\\^T^T4==4=88^ET JJ~t,$+MMOLD $		 !%###%*[! !!IC  $OO$'IGM %4 6=]]_5D\TRSLDL_   '  	S U $s]   D/DD/DDD/)D"AD/D'!D/5D)D)
D/D/D/)D/r   )rE  FFNF)r   r    r9  Literal['LCS']r:  r   r;  r   r<  $Literal['strings'] | Literal['keys']r=  r	  r>  r	  r?  r  r@  r	  r   r   )r   r   r9  rZ  r:  r   r;  r   r<  r[  r=  r	  r>  r	  r?  r  r@  r	  r   zAwaitable[StralgoResponse])r9  rZ  r:  r   r;  r   r<  r[  r=  r	  r>  r	  r?  r  r@  r	  r   z,StralgoResponse | Awaitable[StralgoResponse]NNN)rL  PatternT | Noner  r  rM  r  r   r
   )
r   r   r   r   r   r   rA  rX  r  __classcell__)rI  s   @r   r5  r5  %  s     CL"&"   	
 @      
   CL"&")!)) ) 	)
 @) ) )  ) ) 
$) )$ CL"&"-
-
 -
 	-

 @-
 -
 -
  -
 -
 
6-
 -
b "&  	!! ! 	! 
! !r   r5  c                  :    \ rS rSrSr   S       SS jjrSrg)AsyncClusterDataAccessCommandsi  r6  Nc           
      #    U R                   " SXUS.UD6I S h  vN u  pVU H  nU7v   M
     UR                  5        VV	s0 s H  u  pU	S:w  d  M  X_M     nnn	U(       a  UR                  5        Vs0 s H  oU R                  US9_M     n
nUR	                  SS 5        U(       a  UR                  5        H=  u  pU R                   " SU	UUUX   S.UD6I S h  vN u  pU H  nU7v   M
     X   XX'   M?     UR                  5        VV	s0 s H  u  pU	S:w  d  M  X_M     nnn	U(       a  M  g g g  GNs  sn	nf s  snf  Nds  sn	nf 7frK  rP  )r   rL  r  rM  r  rS  rT  valuerU  rO  rV  rW  s               r   rX  (AsyncClusterDataAccessCommands.scan_iter  sU     #iiXeXQWXXEK  5<MMOSOLDvQR{<4<OSEL\\^T^T4==4=88^ET JJ~t,$+MMOLD&*ii '%###%*[' !' !IC "&# "&$'IGM %4 6=]]_5D\TRSLDL_   '  Y T U!s^   ED2'ED5D5E5D;AEE 1EEE#
E/E5EEr   r\  )rL  r]  r  r  rM  r  r   r   )r   r   r   r   r   rX  r  r   r   r   r`  r`    sB     "&  	## # 	# 
# #r   r`  c                      \ rS rSrSrSrg)RedisClusterCommandsi  [  
A class for all Redis Cluster commands

For key-based commands, the target node(s) will be internally determined
by the keys' hash slot.
Non-key-based commands can be executed with the 'target_nodes' argument to
target specific nodes. By default, if target_nodes is not specified, the
command will be executed on the default cluster node.

:param :target_nodes: type can be one of the followings:
    - nodes flag: ALL_NODES, PRIMARIES, REPLICAS, RANDOM
    - 'ClusterNode'
    - 'list(ClusterNodes)'
    - 'dict(any:clusterNodes)'

for example:
    r.cluster_info(target_nodes=RedisCluster.ALL_NODES)
r   Nr   r   r   r   r   r  r   r   r   re  re        r   re  c                      \ rS rSrSrSrg)AsyncRedisClusterCommandsi  rf  r   Nrg  r   r   r   rj  rj    rh  r   rj  )F
__future__r   r  typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   	redis.crcr   redis.exceptionsr   r   redis.typingr   r   r   r   r   r   r   r   r   r   r   r   r    redis.utilsr!   corer#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   helpersr1   redismodulesr2   r3   redis.asyncio.clusterr4   	frozensetr   r   r  r  r  r5  r`  re  rj  r   r   r   <module>rv     s&   "       >    ,     " G2 jl^yA5 yAxL$#: L$^X
 2 X
vN
6N
bt 2 tn-6-`> ""r   