
    ph
                         S SK r S SKrS SKrS SKJrJr  S SKrS SKJrJ	r	  S\S\\	S4   S\\	   4S jr
S	 rS
 rS rSS jrS rS rg)    N)ListTuple)KeysTKeyTkeysargs.returnc                      [        U 5        [        U [        [        45      (       a  U /n O[	        U 5      n  U(       a  U R                  U5        U $ ! [
         a    U /n  N)f = fN)iter
isinstancebytesstrlist	TypeErrorextend)r   r   s     P/home/james-whalen/.local/lib/python3.13/site-packages/redis/commands/helpers.pylist_or_argsr   
   s_    	T
 dUCL))6D:D DK	  vs   )A A A"!A"c                 f    [        U [        5      (       a  U R                  SS5      OU nUS:X  a  gU$ )zAReturn the decoded binary string, or a string, depending on type.utf-8replacenullN)r   r   decode)xrs     r   	nativestrr      s/    (21e(<(<)$!AF{H    c                 N    U c  U $ U  Vs/ s H  n[        U5      PM     sn$ s  snf )z9Given a list of binaries, return the stringified version.)r   )r   objs     r   delistr    #   s(    y&'(asIcNa(((s   "c                    / n1 SknU c  U$ U  H|  nUc  UR                  S5        M   [        U5      n[        U[        5      (       a'  UR                  5       U;   a  UR                  U5        Ma   UR                  [        U5      5        M~     U$ ! [         a    UR                  S5         M  f = f! [         aB     UR                  [        U5      5         M  ! [         a    UR                  U5          M  f = ff = f)z,Optimistically parse the response to a list.>   naninfinity	-infinityN)	appendr   r   r   r   lowerint
ValueErrorfloat)responseresspecial_valuesitemitem_strs        r   parse_to_listr/   *   s    
C5N
<JJt	 H
 h$$)9^)KJJx )

3t9% * J  	JJt	  ))JJuT{+! )JJx(())s;   B0B2B/.B/2
C>=CC:5C>9C::C>c                 D    SR                  S [        U 5       5       5      $ )z+
Returns a random N character long string.
 c              3   j   #    U  H)  n[         R                  " [        R                  5      v   M+     g 7fr   )randomchoicestringascii_lowercase).0r   s     r   	<genexpr> random_string.<locals>.<genexpr>O   s%      7D!f,,--}s   13)joinrange)lengths    r   random_stringr=   K   s&     77 7<V}  r   c                     [         R                   " U 5      nU R                  5        H@  n[        U[        5      (       d  M  X   XR	                  S5      '   UR                  U5        MB     U$ )z3Decode the keys of the given dictionary with utf-8.r   )copyr   r   r   r   pop)r   newobjks      r   decode_dict_keysrC   T   sQ    YYs^FXXZa(.	F88G$%JJqM  Mr   c                 z   [        U [        R                  5      (       d)  [        U [        R                  R                  5      (       a%  U R                  R
                  R                  S5      $ [        U [        R                  R                  5      (       a%  U R                  R
                  R                  S5      $ g )Nprotocol)
r   redisRedisasyncioconnection_poolconnection_kwargsgetclusterAbstractRedisClusternodes_manager)clients    r   get_protocol_versionrP   ^   s    &%++&&*VU]]=P=P*Q*Q%%77;;JGG	FEMM>>	?	?##5599*EE 
@r   )
   )r?   r3   r5   typingr   r   rF   redis.typingr   r   r   r   r    r/   r=   rC   rP    r   r   <module>rU      s^         $u E$)$4 d ")BFr   