
    ng\j                        S SK r S SKrS SKrS SKJrJrJrJrJrJ	r	J
r
  S SKrS SKJrJrJr  S\S\\   S-  S\\   4S jrS\\S4   S	\	\\4   S\\\S-  4   4S
 jrS\	\\S-  4   S\\\-     4S jrS rS rS rS S jrS rS rS rSSSS.S\
\   S\S\\\S\4   4   S\\\S\4   4   S\\\S\4   4   S\
\\\S\4   4      S\
\\\S\4   4      S\
\\\S\4   4      S\\\S\4   4   4S jjr S\\   4S jr!g)!    N)AnyCallableDictIterableListMappingOptional)ChannelTPubSubHandlerSubscription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	bytearray
memoryviewlist	TypeErrorextend)r   r   s     Q/home/edenadmin/noVNC/venv/lib/python3.13/site-packages/redis/commands/helpers.pylist_or_argsr      sd    	T
 dUCJ?@@6D:D DK	  vs   3A A A,+A,.kwargsc                     U (       a  [        U S   U SS  5      O/ n0 nU H6  n[        U[        5      (       a  UR                  X4R                  '   M2  S X4'   M8     UR                  U5        U$ )Nr      )r   r   r   handlernameupdate)r   r   parsed_argssubscriptionsargs        r   parse_pubsub_subscriptionsr&   #   sh     6:,tAwQR1rK:<Mc<((&)kkM((#!%M	 
      r$   c                 t    U R                  5        VVs/ s H  u  pUc  UO
[        X5      PM     snn$ s  snnf r   )itemsr   )r$   channelr    s      r   pubsub_subscription_argsr+   1   sC    
 !. 3 3 5 5G ?W(FF 5  s   4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   	nativestrr3   :   s/    (21e(<(<)$!AF{Hr'   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.)r3   )r1   objs     r   delistr6   B   s(    y&'(asIcNa(((s   "c                 v   / n1 SknU c  U$ U  H  nUc  UR                  S5        M  [        U[        5      (       a  UR                  U5        MA   [        U5      n[        U[
        5      (       a'  UR                  5       U;   a  UR                  U5        M   UR                  [        U5      5        M     U$ ! [         a    UR                  S5         M  f = f! [        [        [        4 aI     UR                  [        U5      5         M  ! [        [        4 a    UR                  U5          GM%  f = ff = f)z,Optimistically parse the response to a list.>   naninfinity	-infinityN)
appendr   floatr3   r   r   lowerint
ValueErrorOverflowError)responseresspecial_valuesitemitem_strs        r   parse_to_listrF   I   s   
C5N
<JJtdE""JJt	 H
 h$$)9^)KJJx )

3t9%# 0 J  	JJt	 y9 ))JJuT{+"I. )JJx(())s<   B8C8CCD80D!D4.D83D44D8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.0r1   s     r   	<genexpr> random_string.<locals>.<genexpr>q   s%      7D!f,,--}s   13)joinrange)lengths    r   random_stringrU   m   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   r0   pop)r5   newobjks      r   decode_dict_keysr[   v   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_versionrj      s    &%++&&*VU]]=P=P*Q*Q%%77;;JGG	FEMM>>	?	?##5599*EE 
@r'   c                 ~   [        U [        R                  5      (       d)  [        U [        R                  R                  5      (       a&  U R                  R
                  R                  SS5      $ [        U [        R                  R                  5      (       a&  U R                  R
                  R                  SS5      $ g)a+  Return the user-supplied ``legacy_responses`` flag for ``client``.

Defaults to ``True`` when the flag is not present in the client's
``connection_kwargs``. Mirrors :func:`get_protocol_version` so module
command bases can read both the protocol and the response-shape
selection from the same place.
legacy_responsesTr^   rh   s    r   get_legacy_responsesrm      s     &%++&&*VU]]=P=P*Q*Q%%77;;<NPTUU	FEMM>>	?	?##5599:LdSSr'   )resp2_unifiedresp3_unifiedresp3_to_resp2_legacyuser_protocolrl   commonresp2resp3rn   ro   rp   c                0   [        U5      nU(       aL  U c  UR                  U=(       d    0 5        U$ U S;   a  UR                  U5        U$ UR                  U5         U$ U b  U S;   a  UR                  Ub  UOU5        U$ UR                  Ub  UOU5        U$ )a  Return the merged module-callback dict for the given (protocol,
legacy_responses) combination.

Mirrors the selection used by
:func:`redis._parsers.response_callbacks.get_response_callbacks` for
the core callbacks: ``common`` is overlaid with the protocol-specific
dict matching ``user_protocol`` and ``legacy_responses``.
``resp2_unified`` defaults to ``resp2``, ``resp3_unified`` to ``resp3``,
and ``resp3_to_resp2_legacy`` to an empty dict.
)   3)dictr"   )	rq   rl   rr   rs   rt   rn   ro   rp   	callbackss	            r   apply_module_callbacksrz      s    * 04F|I 28b9  h&U#  U# 	  MX$=m.G]US  m.G]USr'   iterablec                 0    S U  5       n[        U5      S:*  $ )a  
Checks that at most one of the values in the iterable is truthy.

Args:
    iterable: An iterable of values to check.

Returns:
    True if at most one value is truthy, False otherwise.

Raises:
    Might raise an error if the values in iterable are not boolean-compatible.
    For example if the type of the values implement
    __len__ or __bool__ methods and they raise an error.
c              3   8   #    U  H  n[        U5      v   M     g 7fr   )boolrN   s     r   rP   (at_most_one_value_set.<locals>.<genexpr>   s     (x!d1ggxs   r   )sum)r{   valuess     r   at_most_one_value_setr      s     )x(Fv;!r'   )
   )"rW   rJ   rL   typingr   r   r   r   r   r   r	   r_   redis.typingr
   r   r   r   tupler   rx   r&   r   r+   r3   r6   rF   rU   r[   rj   rm   r>   r~   rz   r    r'   r   <module>r      s         > >s (3-$"6 49 "
S/#*3+=#>	(MD(
()8]T%99:	(\
!")!HF, >B=AEI"C="" hsCx(()	"
 Xc3h''(" Xc3h''(" DhsCx&8!89:" DhsCx&8!89:" $DhsCx.@)@$AB" 
#xS!
!""JHSM r'   