AlkantarClanX12

Your IP : 3.138.175.166


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/xdrlib.cpython-38.opt-1.pyc

U

i�f�@sxdZddlZddlmZddlmZddddgZGd	d�de�ZGd
d�de�Z	dd�Z
Gd
d�d�ZGdd�d�ZdS)zRImplements (a subset of) Sun XDR -- eXternal Data Representation.

See: RFC 1014

�N)�BytesIO��wraps�Error�Packer�Unpacker�ConversionErrorc@s(eZdZdZdd�Zdd�Zdd�ZdS)	rz�Exception class for this module. Use:

    except xdrlib.Error as var:
        # var has the Error instance for the exception

    Public ivars:
        msg -- contains the message

    cCs
||_dS�N)�msg)�selfr
�r�+/opt/alt/python38/lib64/python3.8/xdrlib.py�__init__szError.__init__cCs
t|j�Sr	)�reprr
�rrrr
�__repr__szError.__repr__cCs
t|j�Sr	)�strr
rrrr
�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__�__doc__rrrrrrr
rs	c@seZdZdS)rN)rrrrrrr
r scst���fdd��}|S)z5 Wrap any raised struct.errors in a ConversionError. c
sFz�||�WStjk
r@}zt|jd�d�W5d}~XYnXdS�Nr)�struct�errorr�args)r�value�e��functionrr
�result&sz&raise_conversion_error.<locals>.resultr)rr rrr
�raise_conversion_error#sr!c@s�eZdZdZdd�Zdd�Zdd�ZeZedd	��Z	ed
d��Z
e
Zdd
�Zdd�Z
e
Zedd��Zedd��Zdd�ZeZdd�ZeZeZdd�Zdd�Zdd�ZdS)rz0Pack various data representations into a buffer.cCs|��dSr	��resetrrrr
r2szPacker.__init__cCst�|_dSr	)r�_Packer__bufrrrr
r#5szPacker.resetcCs
|j��Sr	)r$�getvaluerrrr
�
get_buffer8szPacker.get_buffercCs|j�t�d|��dS)N�>L�r$�writerZpack�r�xrrr
�	pack_uint=szPacker.pack_uintcCs|j�t�d|��dS)N�>lr(r*rrr
�pack_intAszPacker.pack_intcCs"|r|j�d�n|j�d�dS)Nss)r$r)r*rrr
�	pack_boolGszPacker.pack_boolc
Cs�z|�|d?d@�Wn8ttjfk
rN}zt|jd�d�W5d}~XYnXz|�|d@�Wn8ttjfk
r�}zt|jd�d�W5d}~XYnXdS)N� l��r)r,�	TypeErrorrrrr)rr+rrrr
�pack_uhyperKs"zPacker.pack_uhypercCs|j�t�d|��dS)N�>fr(r*rrr
�
pack_floatWszPacker.pack_floatcCs|j�t�d|��dS)N�>dr(r*rrr
�pack_double[szPacker.pack_doublecCsP|dkrtd��|d|�}|ddd}||t|�d}|j�|�dS)Nr� fstring size must be nonnegative���)�
ValueError�lenr$r))r�n�s�datarrr
�pack_fstring_szPacker.pack_fstringcCs"t|�}|�|�|�||�dSr	)r<r,r@)rr>r=rrr
�pack_stringis
zPacker.pack_stringcCs*|D]}|�d�||�q|�d�dS)N�r)r,)r�list�	pack_item�itemrrr
�	pack_listqs

zPacker.pack_listcCs*t|�|krtd��|D]}||�qdS)Nzwrong array size)r<r;)rr=rCrDrErrr
�pack_farraywszPacker.pack_farraycCs$t|�}|�|�|�|||�dSr	)r<r,rG)rrCrDr=rrr
�
pack_array}s
zPacker.pack_arrayN)rrrrrr#r&Zget_bufr!r,r.Z	pack_enumr/r2Z
pack_hyperr4r6r@Zpack_fopaquerAZpack_opaqueZ
pack_bytesrFrGrHrrrr
r/s2




c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZeZdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZeZdd�ZeZeZd d!�Zd"d#�Zd$d%�Zd&S)'rz;Unpacks various data representations from the given buffer.cCs|�|�dSr	r"�rr?rrr
r�szUnpacker.__init__cCs||_d|_dSr)�_Unpacker__buf�_Unpacker__posrIrrr
r#�szUnpacker.resetcCs|jSr	�rKrrrr
�get_position�szUnpacker.get_positioncCs
||_dSr	rL)rZpositionrrr
�set_position�szUnpacker.set_positioncCs|jSr	)rJrrrr
r&�szUnpacker.get_buffercCs|jt|j�krtd��dS)Nzunextracted data remains)rKr<rJrrrrr
�done�sz
Unpacker.donecCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr9r'r�rKrJr<�EOFErrorrZunpack�r�i�jr?rrr
�unpack_uint�szUnpacker.unpack_uintcCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr9r-rrPrRrrr
�
unpack_int�szUnpacker.unpack_intcCst|���Sr	)�boolrVrrrr
�unpack_bool�szUnpacker.unpack_boolcCs |��}|��}t|�d>|BS)Nr0)rU�int)r�hi�lorrr
�
unpack_uhyper�szUnpacker.unpack_uhypercCs|��}|dkr|d}|S)Nll)r\r*rrr
�unpack_hyper�szUnpacker.unpack_hypercCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)Nr9r3rrPrRrrr
�unpack_float�szUnpacker.unpack_floatcCsB|j}|d|_}|j||�}t|�dkr2t�t�d|�dS)N�r5rrPrRrrr
�
unpack_double�szUnpacker.unpack_doublecCsT|dkrtd��|j}||ddd}|t|j�kr<t�||_|j|||�S)Nrr7r8r9)r;rKr<rJrQ)rr=rSrTrrr
�unpack_fstring�szUnpacker.unpack_fstringcCs|��}|�|�Sr	)rUra)rr=rrr
�
unpack_string�szUnpacker.unpack_stringcCsBg}|��}|dkrq>|dkr,td|f��|�}|�|�q|S)NrrBz0 or 1 expected, got %r)rUr�append)r�unpack_itemrCr+rErrr
�unpack_list�szUnpacker.unpack_listcCs"g}t|�D]}|�|��q|Sr	)�rangerc)rr=rdrCrSrrr
�
unpack_farray�szUnpacker.unpack_farraycCs|��}|�||�Sr	)rUrg)rrdr=rrr
�unpack_array�szUnpacker.unpack_arrayN)rrrrrr#rMrNr&rOrUrVZunpack_enumrXr\r]r^r`raZunpack_fopaquerbZ
unpack_opaqueZunpack_bytesrergrhrrrr
r�s.
)
rr�ior�	functoolsr�__all__�	Exceptionrrr!rrrrrr
�<module>sU