� J�g���ddlZddlZddlZddlmZmZddlZddlmZm Z dedee dfdee fd�Z d �Z d �Z d �Z d �Zd �Zdd�Zd�Zd�Zd�Zd�ZdS)�N)�List�Tuple)�KeysT�KeyT�keys�args.�returnc��� t|��t|ttf��r|g}nt |��}n#t $r|g}YnwxYw|r|�|��|S�N)�iter� isinstance�bytes�str�list� TypeError�extend)rrs �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/redis/commands/helpers.py� list_or_argsr s��� � �T� � � � �d�U�C�L� )� )� ��6�D�D���:�:�D��� �����v�������� �� � � �D���� �Ks�>A� A�Ac�p�t|t��r|�dd��n|}|dkrdS|S)zAReturn the decoded binary string, or a string, depending on type.�utf-8�replace�nullN)r r�decode)�x�rs r� nativestrrs<��(2�1�e�(<�(<�C�����)�$�$�$�!�A��F�{�{��� �H�c�"�|�|Sd�|D��S)z9Given a list of binaries, return the stringified version.Nc�,�g|]}t|����S�)r)�.0�objs r� <listcomp>zdelist.<locals>.<listcomp>'s�� (� (� (�s�I�c�N�N� (� (� (rr )rs r�delistr$#s ���y��� (� (�a� (� (� (�(rc�n�g}|�|S|D]�} |�t|�����&#t$rY |�t|����n2#t$r%|�t |����YnwxYwY��t $r|�d��Y��wxYw|S)z,Optimistically parse the response to a list.N)�append�int� ValueError�floatrr)�response�res�items r� parse_to_listr-*s��� �C���� �� � �� � �J�J�s�4�y�y� !� !� !� !��� ,� ,� ,� ,�� � �5��;�;�'�'�'�'��� ,� ,� ,�� � �9�T�?�?�+�+�+�+�+� ,������� � � � �J�J�t� � � � � � ���� �Js8�"/� B2�"A�B2�,B � B2� B � B2�B2�1B2c��i}tdt|��d��D�]6}t||t��r�|d�t ||���� t||dzt��r1|d�t ||dz������#t $rY��wxYwt||dzt��rt ||dz��g|d<�� t||dz��|||<�� #ttf$r||dz|||<Y��4wxYw|S)Nr�zChild iterators�) �range�lenr rr&�parse_list_to_dict� IndexErrorr)rr()r*r+�is rr3r3>st�� �C� �1�c�(�m�m�Q� '� '�3�3�� �h�q�k�4� (� (� 3� �!� "� )� )�*<�X�a�[�*I�*I� J� J� J� ��h�q�1�u�o�t�4�4�W��)�*�1�1�2D�X�a�RS�e�_�2U�2U�V�V�V���� � � ��� ���� ���Q���� .� .� 3�&8��!�a�%��&I�&I�%J�C�!� "� "� 3�#(��!�a�%��#9�#9��H�Q�K� � ���z�*� 3� 3� 3�#+�A��E�?��H�Q�K� � � � 3���� �Js%�.AB>�> C � C � !D-�-%E�Ec��|�iSi}|D]�}t|t��r|s�t|��dkr d||d<�9t|dt��rt|d��||d<�s t |d��||d<n(#t t f$r|d||d<YnwxYw��#t$rY��wxYw|S)Nr0Tr)r rr2r3r)rr(r4)r*r+�dets r� parse_to_dictr8Rs ����� � �C������#�t�$�$� �C� � � �s�8�8�q�=�=��C��A��K�K� ��A��� %� %� �,�S��V�4�4�C��A��K�K� �)�"'��A��-�-�C��A��K�K��!�:�.�)�)�)�"%�a�&�C��A��K�K�K�)������� � � ��� ���� �Js0�>B�C�"C�?C�C�C� C�C� c�Z�d�d�t|��D����S)z3 Returns a random N character long string. �c3�RK�|]"}tjtj��V��#dSr )�random�choice�string�ascii_lowercase)r!rs r� <genexpr>z random_string.<locals>.<genexpr>ms@������23�� �f�,�-�-������r)�joinr1)�lengths r� random_stringrDis<�� �7�7���7<�V�}�}���� � �rc��t|t��r|���}nt|t��s|St |��dkrdS|�dd��}|�dd��}d|�d�S)zq RedisGraph strings must be quoted, quote_string wraps given v with quotes incase v is a string. rz""�\z\\�"z\")r rrrr2r)�vs r� quote_stringrIrs����!�U���� �H�H�J�J��� ��3� � ���� �1�v�v��{�{��t� � � �$����A� � � �#�u���A� �q�8�8�8�Orc���tj|��}|���D]J}t|t��r3||||�d��<|�|���K|S)z3Decode the keys of the given dictionary with utf-8.r)�copyrr rr�pop)r"�newobj�ks r�decode_dict_keysrO�sg�� �Y�s�^�^�F� �X�X�Z�Z���� �a�� � � �(.�q� �F�1�8�8�G�$�$� %� �J�J�q�M�M�M�� �Mrc��t|t��rt|��S|�dSt|ttf��r,dd�t t|�����d�St|t��r5dd�d�|� ��D�����d�St|��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 _not_ quoted. :param value: The parameter value to be turned into a string. :return: string Nr�[�,�]�{c3�DK�|]\}}|�dt|����V��dS)�:N)�stringify_param_value)r!rNrHs rrAz(stringify_param_value.<locals>.<genexpr>�s=����Y�Y�4�1�a��>�>�$9�!�$<�$<�>�>�Y�Y�Y�Y�Y�Yr�}) r rrIr�tuplerB�maprW�dict�items)�values rrWrW�s����%���� ��E�"�"�"� ���v� �E�D�%�=� )� )��A�3�8�8�C� 5�u�=�=�>�>�A�A�A�A� �E�4� � ��]�C�H�H�Y�Y�5�;�;�=�=�Y�Y�Y�Y�Y�]�]�]�]��5�z�z�rc�2�t|tj��st|tjj��r|jj�d��St|tjj��r|j j�d��SdS)N�protocol) r �redis�Redis�asyncio�connection_pool�connection_kwargs�get�cluster�AbstractRedisCluster� nodes_manager)�clients r�get_protocol_versionrj�s����&�%�+�&�&�F�*�V�U�]�=P�*Q�*Q�F��%�7�;�;�J�G�G�G� �F�E�M�>� ?� ?�F��#�5�9�9�*�E�E�E�F�Fr)r9)rKr=r?�typingrrr`� redis.typingrrrrr$r-r3r8rDrIrOrWrjr rr�<module>rms9�� � � � � � � � � � � � ��������� � � � �$�$�$�$�$�$�$�$��u��E�$��)�$4���d������" � � �)�)�)����(���(���.�������(������6F�F�F�F�Fr
Memory