
    mBNjs                         d dl Z d dlmZ d dlmZmZ d dlmZmZm	Z	 d dl
mZ d dlmZmZ d dlmZ dd	lmZ dd
lmZ ddlmZ  G d dee      Z G d d      Zy)    N)Enum)JSONDecodeErrorloads)Any	Awaitableoverload)	DataError)AsyncClientProtocolSyncClientProtocol)deprecated_function   )JsonType)decode_dict_keys)Pathc                   2    e Zd ZdZdZdZdZdZedd       Z	y)	FPHATypezFloating-point type options for homogeneous array storage in JSON.SET.

    Used with the ``fpha`` parameter to force Redis to store all FP arrays
    using the specified floating-point type.
    BF16FP16FP32FP64c           
          t        ||       r|S 	  | |j                               S # t        $ r( t        d| ddj	                  d | D                     w xY w)ap  Convert a string or FPHAType instance to a validated FPHAType.

        Args:
            value: An ``FPHAType`` member or a case-insensitive string
                (e.g. ``"bf16"``, ``"FP32"``).

        Returns:
            The corresponding ``FPHAType`` enum member.

        Raises:
            DataError: If the string does not match any valid FPHA type.
        zInvalid FPHA type: z. Must be one of z, c              3   4   K   | ]  }|j                     y wN)value).0ts     m/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/redis/commands/json/commands.py	<genexpr>z&FPHAType.from_value.<locals>.<genexpr>0   s     +ASAGGSs   )
isinstanceupper
ValueErrorr	   join)clsr   s     r   
from_valuezFPHAType.from_value   sl     eS!L	u{{}%% 	%eW -""&))+AS+A"A!BD 	s	   & 1AN)r   zFPHAType | strreturnr   )
__name__
__module____qualname____doc__r   r   r   r   classmethodr$        r   r   r      s/     DDDD r,   r   c                   H   e Zd ZdZe ej                         fdedededz  de	de
ee
dz     z  dz  f
d       Ze ej                         fdedededz  de	dee
ee
dz     z  dz     f
d	       Z ej                         fdededz  de	de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fd
Ze	 	 dvdededede
de
dz  de
dz  de
ee
dz     z  dz  fd       Ze	 	 dvdededede
de
dz  de
dz  dee
ee
dz     z  dz     fd       Z	 	 dvdedede
de
dz  de
dz  de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fdZedededede
de	de
ee
dz     z  dz  fd       Zedededede
de	dee
ee
dz     z  dz     fd       Zdedede
de	de
ee
dz     z  dz  ee
ee
dz     z  dz     z  f
dZe ej                         fdedededz  de
ee
dz     z  dz  fd       Ze ej                         fdedededz  dee
ee
dz     z  dz     fd       Z ej                         fdededz  de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fdZe ej                         dfdedededz  de
dz  de	ez  ee   z  dz  f
d       Ze ej                         dfdedededz  de
dz  dee	ez  ee   z  dz     f
d       Z ej                         dfdededz  de
dz  de	ez  ee   z  dz  ee	ez  ee   z  dz     z  fdZedededede
de
de
ee
dz     z  dz  fd       Zedededede
de
dee
ee
dz     z  dz     fd       Zdedede
de
de
ee
dz     z  dz  ee
ee
dz     z  dz     z  f
dZe ej                         fdedededz  dedz  eedz     z  eee      z  fd       Ze ej                         fdedededz  deedz  eedz     z  eee      z     fd        Z ej                         fdededz  dedz  eedz     z  eee      z  eedz  eedz     z  eee      z     z  fd!Ze ej                         fdedededz  defd"       Ze ej                         fdedededz  dee   fd#       Z ej                         fdededz  deee   z  fd$Ze ej                         fdedededz  dee   eee   dz     z  dz  fd%       Ze ej                         fdedededz  deee   eee   dz     z  dz     fd&       Z ej                         fdededz  dee   eee   dz     z  dz  eee   eee   dz     z  dz     z  fd'Ze ej                         fdedededz  de
ee
dz     z  dz  fd(       Ze ej                         fdedededz  dee
ee
dz     z  dz     fd)       Z ej                         fdededz  de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fd*Zedededed+e
de
ez  ee
ez  dz     z  f
d,       Zedededed+e
dee
ez  ee
ez  dz     z     f
d-       Zdeded+e
de
ez  ee
ez  dz     z  ee
ez  ee
ez  dz     z     z  fd.Zedededed+e
de
ez  ee
ez  dz     z  f
d/       Zedededed+e
dee
ez  ee
ez  dz     z     f
d0       Z ed1d23      deded+e
de
ez  ee
ez  dz     z  ee
ez  ee
ez  dz     z     z  fd4       Ze ej                         fdedededz  de
fd5       Ze ej                         fdedededz  dee
   fd6       Z ej                         fdededz  de
ee
   z  fd7Ze ej                         fded8ededz  de
fd9       Ze ej                         fded8ededz  dee
   fd:       Z ej                         fd8ededz  de
ee
   z  fd;ZeZed<d=deded>e dz  de	dz  fd?       Z!ed<d=deded>e dz  dee	dz     fd@       Z!d<d=ded>e dz  de	dz  ee	dz     z  fdAZ!ededBee   dedee	dz     fdC       Z"ededBee   dedeee	dz        fdD       Z"dBee   dedee	dz     eee	dz        z  fdEZ"e	 	 	 	 dwdedededFe	dGe dz  dHe dz  dIe dz  dJe#ez  dz  de dz  fdK       Z$e	 	 	 	 dwdedededFe	dGe dz  dHe dz  dIe dz  dJe#ez  dz  dee dz     fdL       Z$	 	 	 	 dwdededFe	dGe dz  dHe dz  dIe dz  dJe#ez  dz  de dz  ee dz     z  fdMZ$ededNee%eee	f      de fdO       Z&ededNee%eee	f      dee    fdP       Z&dNee%eee	f      de ee    z  fdQZ&e	 dxdedededFe	dIe dz  de fdR       Z'e	 dxdedededFe	dIe dz  dee    fdS       Z'	 dxdededFe	dIe dz  de ee    z  f
dTZ'e	 	 	 	 dwdedededUedGe dz  dHe dz  dIe dz  dJe#ez  dz  de dz  fdV       Z(e	 	 	 	 dwdedededUedGe dz  dHe dz  dIe dz  dJe#ez  dz  dee dz     fdW       Z(	 	 	 	 dwdededUedGe dz  dHe dz  dIe dz  dJe#ez  dz  de dz  ee dz     z  fdXZ(e	 	 	 	 dwdedYedZedGe dz  dHe dz  dIe dz  dJe#ez  dz  de)ee f   fd[       Z*e	 	 	 	 dwdedYedZedGe dz  dHe dz  dIe dz  dJe#ez  dz  dee)ee f      fd\       Z*	 	 	 	 dwdYedZedGe dz  dHe dz  dIe dz  dJe#ez  dz  de)ee f   ee)ee f      z  fd]Z*e	 dydedededz  de
ee
dz     z  dz  fd^       Z+e	 dydedededz  dee
ee
dz     z  dz     fd_       Z+dydededz  de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fd`Z+e ej                         fdedededz  de ee
dz     z  dz  fda       Z,e ej                         fdedededz  dee ee
dz     z  dz     fdb       Z, ej                         fdededz  de ee
dz     z  dz  ee ee
dz     z  dz     z  fdcZ,e ej                         fdededdededz  de
ee
dz     z  dz  f
de       Z-e ej                         fdededdededz  dee
ee
dz     z  dz     f
df       Z- ej                         fdeddededz  de
ee
dz     z  dz  ee
ee
dz     z  dz     z  fdgZ-ed ej                         fdedhed8edz  dedz  de
ee   z  f
di       Z.ed ej                         fdedhed8edz  dedz  dee
ee   z     f
dj       Z.d ej                         fdhed8edz  dedz  de
ee   z  ee
ee   z     z  fdkZ.edede	dz  fdl       Z/ededee	dz     fdm       Z/ ed1dn3      de	dz  ee	dz     z  fdo       Z/ededee	dz     fdp       Z0ededeee	dz        fdq       Z0 ed1dn3      dee	dz     eee	dz        z  fdr       Z0edede dz  fds       Z1ededee dz     fdt       Z1 ed1dn3      de dz  ee dz     z  fdu       Z1y)zJSONCommandszjson commands.selfnamepathNargsr%   c                      y r   r+   r/   r0   r1   r2   s       r   	arrappendzJSONCommands.arrappend7        ),r,   c                      y r   r+   r4   s       r   r5   zJSONCommands.arrappend?        47r,   c                     |t        |      g}|D ]"  }|j                  | j                  |             $  | j                  dg| S )zAppend the objects ``args`` to the array under the
        ``path` in key ``name``.

        For more information see `JSON.ARRAPPEND <https://redis.io/commands/json.arrappend>`_..
        zJSON.ARRAPPENDstrappend_encodeexecute_command)r/   r0   r1   r2   piecesos         r   r5   zJSONCommands.arrappendG   sI     D	"AMM$,,q/* #t##$4>v>>r,   scalarstartstopc                      y r   r+   r/   r0   r1   rA   rB   rC   s         r   arrindexzJSONCommands.arrindexT   s     ),r,   c                      y r   r+   rE   s         r   rF   zJSONCommands.arrindex^   s     47r,   c                     |t        |      | j                  |      g}|$|j                  |       ||j                  |        | j                  dg|d|giS )a:  
        Return the index of ``scalar`` in the JSON array under ``path`` at key
        ``name``.

        The search can be limited using the optional inclusive ``start``
        and exclusive ``stop`` indices.

        For more information see `JSON.ARRINDEX <https://redis.io/commands/json.arrindex>`_.
        zJSON.ARRINDEXkeys)r;   r=   r<   r>   )r/   r0   r1   rA   rB   rC   r?   s          r   rF   zJSONCommands.arrindexh   s`    " D	4<<#78MM% d##t##OJfJD6JJr,   indexc                      y r   r+   r/   r0   r1   rJ   r2   s        r   	arrinsertzJSONCommands.arrinsert        ),r,   c                      y r   r+   rL   s        r   rM   zJSONCommands.arrinsert   s     47r,   c                     |t        |      |g}|D ]"  }|j                  | j                  |             $  | j                  dg| S )zInsert the objects ``args`` to the array at index ``index``
        under the ``path` in key ``name``.

        For more information see `JSON.ARRINSERT <https://redis.io/commands/json.arrinsert>`_.
        zJSON.ARRINSERTr:   )r/   r0   r1   rJ   r2   r?   r@   s          r   rM   zJSONCommands.arrinsert   sK     D	5)AMM$,,q/* #t##$4>v>>r,   c                      y r   r+   r/   r0   r1   s      r   arrlenzJSONCommands.arrlen   rN   r,   c                      y r   r+   rR   s      r   rS   zJSONCommands.arrlen        47r,   c                 @    | j                  d|t        |      |g      S )zReturn the length of the array JSON value under ``path``
        at key``name``.

        For more information see `JSON.ARRLEN <https://redis.io/commands/json.arrlen>`_.
        zJSON.ARRLENrI   r>   r;   rR   s      r   rS   zJSONCommands.arrlen   $     ##M4T$#PPr,   c                      y r   r+   r/   r0   r1   rJ   s       r   arrpopzJSONCommands.arrpop   s     -0r,   c                      y r   r+   r\   s       r   r]   zJSONCommands.arrpop   s     8;r,   c                 <    | j                  d|t        |      |      S )zPop the element at ``index`` in the array JSON value under
        ``path`` at key ``name``.

        For more information see `JSON.ARRPOP <https://redis.io/commands/json.arrpop>`_.
        zJSON.ARRPOPrX   r\   s       r   r]   zJSONCommands.arrpop   s     ##M4TEJJr,   c                      y r   r+   r/   r0   r1   rB   rC   s        r   arrtrimzJSONCommands.arrtrim   rN   r,   c                      y r   r+   ra   s        r   rb   zJSONCommands.arrtrim   rU   r,   c                 >    | j                  d|t        |      ||      S )zTrim the array JSON value under ``path`` at key ``name`` to the
        inclusive range given by ``start`` and ``stop``.

        For more information see `JSON.ARRTRIM <https://redis.io/commands/json.arrtrim>`_.
        zJSON.ARRTRIMrX   ra   s        r   rb   zJSONCommands.arrtrim   s!     ##ND#d)UDQQr,   c                      y r   r+   rR   s      r   typezJSONCommands.type   s     ;>r,   c                      y r   r+   rR   s      r   rf   zJSONCommands.type   s	     FIr,   c                 @    | j                  d|t        |      |g      S )zGet the type of the JSON value under ``path`` from key ``name``.

        For more information see `JSON.TYPE <https://redis.io/commands/json.type>`_.
        z	JSON.TYPErW   rX   rR   s      r   rf   zJSONCommands.type   $     ##Ks4yv#NNr,   c                      y r   r+   rR   s      r   respzJSONCommands.resp        r,   c                      y r   r+   rR   s      r   rk   zJSONCommands.resp        r,   c                 @    | j                  d|t        |      |g      S )zReturn the JSON value under ``path`` at key ``name``.

        For more information see `JSON.RESP <https://redis.io/commands/json.resp>`_.
        z	JSON.RESPrW   rX   rR   s      r   rk   zJSONCommands.resp   ri   r,   c                      y r   r+   rR   s      r   objkeyszJSONCommands.objkeys	       58r,   c                      y r   r+   rR   s      r   rq   zJSONCommands.objkeys  s	     @Cr,   c                 @    | j                  d|t        |      |g      S )zReturn the key names in the dictionary JSON value under ``path`` at
        key ``name``.

        For more information see `JSON.OBJKEYS <https://redis.io/commands/json.objkeys>`_.
        zJSON.OBJKEYSrW   rX   rR   s      r   rq   zJSONCommands.objkeys  s$     ##ND#d)4&#QQr,   c                      y r   r+   rR   s      r   objlenzJSONCommands.objlen  rN   r,   c                      y r   r+   rR   s      r   rv   zJSONCommands.objlen"  rU   r,   c                 @    | j                  d|t        |      |g      S )zReturn the length of the dictionary JSON value under ``path`` at key
        ``name``.

        For more information see `JSON.OBJLEN <https://redis.io/commands/json.objlen>`_.
        zJSON.OBJLENrW   rX   rR   s      r   rv   zJSONCommands.objlen'  rY   r,   numberc                      y r   r+   r/   r0   r1   ry   s       r   	numincrbyzJSONCommands.numincrby1       25r,   c                      y r   r+   r{   s       r   r|   zJSONCommands.numincrby6       =@r,   c                 b    t        |      }| j                  d||| j                  |      |      S )zIncrement the numeric (integer or floating point) JSON value under
        ``path`` at key ``name`` by the provided ``number``.

        For more information see `JSON.NUMINCRBY <https://redis.io/commands/json.numincrby>`_.
        zJSON.NUMINCRBY
_json_pathr;   r>   r=   r{   s       r   r|   zJSONCommands.numincrby;  s9     4y##dD$,,v*>4 $ 
 	
r,   c                      y r   r+   r{   s       r   	nummultbyzJSONCommands.nummultbyH  r}   r,   c                      y r   r+   r{   s       r   r   zJSONCommands.nummultbyM  r   r,   z4.0.0z deprecated since redisjson 1.0.0)versionreasonc                 b    t        |      }| j                  d||| j                  |      |      S )zMultiply the numeric (integer or floating point) JSON value under
        ``path`` at key ``name`` with the provided ``number``.

        For more information see `JSON.NUMMULTBY <https://redis.io/commands/json.nummultby>`_.
        zJSON.NUMMULTBYr   r   r{   s       r   r   zJSONCommands.nummultbyR  s9     4y##dD$,,v*>4 $ 
 	
r,   c                      y r   r+   rR   s      r   clearzJSONCommands.clear`  rl   r,   c                      y r   r+   rR   s      r   r   zJSONCommands.cleare  rn   r,   c                 :    | j                  d|t        |            S )a  Empty arrays and objects (to have zero slots/keys without deleting the
        array/object).

        Return the count of cleared paths (ignoring non-array and non-objects
        paths).

        For more information see `JSON.CLEAR <https://redis.io/commands/json.clear>`_.
        z
JSON.CLEARrX   rR   s      r   r   zJSONCommands.clearj  s     ##L$D	BBr,   keyc                      y r   r+   r/   r   r1   s      r   deletezJSONCommands.deletew  rl   r,   c                      y r   r+   r   s      r   r   zJSONCommands.delete|  rn   r,   c                 :    | j                  d|t        |            S )zDelete the JSON value stored at key ``key`` under ``path``.

        For more information see `JSON.DEL <https://redis.io/commands/json.del>`_.
        zJSON.DELrX   r   s      r   r   zJSONCommands.delete  s     ##JSY??r,   F)	no_escaper   c                     y r   r+   r/   r0   r   r2   s       r   getzJSONCommands.get       r,   c                     y r   r+   r   s       r   r   zJSONCommands.get       &)r,   c                "   |g}|r|j                  d       t        |      dk(  r$|j                  t        j                                n!|D ]  }|j                  t	        |              	  | j
                  dg|d|giS # t        $ r Y yw xY w)aD  
        Get the object stored as a JSON value at key ``name``.

        ``args`` is zero or more paths, and defaults to root path
        ```no_escape`` is a boolean flag to add no_escape option to get
        non-ascii characters

        For more information see `JSON.GET <https://redis.io/commands/json.get>`_.
        noescaper   zJSON.GETrI   N)r<   lenr   	root_pathr;   r>   	TypeError)r/   r0   r   r2   r?   ps         r   r   zJSONCommands.get  s     MM*%t9>MM$..*+ c!f% 
	'4''
IVI4&II 		s   +B 	BBrI   c                      y r   r+   r/   rI   r1   s      r   mgetzJSONCommands.mget       !$r,   c                      y r   r+   r   s      r   r   zJSONCommands.mget       ,/r,   c                 p    g }||z  }|j                  t        |              | j                  dg|d|iS )z
        Get the objects stored as a JSON values under ``path``. ``keys``
        is a list of one or more keys.

        For more information see `JSON.MGET <https://redis.io/commands/json.mget>`_.
        z	JSON.MGETrI   r<   r;   r>   )r/   rI   r1   r?   s       r   r   zJSONCommands.mget  s?     $c$i #t##KD&DtDDr,   objnxxxdecode_keysfphac                      y r   r+   r/   r0   r1   r   r   r   r   r   s           r   setzJSONCommands.set       r,   c                      y r   r+   r   s           r   r   zJSONCommands.set       "%r,   c                 L   |rt        |      }|t        |      | j                  |      g}|r|rt        d      |r|j	                  d       n|r|j	                  d       |0|j                  dt        j                  |      j                  g        | j                  dg| S )a  
        Set the JSON value at key ``name`` under the ``path`` to ``obj``.

        ``nx`` if set to True, set ``value`` only if it does not exist.
        ``xx`` if set to True, set ``value`` only if it exists.
        ``decode_keys`` If set to True, the keys of ``obj`` will be decoded
        with utf-8.
        ``fpha`` if set, forces Redis to use the specified floating-point type
        for storing all FP homogeneous arrays in ``obj``.
        Accepts a :class:`FPHAType` enum value or a string
        (``"BF16"``, ``"FP16"``, ``"FP32"``, ``"FP64"``).

        For the purpose of using this within a pipeline, this command is also
        aliased to JSON.SET.

        For more information see `JSON.SET <https://redis.io/commands/json.set>`_.
        zNnx and xx are mutually exclusive: use one, the other or neither - but not bothNXXXFPHAzJSON.SET)
r   r;   r=   	Exceptionr<   extendr   r$   r   r>   )	r/   r0   r1   r   r   r   r   r   r?   s	            r   r   zJSONCommands.set  s    6 "3'CD	4<<#45 "2  MM$MM$MM68#6#6t#<#B#BCD#t##J888r,   tripletsc                      y r   r+   r/   r   s     r   msetzJSONCommands.mset  s     r,   c                      y r   r+   r   s     r   r   zJSONCommands.mset  r   r,   c           	          g }|D ]7  }|j                  |d   t        |d         | j                  |d         g       9  | j                  dg| S )a  
        Set the JSON value at key ``name`` under the ``path`` to ``obj``
        for one or more keys.

        ``triplets`` is a list of one or more triplets of key, path, value.

        For the purpose of using this within a pipeline, this command is also
        aliased to JSON.MSET.

        For more information see `JSON.MSET <https://redis.io/commands/json.mset>`_.
        r   r      z	JSON.MSET)r   r;   r=   r>   )r/   r   r?   triplets       r   r   zJSONCommands.mset  sW     GMM71:s71:WQZ8PQR  #t##K9&99r,   c                      y r   r+   r/   r0   r1   r   r   s        r   mergezJSONCommands.merge0  s     r,   c                      y r   r+   r   s        r   r   zJSONCommands.merge9  s     r,   c                 |    |rt        |      }|t        |      | j                  |      g} | j                  dg| S )aa  
        Merges a given JSON value into matching paths. Consequently, JSON values
        at matching paths are updated, deleted, or expanded with new children

        ``decode_keys`` If set to True, the keys of ``obj`` will be decoded
        with utf-8.

        For more information see `JSON.MERGE <https://redis.io/commands/json.merge>`_.
        z
JSON.MERGE)r   r;   r=   r>   )r/   r0   r1   r   r   r?   s         r   r   zJSONCommands.mergeB  sB      "3'CD	4<<#45#t##L:6::r,   	file_namec                      y r   r+   r/   r0   r1   r   r   r   r   r   s           r   set_filezJSONCommands.set_fileY  r   r,   c                      y r   r+   r   s           r   r   zJSONCommands.set_filee  r   r,   c           	          t        |      5 }t        |j                               }	ddd       | j                  ||	||||      S # 1 sw Y   !xY w)ao  
        Set the JSON value at key ``name`` under the ``path`` to the content
        of the json file ``file_name``.

        ``nx`` if set to True, set ``value`` only if it does not exist.
        ``xx`` if set to True, set ``value`` only if it exists.
        ``decode_keys`` If set to True, the keys of ``obj`` will be decoded
        with utf-8.
        ``fpha`` if set, forces Redis to use the specified floating-point type
        for storing all FP homogeneous arrays in the file content.
        Accepts a :class:`FPHAType` enum value or a string
        (``"BF16"``, ``"FP16"``, ``"FP32"``, ``"FP64"``).

        Nr   r   r   r   )openr   readr   )
r/   r0   r1   r   r   r   r   r   fpfile_contents
             r   r   zJSONCommands.set_fileq  sR    2 )_ +L  xx$RV  
 	
 _s   AA	json_pathroot_folderc                      y r   r+   r/   r   r   r   r   r   r   s          r   set_pathzJSONCommands.set_path  s     r,   c                      y r   r+   r   s          r   r   zJSONCommands.set_path  s     &)r,   c                     i }t        j                  |      D ]_  \  }}	}
|
D ]T  }t         j                  j                  ||      }	 |j	                  d      d   }| j                  |||||||       d||<   V a |S # t        $ r d||<   Y kw xY w)a|  
        Iterate over ``root_folder`` and set each JSON file to a value
        under ``json_path`` with the file name as the key.

        ``nx`` if set to True, set ``value`` only if it does not exist.
        ``xx`` if set to True, set ``value`` only if it exists.
        ``decode_keys`` If set to True, the keys of ``obj`` will be decoded
        with utf-8.
        ``fpha`` if set, forces Redis to use the specified floating-point type
        for storing all FP homogeneous arrays in the file content.
        Accepts a :class:`FPHAType` enum value or a string
        (``"BF16"``, ``"FP16"``, ``"FP32"``, ``"FP64"``).

        .r   r   TF)oswalkr1   r"   rsplitr   r   )r/   r   r   r   r   r   r   set_files_resultrootdirsfilesfile	file_pathr   s                 r   r   zJSONCommands.set_path  s    . !#!5D$GGLLt4	8 !* 0 0 5a 8IMM!!!$/! "  37$Y/!  "6*   ' 827$Y/8s   1A<<BBc                      y r   r+   rR   s      r   strlenzJSONCommands.strlen  rN   r,   c                      y r   r+   rR   s      r   r   zJSONCommands.strlen  rU   r,   c                 n    |g}||j                  t        |              | j                  dg|d|giS )zReturn the length of the string JSON value under ``path`` at key
        ``name``.

        For more information see `JSON.STRLEN <https://redis.io/commands/json.strlen>`_.
        zJSON.STRLENrI   r   )r/   r0   r1   r?   s       r   r   zJSONCommands.strlen  s@     MM#d)$#t##MHFH$HHr,   c                      y r   r+   rR   s      r   togglezJSONCommands.toggle  s     *-r,   c                      y r   r+   rR   s      r   r   zJSONCommands.toggle  rr   r,   c                 :    | j                  d|t        |            S )zToggle boolean value under ``path`` at key ``name``.
        returning the new value.

        For more information see `JSON.TOGGLE <https://redis.io/commands/json.toggle>`_.
        zJSON.TOGGLErX   rR   s      r   r   zJSONCommands.toggle  s     ##M4TCCr,   r   c                      y r   r+   r/   r0   r   r1   s       r   	strappendzJSONCommands.strappend  r6   r,   c                      y r   r+   r   s       r   r   zJSONCommands.strappend	  r8   r,   c                 b    |t        |      | j                  |      g} | j                  dg| S )aC  Append to the string JSON value. If two options are specified after
        the key name, the path is determined to be the first. If a single
        option is passed, then the root_path (i.e Path.root_path()) is used.

        For more information see `JSON.STRAPPEND <https://redis.io/commands/json.strappend>`_.
        zJSON.STRAPPEND)r;   r=   r>   )r/   r0   r   r1   r?   s        r   r   zJSONCommands.strappend  s6     D	4<<#67#t##$4>v>>r,   
subcommandc                      y r   r+   r/   r   r   r1   s       r   debugzJSONCommands.debug  s     r,   c                      y r   r+   r   s       r   r   zJSONCommands.debug%  s     &)r,   c                     ddg}||vrt        dt        |            |g}|dk(  r8|t        d      |j                  |       |j                  t        |              | j                  dg| S )zReturn the memory usage in bytes of a value under ``path`` from
        key ``name``.

        For more information see `JSON.DEBUG <https://redis.io/commands/json.debug>`_.
        MEMORYHELPzThe only valid subcommands are zNo key specifiedz
JSON.DEBUG)r	   r;   r<   r>   )r/   r   r   r1   valid_subcommandsr?   s         r   r   zJSONCommands.debug-  s     &v...=sCT?UVV!{ 233MM#MM#d)$#t##L:6::r,   c                      y r   r+   r/   r2   kwargss      r   jsongetzJSONCommands.jsongetC  s    ORr,   c                      y r   r+   r   s      r   r   zJSONCommands.jsongetF  r   r,   z/redisjson-py supported this, call get directly.c                 &     | j                   |i |S r   )r   r   s      r   r   zJSONCommands.jsongetK  s     txx(((r,   c                      y r   r+   r   s      r   jsonmgetzJSONCommands.jsonmgetS  r   r,   c                      y r   r+   r   s      r   r   zJSONCommands.jsonmgetX  r   r,   c                 &     | j                   |i |S r   )r   r   s      r   r   zJSONCommands.jsonmget]  s     tyy$)&))r,   c                      y r   r+   r   s      r   jsonsetzJSONCommands.jsonsete  s    KNr,   c                      y r   r+   r   s      r   r  zJSONCommands.jsonseth  s     "%r,   c                 &     | j                   |i |S r   )r   r   s      r   r  zJSONCommands.jsonsetm  s     txx(((r,   )NN)FFFN)Fr   )2r&   r'   r(   r)   r   r   r   r   r;   r   intlistr5   r
   r   rF   rM   rS   r   r]   rb   rf   rk   rq   rv   floatr|   r   r   r   r   forgetboolr   r   r   r   tupler   r   r   dictr   r   r   r   r   r   r   r  r+   r,   r   r.   r.   4   s    *4>>+, ,, Dj, 	,
 
tC$J	$	&, ,  *4>>+7!77 Dj7 	7
 
3cDj))D0	17 7 -;DNN,<??"Tz?EM?
S4Z 
 4
'9S4d
;K5Kd5R+S	S?  !, ,, , 	,
 Tz, Dj, 
tC$J	$	&, ,  !7!77 7 	7
 Tz7 Dj7 
3cDj))D0	17 7 !KK K 	K
 TzK DjK S4Z 
 4
'9S4d
;K5Kd5R+S	SK2 , ,(+,36,?B,KS,	tC$J	$	&, , 7!77 7 	7
 7 
3cDj))D0	17 7?c ? ?S ? ?d3:%#S4Z((4/0O1 ? @N@P, ,(+,36:,	tC$J	$	&, , AOAQ7!7),747$J7	3cDj))D0	17 7 4B4>>3C Q3 QcDj Qd3:%#S4Z((4/0I1 Q  *4>>+	0 00 Dj0 Tz	0
 
C$s)	#d	*0 0  *4>>+	;!;; Dj; Tz	;
 
8c>DI-4	5; ; *4>>+	KK DjK Tz	K
 S.49
$t
+y3c"T)0 
K , ,(+,36,?B,JM,	tC$J	$	&, , 7!7),7477@C7KN7	3cDj))D0	17 7RC Rs R3 Rc Rd3:%#S4Z((4/0G1 R @N@P> >(+>36:>	td3:&	&d3i	8> > AOAQI!I),I47$JI	3:S4Z 004S	?B	CI I 2@1A O OC$J Od
T#*%%T#Y7#*tC$J//$tCy/ABGC O @N@P (+36:	  AOAQ!),47$J	3 
 -;DNN,<OO"TzO	y~	O @N@P8 8(+836:8	cT$s)d*+	+d	28 8 AOAQC!C),C47$JC	49tDI$455<	=C C 5CDNN4D RC RsTz RS	DcT)**T1$s)d49t#344t;<J= R @N@P, ,(+,36:,	tC$J	$	&, , AOAQ7!7),747$J7	3cDj))D0	17 7 4B4>>3C Q3 QcDj Qd3:%#S4Z((4/0I1 Q 5 5(+5365@C5	utC%K$./	/5 5 @!@),@47@AD@	3;cEkD&8!99	:@ @
c 
 
c 
ed3;-..#+S5[4%7 889?: 
 5 5(+5365@C5	utC%K$./	/5 5 @!@),@47@AD@	3;cEkD&8!99	:@ @ 1ST
c 
 
c 
ed3;-..#+S5[4%7 889?: 
 U
 @N@P (+36:	  AOAQ!),47$J	3 
 -;DNN,<CC"TzC	y~	C ?Mt~~?O '*25*	  @N@P!(+36:	3 
 ,:4>>+;@@!Dj@	y~	@ FMR (+?Cd{	D  NS)!)),)@Dt)	8d?	#) ) >C  td{ 4(T/"H# < $ $(,S	$9<$	ho	$ $ /!/)-c/:=/	44(	)/ /EIE%(E	ho	44+@!A	AE   #(&*	 		 	 		
 4K	 4K	 D[	 nt#	 
	 	   #(&*	%!	%	% 	% 		%
 4K	% 4K	% D[	% nt#	% 
4$;		% 	%   #(&*.9.9 .9 	.9
 4K.9 4K.9 D[.9 nt#.9 +4$;/	/.9`  ,0sC7I1J,K	  !-1%S(8J2K-L	4 :T%S((:";< :	RVAW :"  $)   	
 D[ 
   $)!  	
 D[ 
4  $);; ; 	;
 D[; 
	$	;.   #(&*	 		 	 		
 4K	 4K	 D[	 nt#	 
	 	   #(&*	%!	%	% 	% 		%
 4K	% 4K	% D[	% nt#	% 
4$;		% 	%   #(&*

 
 	

 4K
 4K
 D[
 nt#
 +4$;/	/
@ 
  #(&*   4K	
 4K D[ nt# 
c4i  
  #(&*)!)) ) 4K	)
 4K) D[) nt#) 
4T	?	#) )  #(&*- -  -  4K	- 
 4K-  D[-  nt#-  
c4i9T#t)_5	5- ^ @D, ,(+,36:,	tC$J	$	&, , AE7!7),747$J7	3cDj))D0	17 7I3 IcDj Id3:%#S4Z((4/0=1 I @N@P- -(+-36:-	S4Z 	 4	'- - AOAQ8!8),847$J8	4$sTz**T1	28 8 4B4>>3C D3 DcDj DtC$J$&$cDj))D01I2 D 
 *4>>+	, ,, , Dj	,
 
tC$J	$	&, , 
 *4>>+	7!77 7 Dj	7
 
3cDj))D0	17 7 CQ$..BR 
?c 
?# 
?S4Z 
?d3:%#S4Z((4/0X1 
?  )4>>+	  4Z Dj	
 
tCy   )4>>+	)!)) 4Z) Dj	)
 
3c?	#) ) )4>>+	;; 4Z; Dj	;
 S	/YsT#Y7	7;, R(RhoR R)!)	8d?	#) )  Q)8d?i4? + ))
 $ $	ho	$ $ /!/	44(	)/ /  Q*	ho	44+@!A	A**
 N(NdTkN N%!%	4$;	% %  Q)4$;)D4K:P*P ))r,   r.   )r   enumr   jsonr   r   typingr   r   r   redis.exceptionsr	   redis.typingr
   r   redis.utilsr   _utilr   decodersr   r1   r   r;   r   r.   r+   r,   r   <module>r     sA    	  ' + + & @ +  & "sD "J}) })r,   