
    ޝi                     8    d dl Z d dlZddlmZ d Zd Zd Zd Zy)    N   )	nativestrc                       fd}|S )zUReplace serialized JSON values with objects in a
    bulk array response (list).
    c                 J    t        |       D ]  \  }}|	 |      | |<    | S )N)	enumerate)bindexitemds      Z/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/redis/commands/json/decoders.py_fzbulk_of_jsons.<locals>._f   s4    $Q< 	#KE4T7%	#      )r   r   s   ` r   bulk_of_jsonsr      s    
 Ir   c                     t        j                   |       }| j                         D ];  }t        |t              s||   ||j	                  d      <   |j                  |       = |S )z3Decode the keys of the given dictionary with utf-8.zutf-8)copykeys
isinstancebytesdecodepop)objnewobjks      r   decode_dict_keysr      sW    YYs^FXXZ a(.q	F188G$%JJqM Mr   c                     d}t        j                  ||       }|g k7  rt        |d         S d}t        j                  ||       }|g k7  rt        |d         S | S )z
    Attempt to parse string to native integer formats.
    One can't simply call int/float in a try/catch because there is a
    semantic difference between (for example) 15.0 and 15.
    z	^\d+.\d+$r   z^\d+$)refindallfloatint)r   floatregmatchintregs       r   unstringr$      s]     HJJx%E{U1XFJJvs#E{58}Jr   c                     t        | t              r| D cg c]  }t        |       c}S t        | t              rt	        t        |             S t        | t
              rt	        |       S | S c c}w )zf
    Given a non-deserializable object, make a best effort to
    return a useful set of results.
    )r   listr   r   r$   str)r   r   s     r   decode_listr(   1   sZ    
 !T*+,3	#,,	Au		!%%	As	{H -s   A+)r   r   helpersr   r   r   r$   r(   r   r   r   <module>r*      s"     	 $r   