ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/xdrlib.cpython-34.pyc

�
j f�@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/python34/lib64/python3.4/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_doublecCsi|dkrtd��n|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|�|kr!td��nx|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��ndS)Nzunextracted data remains)r=r/r<r)r	r
r
r�done�sz
Unpacker.donecCs\|j}|d|_}|j||�}t|�dkrHt�ntjd|�dS)Nr-z>Lr)r=r<r/�EOFErrorr�unpack)r	�i�jr2r
r
r�unpack_uint�s		zUnpacker.unpack_uintcCs\|j}|d|_}|j||�}t|�dkrHt�ntjd|�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}n|S)Nll)rL)r	r#r
r
r�unpack_hyper�s
zUnpacker.unpack_hypercCs\|j}|d|_}|j||�}t|�dkrHt�ntjd|�dS)Nr-z>fr)r=r<r/rArrB)r	rCrDr2r
r
r�unpack_float�s		zUnpacker.unpack_floatcCs\|j}|d|_}|j||�}t|�dkrHt�ntjd|�dS)N�z>dr)r=r<r/rArrB)r	rCrDr2r
r
r�
unpack_double�s		zUnpacker.unpack_doublecCsv|dkrtd��n|j}||ddd}|t|j�krXt�n||_|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_stringcCseg}xX|j�}|dkr%Pn|dkrGtd|f��n|�}|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