HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/redis/commands/__pycache__/parser.cpython-311.pyc
�

$�;f���<�ddlmZmZddlmZGd�d��ZdS)�)�
RedisError�
ResponseError��str_if_bytesc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�CommandsParsera
    Parses Redis commands to get command keys.
    COMMAND output is used to determine key locations.
    Commands that do not have a predefined key location are flagged with
    'movablekeys', and these commands' keys are determined by the command
    'COMMAND GETKEYS'.
    c�L�d|_i|_|�|��dS)NF)�initialized�commands�
initialize)�self�redis_connections  �H/opt/alt/python311/lib/python3.11/site-packages/redis/commands/parser.py�__init__zCommandsParser.__init__s*�� �����
����(�)�)�)�)�)�c�:�|�d��|_dS)N�COMMAND)�execute_commandr)r
�rs  rrzCommandsParser.initializes���)�)�)�4�4��
�
�
rc�(��t���dkrdS�d���}||jvr�|���}|d}||jvr|t	�dd���z�nB|�|��||jvr$t
|����d����|j�|��}d|dvr|j	|g��R�}n�d|dvr|j
��}n�|d	dkr|d
dkr|ddkrdS|d}|dkrt���t|��z
}t	t|d
|dz|d	����}�fd�|D��}|S)
z6
        Get the keys from the passed command
        �Nr�z( command doesn't exist in Redis commands�movablekeys�flags�pubsub�
step_count�
first_key_pos�last_key_posc� ��g|]
}�|��S�r )�.0�pos�argss  �r�
<listcomp>z+CommandsParser.get_keys.<locals>.<listcomp>Fs���2�2�2�#�D��I�2�2�2r)
�len�lowerr�split�listrr�upper�get�_get_moveable_keys�_get_pubsub_keys�abs�range)	r
�
redis_connr#�cmd_name�cmd_name_split�command�keysr�keys_poss	  `      r�get_keyszCommandsParser.get_keyss�����t�9�9�q�=�=��4���7�=�=�?�?���4�=�(�(�&�^�^�-�-�N�%�a�(�H��4�=�(�(�%��T�!�"�"�X���6������
�+�+�+��4�=�0�0�$�#�>�>�+�+�U�U�U�����-�#�#�H�-�-���G�G�,�,�,�*�4�*�:�=��=�=�=�D�D�
���)�
)�
)�(�4�(�$�/�D�D���%��*�*��O�,��1�1��N�+�q�0�0��t�"�>�2�L��a���"�4�y�y�3�|�+<�+<�<����g�o�.��q�0@�'�,�BW�X�X���H�3�2�2�2��2�2�2�D��rc��g}|d}||���z}|t|dd���z}	|jdg|�R�}n6#t$r)}|���}d|vsd|vrYd}~dS|�d}~wwxYw|S)NrrzCOMMAND GETKEYSzInvalid argumentsz The command has no key arguments)r'r(rr�__str__)r
r/r#�piecesr0r3�e�messages        rr+z!CommandsParser._get_moveable_keysJs�������7���(�.�.�*�*�*���$�t�A�B�B�x�.�.�(��
	�-�:�-�.?�I�&�I�I�I�D�D���	�	�	��i�i�k�k�G�#�w�.�.�5��@�@��t�t�t�t�t�������	�����s�A�
A?�A:�8A:�:A?c�4�t|��dkrdSd�|D��}|d���}d}|dkr)|d���}|dvr
|dd�}n+|dvrt|dd���}n|d	kr	|dg}|S)
z�
        Get the keys from pubsub command.
        Although PubSub commands have predetermined key locations, they are not
        supported in the 'COMMAND's output, so the key positions are hardcoded
        in this method
        rNc�,�g|]}t|����Sr r)r!�args  rr$z3CommandsParser._get_pubsub_keys.<locals>.<listcomp>hs ��2�2�2�c��S�!�!�2�2�2rr�PUBSUBr)�CHANNELS�NUMSUB)�	SUBSCRIBE�
PSUBSCRIBE�UNSUBSCRIBE�PUNSUBSCRIBE�PUBLISH)r%r)r()r
r#r2r3�pubsub_types     rr,zCommandsParser._get_pubsub_keys^s����t�9�9�q�=�=��4�2�2�T�2�2�2���q�'�-�-�/�/�����h����q�'�-�-�/�/�K��4�4�4��A�B�B�x���
�R�
R�
R���Q�R�R��>�>�D�D�
�	�
!�
!���G�9�D��rN)	�__name__�
__module__�__qualname__�__doc__rrr5r+r,r rrrrsj��������*�*�*�
5�5�5�/�/�/�b���(����rrN)�redis.exceptionsrr�redis.utilsrrr rr�<module>rMsk��6�6�6�6�6�6�6�6�$�$�$�$�$�$�t�t�t�t�t�t�t�t�t�tr