
    mBNj                         d  Z d Zy)c                     t        | t              r| j                         } nt        | t              s| S t	        |       dk(  ry| j                  dd      } | j                  dd      } d|  dS )zo
    FalkorDB strings must be quoted,
    quote_string wraps given v with quotes incase
    v is a string.
        z""\z\\"z\")
isinstancebytesdecodestrlenreplace)vs    a/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/falkordb/helpers.pyquote_stringr      sc     !UHHJ3
1v{			$A			#uAqc8O    c           	      $   t        | t              rt        |       S | yt        | t        t        f      r#ddj                  t        t        |              dS t        | t              rg }| j                         D ]s  \  }}t        |t              r|j                         n
t        |      }|dk(  rt        d      d|v rt        d|d	      |j                  d| d
t        |              u ddj                  |      z   dz   S t        |       S )a  
    turn a parameter value into a string suitable for the params header of
    a Cypher command
    you may pass any value that would be accepted by `json.dumps()`

    ways in which output differs from that of `str()`:
    * strings are quoted
    * None --> "null"
    * in dictionaries, keys are wrapped in backticks so that non-bare-
      identifier keys (e.g. ``@type``, hyphenated UUIDs) are accepted by
      the Cypher parser. Empty keys and keys containing a literal
      backtick raise ``ValueError`` because FalkorDB's CYPHER header
      parser does not support escaped backticks inside identifiers.

    :param value: the parameter value to be turned into a string
    :return: string
    null[,] zCypher map key cannot be empty`z*Cypher map key cannot contain a backtick: z= (FalkorDB does not support escaped backticks in identifiers)z`:{})r   r	   r   listtuplejoinmapstringify_param_valuedictitemsr   r   
ValueErrorappend)valuepartskr   key_strs        r   r   r      s   & %E""}%$'388C 5u=>?qAA%KKMDAq$.q%$8ahhjc!fG"} !ABBg~ @k "00 
 LL1WIR(=a(@'ABC " SXXe_$s**u:r   N)r   r    r   r   <module>r'      s   (+r   