HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/extras-3.10/redis/_parsers/__pycache__/base.cpython-310.pyc
o

��e8�@s,ddlZddlmZddlmZmZmZddlmZm	Z	m
Z
ejjdkr1ejj
dkr1ddlmZnddlmZdd	lmZmZmZmZmZmZmZmZmZmZmZmZdd
lmZddlmZdd
l m!Z!m"Z"dZ#dZ$dZ%dZ&eed�Z'Gdd�de�Z(Gdd�de(�Z)Gdd�de(�Z*Gdd�de*�Z+dS)�N)�ABC)�IncompleteReadError�StreamReader�TimeoutError)�List�Optional�Union��)�timeout�)�AuthenticationError�$AuthenticationWrongNumberOfArgsError�BusyLoadingError�ConnectionError�ExecAbortError�ModuleError�NoPermissionError�
NoScriptError�OutOfMemoryError�
ReadOnlyError�
RedisError�
ResponseError)�
EncodableT�)�Encoder)�SERVER_CLOSED_CONNECTION_ERROR�SocketBufferz:Error loading the extension. Please check the server logs.z5Error unloading module: no such module with that namez/Error unloading module: operation not possible.z[Error unloading module: the module exports one or more module-side data types, can't unload)zxAUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?z(Client sent AUTH, but no password is setc@sdeZdZdedededeeeeee	ee
eie�eee
eeeeed�	Zedd��Zdd	�Zd
d�ZdS)
�
BaseParserzmax number of clients reachedzinvalid passwordz,wrong number of arguments for 'auth' commandz,wrong number of arguments for 'AUTH' command)	�ERRZOOMZ	WRONGPASSZ	EXECABORTZLOADINGZNOSCRIPTZREADONLYZNOAUTHZNOPERMcCs\|�d�d}||jvr*|t|�dd�}|j|}t|t�r&|�|t�}||�St|�S)zParse an error response� rrN)�split�EXCEPTION_CLASSES�len�
isinstance�dict�getr)�cls�response�
error_codeZexception_class�r*�6/opt/saltstack/salt/extras-3.10/redis/_parsers/base.py�parse_errorMs


zBaseParser.parse_errorcC�t���N��NotImplementedError��selfr*r*r+�
on_disconnectY�zBaseParser.on_disconnectcCr-r.r/�r2�
connectionr*r*r+�
on_connect\r4zBaseParser.on_connectN)�__name__�
__module__�__qualname__rr
r�MODULE_LOAD_ERRORr�MODULE_EXPORTS_DATA_TYPES_ERROR�NO_SUCH_MODULE_ERROR� MODULE_UNLOAD_NOT_POSSIBLE_ERROR�NO_AUTH_SET_ERRORrrrrrrr"�classmethodr,r3r7r*r*r*r+r0s6���
rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�	_RESPBasez&Base class for sync-based resp parsingcCs||_d|_d|_d|_dSr.)�socket_read_size�encoder�_sock�_buffer�r2rBr*r*r+�__init__cs
z_RESPBase.__init__cCs$z|��WdStyYdSwr.)r3�	Exceptionr1r*r*r+�__del__is
�z_RESPBase.__del__cCs(|j|_t|j|j|j�|_|j|_dS)zCalled when the socket connectsN)rDrrB�socket_timeoutrErCr5r*r*r+r7os
�z_RESPBase.on_connectcCs*d|_|jdur|j��d|_d|_dS)z"Called when the socket disconnectsN)rDrE�closerCr1r*r*r+r3ws



z_RESPBase.on_disconnectcCs|jo|j�|�Sr.)rE�can_read)r2rr*r*r+rLsz_RESPBase.can_readN)	r8r9r:�__doc__rGrIr7r3rLr*r*r*r+rA`srAc
@sVeZdZdZdZdefdd�Zdefdd�Z		dd
ede	e
edee
ffdd
�Z
dS)�AsyncBaseParserz5Base parsing class for the python-backed async parser��_streamZ
_read_sizerBcCsd|_||_dSr.rOrFr*r*r+rG�s
zAsyncBaseParser.__init__�returnc���t��r.r/r1r*r*r+�can_read_destructive�s�z$AsyncBaseParser.can_read_destructiveF�disable_decodingNc�rRr.r/)r2rTr*r*r+�
read_response�s�zAsyncBaseParser.read_response)F)r8r9r:rM�	__slots__�intrG�boolrSrrrrrUr*r*r*r+rN�s���rNcsveZdZdZejdZdef�fdd�Zdd�Zdd	�Z	d
d�Z
defd
d�Zdede
fdd�Zde
fdd�Z�ZS)�_AsyncRESPBasez!Base class for async resp parsing)rCrE�_pos�_chunksrBcs(t��|�d|_d|_g|_d|_dS)N�r)�superrGrCrEr[rZrF��	__class__r*r+rG�s

z_AsyncRESPBase.__init__cCsd|_|j��dS)Nr\)rEr[�clearr1r*r*r+�_clear�sz_AsyncRESPBase._clearcCs4|j|_|jdur
td��|j|_|��d|_dS)zCalled when the stream connectsN�Buffer is closed.T)�_readerrPrrCra�
_connectedr5r*r*r+r7�s

z_AsyncRESPBase.on_connectcCs
d|_dS)z"Called when the stream disconnectsFN)rdr1r*r*r+r3�s
z_AsyncRESPBase.on_disconnectrQc	�s��|jstd��|jr
dSz+td�4IdH�|j�d�IdHWd�IdHWS1IdHs1wYWdStyBYdSw)NrbTrrF)rdrrE�
async_timeoutrP�readrr1r*r*r+rS�s�4��z#_AsyncRESPBase.can_read_destructive�lengthc
�s��|d}|j|}t|j�|kr|j|j|d�}n7|j|jd�}z|j�|t|��IdH}WntyD}ztt�|�d}~ww||dd�}|j�	|�|j|7_|S)z�
        Read `length` bytes of data.  These are assumed to be followed
        by a '
' terminator which is subsequently discarded.
        rN���)
rZr#rErP�readexactlyrrrr[�append)r2rgZwant�end�result�tail�data�errorr*r*r+�_read�s �

��z_AsyncRESPBase._readc�s��|j�d|j�}|dkr|j|j|�}n'|j|jd�}|j��IdH}|�d�s/tt��||dd�}|j�	|�|jt
|�d7_|S)zq
        read an unknown number of bytes up to the next '
'
        line separator, which is discarded.
        s
rNrhr)rE�findrZrP�readline�endswithrrr[rjr#)r2�foundrlrmrnr*r*r+�	_readline�s�
z_AsyncRESPBase._readline)r8r9r:rMrNrVrWrGrar7r3rXrS�bytesrpru�
__classcell__r*r*r^r+rY�s
	rY),�sys�abcr�asynciorrr�typingrrr�version_info�major�minorrre�
exceptionsr
rrrrrrrrrrrr�encodersr�socketrrr;r=r>r<r?rrArNrYr*r*r*r+�<module>s.8�
�
0#