
    ph                     D    S SK Jr  S SKJr  SrSS/r\4S\S\S\4S	 jjrg
)    )crc_hqx)EncodedTi @  key_slotREDIS_CLUSTER_HASH_SLOTSkeybucketreturnc                     U R                  S5      nUS:  a*  U R                  SUS-   5      nUS:  a  X2S-   :w  a  XS-   U n [        U S5      U-  $ )zCalculate key slot for a given key.
See Keys distribution model in https://redis.io/topics/cluster-spec
:param key - bytes
:param bucket - int
   {   }   r   )findr   )r   r   startends       C/home/james-whalen/.local/lib/python3.13/site-packages/redis/crc.pyr   r      s[     HHTNErzhhtUQY'8qy(ai#&C3?V##    N)binasciir   redis.typingr   r   __all__intr    r   r   <module>r      s>     ! ! 1
2 +C $( $C $s $r   