ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/xdrlib.cpython-35.opt-1.pyc



>�Ma�@s�dZddlZddlmZddlmZddddgZGd	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/python35/lib64/python3.5/xdrlib.py�__init__szError.__init__cCs
t|j�S)N)�reprr)r	r
r
r�__repr__szError.__repr__cCs
t|j�S)N)�strr)r	r
r
r�__str__sz
Error.__str__N)�__name__�
__module__�__qualname__�__doc__rrrr
r
r
rrs	c@seZdZdS)rN)rrrr
r
r
rr scs"t���fdd��}|S)z5 Wrap any raised struct.errors in a ConversionError. csVy�||�SWn>tjk
rQ}zt|jd�d�WYdd}~XnXdS)Nr)�struct�errorr�args)r	�value�e)�functionr
r�result&sz&raise_conversion_error.<locals>.result)r)rrr
)rr�raise_conversion_error#src@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|j�dS)N)�reset)r	r
r
rr2szPacker.__init__cCst�|_dS)N)r�_Packer__buf)r	r
r
rr5szPacker.resetcCs
|jj�S)N)r�getvalue)r	r
r
r�
get_buffer8szPacker.get_buffercCs |jjtjd|��dS)Nz>L)r�writer�pack)r	�xr
r
r�	pack_uint=szPacker.pack_uintcCs |jjtjd|��dS)Nz>l)rr!rr")r	r#r
r
r�pack_intAszPacker.pack_intcCs-|r|jjd�n|jjd�dS)Nss)rr!)r	r#r
r
r�	pack_boolGszPacker.pack_boolcCs�y|j|d?d@�WnDttjfk
r_}zt|jd�d�WYdd}~XnXy|j|d@�WnDttjfk
r�}zt|jd�d�WYdd}~XnXdS)N� l��r)r$�	TypeErrorrrrr)r	r#rr
r
r�pack_uhyperKs)zPacker.pack_uhypercCs |jjtjd|��dS)Nz>f)rr!rr")r	r#r
r
r�
pack_floatWszPacker.pack_floatcCs |jjtjd|��dS)Nz>d)rr!rr")r	r#r
r
r�pack_double[szPacker.pack_doublecCsf|dkrtd��|d|�}|ddd}||t|�d}|jj|�dS)Nrz fstring size must be nonnegative��s)�
ValueError�lenrr!)r	�n�s�datar
r
r�pack_fstring_szPacker.pack_fstringcCs-t|�}|j|�|j||�dS)N)r/r$r3)r	r1r0r
r
r�pack_stringis
zPacker.pack_stringcCs9x%|D]}|jd�||�qW|jd�dS)N�r)r$)r	�list�	pack_item�itemr
r
r�	pack_listqs

zPacker.pack_listcCs=t|�|krtd��x|D]}||�q%WdS)Nzwrong array size)r/r.)r	r0r6r7r8r
r
r�pack_farrayws
zPacker.pack_farraycCs0t|�}|j|�|j|||�dS)N)r/r$r:)r	r6r7r0r
r
r�
pack_array}s
zPacker.pack_arrayN)rrrrrrr Zget_bufrr$r%Z	pack_enumr&r)Z
pack_hyperr*r+r3Zpack_fopaquer4Zpack_opaqueZ
pack_bytesr9r:r;r
r
r
rr/s*
c@seZdZdZdd�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|j|�dS)N)r)r	r2r
r
rr�szUnpacker.__init__cCs||_d|_dS)Nr)�_Unpacker__buf�_Unpacker__pos)r	r2r
r
rr�s	zUnpacker.resetcCs|jS)N)r=)r	r
r
r�get_position�szUnpacker.get_positioncCs
||_dS)N)r=)r	Zpositionr
r
r�set_position�szUnpacker.set_positioncCs|jS)N)r<)r	r
r
rr �szUnpacker.get_buffercCs(|jt|j�kr$td��dS)Nzunextracted data remains)r=r/r<r)r	r
r
r�done�sz
Unpacker.donecCsY|j}|d|_}|j||�}t|�dkrEt�tjd|�dS)Nr-z>Lr)r=r<r/�EOFErrorr�unpack)r	�i�jr2r
r
r�unpack_uint�s	zUnpacker.unpack_uintcCsY|j}|d|_}|j||�}t|�dkrEt�tjd|�dS)Nr-z>lr)r=r<r/rArrB)r	rCrDr2r
r
r�
unpack_int�s	zUnpacker.unpack_intcCst|j��S)N)�boolrF)r	r
r
r�unpack_bool�szUnpacker.unpack_boolcCs*|j�}|j�}t|�d>|BS)Nr')rE�int)r	�hi�lor
r
r�
unpack_uhyper�szUnpacker.unpack_uhypercCs&|j�}|dkr"|d}|S)Nll)rL)r	r#r
r
r�unpack_hyper�s
zUnpacker.unpack_hypercCsY|j}|d|_}|j||�}t|�dkrEt�tjd|�dS)Nr-z>fr)r=r<r/rArrB)r	rCrDr2r
r
r�unpack_float�s	zUnpacker.unpack_floatcCsY|j}|d|_}|j||�}t|�dkrEt�tjd|�dS)N�z>dr)r=r<r/rArrB)r	rCrDr2r
r
r�
unpack_double�s	zUnpacker.unpack_doublecCsp|dkrtd��|j}||ddd}|t|j�krRt�||_|j|||�S)Nrz fstring size must be nonnegativer,r-)r.r=r/r<rA)r	r0rCrDr
r
r�unpack_fstring�s		zUnpacker.unpack_fstringcCs|j�}|j|�S)N)rErQ)r	r0r
r
r�
unpack_string�szUnpacker.unpack_stringcCs_g}xR|j�}|dkr"P|dkrAtd|f��|�}|j|�q	W|S)Nrr5z0 or 1 expected, got %r)rEr�append)r	�unpack_itemr6r#r8r
r
r�unpack_list�s	zUnpacker.unpack_listcCs1g}x$t|�D]}|j|��qW|S)N)�rangerS)r	r0rTr6rCr
r
r�
unpack_farray�szUnpacker.unpack_farraycCs|j�}|j||�S)N)rErW)r	rTr0r
r
r�unpack_array�szUnpacker.unpack_arrayN)rrrrrrr>r?r r@rErFZunpack_enumrHrLrMrNrPrQZunpack_fopaquerRZ
unpack_opaqueZunpack_bytesrUrWrXr
r
r
rr�s.
)
rr�ior�	functoolsr�__all__�	Exceptionrrrrrr
r
r
r�<module>sU

Zerion Mini Shell 1.0