HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/amqp/__pycache__/serialization.cpython-39.pyc
a

X>h
C�@s�dZddlZddlmZddlmZddlmZddlmZm	Z	ddl
mZdd	lm
Z
dd
lmZddlmZdZd
ZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze
jeiZGdd �d �ZdS)!zeConvert between bytestreams and higher-level AMQP types.

2007-11-05 Barry Pederson <[email protected]>

�N)�datetime)�Decimal)�BytesIO)�pack�unpack_from�)�FrameSyntaxError)�Basic)�bytes_to_str)�str_to_bytesz*    Table type {0!r} not handled by amqp.
zCTable type {0!r} for key {1!r} not handled by amqp. [value: {2!r}]
z9    Table type {0!r} not handled by amqp. [value: {1!r}]
cCs�t||�}|d7}|dkrztd||�\}|d7}zt||||��}Wn"tyl||||�}Yn0||7}�n||dkr�td||�\}|d7}t||||��}||7}�n>|dkr�td||�\}|d7}||||�}||7}�n|dk�rtd||�\}|d7}�n�|d	k�r:td
||�\}|d7}�n�|dk�r^td||�\}|d
7}�n�|dk�r�td||�\}|d
7}�nt|dk�r�td||�\}|d7}�nP|dk�r�td||�\}|d7}�n,|dk�r�td||�\}|d7}�n|dk�rtd||�\}|d7}�n�|dk�r6td||�\}|d7}�n�|dk�rZtd||�\}|d7}�n�|dk�r�td||�\}|d7}td||�\}|d7}t|�td|�}�nN|dk�r(td||�\}|d7}||}	i}||	k�r�td||�\}
|d7}t||||
��}||
7}t||�\||<}�q�n�|dk�r|td||�\}|d7}||}	g}||	k�r�t||�\}
}|�|
��qTnz|d k�r�td||�\}t|�}|d7}nP|d!k�r�td||�\}|d7}t�	|�}n$|d"k�r�d}nt
d#�|t|����||fS)$Nr�S�>I��s�>B�x�b�Bz>b�Uz>h��u�>H�Iz>i�i�Lz>q��l�>Q�f�>f�dz>d�D�
�F�A�t�T�Vz#Unknown value in table: {!r} ({!r}))
�chrr�pstr_t�UnicodeDecodeErrorr�
_read_item�append�boolr�utcfromtimestampr�format�type)�buf�offsetZftype�slen�val�blenr �n�tlen�limit�keylen�key�alen�v�r=�</usr/local/lib/python3.9/site-packages/amqp/serialization.pyr+ s�


















��r+cCsRd}}g}|j}t|�}|D�](}|dkrp|sPt|||d��}|d7}d}|d@dk}|dL}|d8}�n�|dkr�d}}td||�\}|d7}�n�|dkr�d}}td||�\}|d	7}�n||d
kr�d}}td||�\}|d7}�nR|d
k�rd}}td||�\}|d7}�n&|dk�rFd}}td||�\}|d7}�n�|dk�r�d}}td||�\}	|d7}||||	��dd�}||	7}�n�|dk�r�d}}td||�\}	|d7}||||	��dd�}||	7}�nb|dk�rtd||�\}
|d7}||||
�}||
7}�n&|dk�r�d}}td||�\}|d7}||}i}||k�r@td||�\}
|d7}t||||
��}||
7}t||�\||<}�qNn�|dk�r�d}}td||�\}|d7}||}g}||k�r@t||�\}}|�|��q�nB|dk�r2d}}td||�\}|d7}t�|�}ntt	�
|���||�q||fS)z�Deserialize amqp format.

    bit = b
    octet = o
    short = B
    long = l
    long long = L
    float = f
    shortstr = s
    longstr = S
    table = F
    array = A
    timestamp = T
    rrrr�orrrrrr
rrrrrr�utf-8�
surrogatepassrrr#r$r&)r,r)�ordr�decoder+rr.r�ILLEGAL_TABLE_TYPEr/)r/r1r2�bitcount�bits�valuesr,�pr4r3r5r7r8r9r:r;Zavalr=r=r>�loads�s�











rIcCs0|r,|tdt|�g|�R��g|dd�<dS)Nrr)r�len)rF�writer=r=r>�
_flushbits�srLc
	Csjd}g}t�}|j}t|�}t|�D�]0\}}||}|dkr�|rFdnd}|d}	|	dkrd|�d�|d||	>O<|d7}q$|dkr�t||�}|td|��q$|dkr�t||�}|tdt|���q$|d	kr�t||�}|td
|��q$|dk�rt||�}|td|��q$|d
k�r4t||�}|td|��q$|dk�r�|�pFd}t||�}t|t	��rj|�
dd�}|tdt|���||�q$|dk�s�|dk�r�|�p�d}t||�}t|t	��r�|�
dd�}|td
t|���||�q$|dk�r
t||�}t|�pi||�q$|dk�r2t||�}t
|�p(g||�q$|dkr$|tdtt�|������q$t||�|��S)z�Serialize AMQP arguments.

    Notes:
        bit = b
        octet = o
        short = B
        long = l
        long long = L
        shortstr = s
        longstr = S
        byte array = x
        table = F
        array = A
    rrrr���r?rrrr
rrrrr�r@rArrr#r$r&)rrKr)�	enumerater,rLr�int�
isinstance�str�encoderJ�_write_table�_write_array�calendar�timegm�utctimetuple�getvalue)
r/rGrErF�outrKrr4rH�shiftr=r=r>�dumps�sj




















r\c
Cs�t�}|j}|��D]r\}}t|t�r2|�dd�}|tdt|���||�zt|||�Wqt	y�t
t�t
|�||���Yq0q|��}|tdt|���||�dS)Nr@rArr
)rrK�itemsrQrRrSrrJ�_write_item�
ValueErrorr�ILLEGAL_TABLE_TYPE_WITH_KEYr/r0rY)r rKrFrZZtwrite�kr<Z
table_datar=r=r>rTEs 
�rTc	Cstt�}|j}|D]<}zt|||�WqtyJtt�t|�|���Yq0q|��}|t	dt
|���||�dS)Nr
)rrKr^r_r�ILLEGAL_TABLE_TYPE_WITH_VALUEr/r0rYrrJ)�list_rKrFrZZawriter<Z
array_datar=r=r>rUWs�rUc	Cs�t|ttf�rDt|t�r$|�dd�}|tddt|���||��nbt|t�rf|tddt|����n@t|t�r�|tdd|���n"t|t�r�|d	ks�|d
kr�|tdd|��n|td
d|��n�t|t	��r|�
�\}}}d}|D]}|d|}q�|�r|}|tdd||��n�t|t��rD|tddtt�
|������nbt|t��rf|d�t|||�n@t|ttf��r�|d�t|||�n|du�r�|d�nt��dS)Nr@rAz>cI�Sz>cB�tz>cd�di���i�z>cq�Lz>ci�Irr"z>cBi�Dz>cQ�T�F�A�V)rQrR�bytesrSrrJr-rP�floatr�as_tuplerrVrWrX�dictrT�list�tuplerUr_)r<rKrF�sign�digits�exponentr r=r=r>r^esD



�

r^cCs(i}td||�\}|d7}|d@rXtd||�\}|d7}t||||��|d<||7}|d@r�td||�\}|d7}t||||��|d<||7}|d	@r�td
||�\}}|\|d<|d@r�td||�\|d
<|d7}|d@r�td||�\|d<|d7}|d@�r<td||�\}|d7}t||||��|d<||7}|d@�r|td||�\}|d7}t||||��|d<||7}|d@�r�td||�\}|d7}t||||��|d<||7}|d@�r�td||�\}|d7}t||||��|d<||7}|d@�r td||�\|d<|d7}|d@�r`td||�\}|d7}t||||��|d<||7}|d@�r�td||�\}|d7}t||||��|d<||7}|d@�r�td||�\}|d7}t||||��|d <||7}|d!@�r td||�\}|d7}t||||��|d"<||7}||fS)#zDecode basic properties.rri�rr�content_typei@�content_encodingi r#Zapplication_headersiZ
delivery_modei�priorityiZcorrelation_idiZreply_to�Z
expiration�Z
message_id�@r�	timestampr� r0�Zuser_idZapp_idrZ
cluster_id)rr)rI)r1r2�
properties�flagsr3Z_fr=r=r>�decode_properties_basic�s�









r�c@sReZdZdZdZdgZddd�ZdZdd�Zd	d
�Z	dd�Z
ddd�Zdd�ZdS)�GenericContentzdAbstract base class for AMQP content.

    Subclasses should override the PROPERTIES attribute.
    N)�dummyrcKs.||_||_||_g|_d|_d|_d|_dS)NrF)�frame_method�
frame_argsr��_pending_chunks�
body_received�	body_size�ready)�selfr�r��propsr=r=r>�__init__�szGenericContent.__init__)	r�r�r�r�r�r�r��__dict__�__weakref__cCs0|dkrtd��||jvr$|j|St|��dS)N�__setstate__)�AttributeErrorr�)r��namer=r=r>�__getattr__�s


zGenericContent.__getattr__cCst|||�\}}||_|S)z�Load AMQP properties.

        Given the raw bytes containing the property-flags and property-list
        from a content-frame-header, parse and insert into a dictionary
        stored in this object as an attribute named 'properties'.
        )�PROPERTY_CLASSESr�)r��class_idr1r2r�r=r=r>�_load_propertiesszGenericContent._load_propertiescCs�d}d}g}gg}}|j}|jD]j\}}|�|d�}	|	dur�|dkrX|�|�d}d}|d|>O}|dkr�|�t|��|�|	�|d8}q"|�|�t�}
|
j}|D]}|td|��q�|td�	|�|��|
�
�S)z�Serialize AMQP properties.

        Serialize the 'properties' attribute (a dictionary) into
        the raw bytes making up a set of property flags and a
        property list, suitable for putting into a content frame header.
        �rNr�bitr�)r��
PROPERTIES�getr,rrrKrr\�joinrY)r�r[�	flag_bitsr�ZsformatZsvaluesr�r:Zproptyper4�resultrKr=r=r>�_serialize_propertiess0




z$GenericContent._serialize_propertiesrcCs8td||�\}|_|d7}|�|||�|js4d|_|S)Nz>HxxQ�T)rr�r�r�)r�r1r2r�r=r=r>�inbound_header2szGenericContent.inbound_headercCsj|j}|jt|�7_|j|jkr\|rN|�|�t��|�|_g|dd�<n||_d|_n
|�|�dS)NT)	r�r�rJr�r,rnr��bodyr�)r�r1�chunksr=r=r>�inbound_body:s
zGenericContent.inbound_body)NN)r)
�__name__�
__module__�__qualname__�__doc__�CLASS_IDr�r��	__slots__r�r�r�r�r�r=r=r=r>r��s


#
r�) r�rVr�decimalr�ior�structrr�
exceptionsr�specr	�utilsr
r)rrDr`rbr+rIrLr\rTrUr^r�r�r�r�r=r=r=r>�<module>s.rcI&I�