Your IP : 3.144.41.252


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/xdrlib.pyc

�
zfc@s�dZddlZyddlmZWn!ek
rIddlmZnXddlmZddddgZde	fd	��YZ
de
fd
��YZd�Zddd��YZ
ddd
��YZdS(sRImplements (a subset of) Sun XDR -- eXternal Data Representation.

See: RFC 1014

i����N(tStringIO(twrapstErrortPackertUnpackertConversionErrorcBs)eZdZd�Zd�Zd�ZRS(s�Exception class for this module. Use:

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

    Public ivars:
        msg -- contains the message

    cCs
||_dS(N(tmsg(tselfR((s/usr/lib64/python2.7/xdrlib.pyt__init__scCs
t|j�S(N(treprR(R((s/usr/lib64/python2.7/xdrlib.pyt__repr__scCs
t|j�S(N(tstrR(R((s/usr/lib64/python2.7/xdrlib.pyt__str__s(t__name__t
__module__t__doc__RR
R(((s/usr/lib64/python2.7/xdrlib.pyRs			cBseZRS((R
R(((s/usr/lib64/python2.7/xdrlib.pyR#scst���fd��}|S(s5 Wrap any raised struct.errors in a ConversionError. csAy�||�SWn)tjk
r<}t|jd��nXdS(Ni(tstructterrorRtargs(Rtvaluete(tfunction(s/usr/lib64/python2.7/xdrlib.pytresult)s(R(RR((Rs/usr/lib64/python2.7/xdrlib.pytraise_conversion_error&scBs�eZdZd�Zd�Zd�ZeZed��Zed��Z	e	Z
d�Zd�ZeZ
ed��Zed	��Zd
�ZeZd�ZeZeZd�Zd
�Zd�ZRS(s0Pack various data representations into a buffer.cCs|j�dS(N(treset(R((s/usr/lib64/python2.7/xdrlib.pyR5scCst�|_dS(N(t	_StringIOt_Packer__buf(R((s/usr/lib64/python2.7/xdrlib.pyR8scCs
|jj�S(N(Rtgetvalue(R((s/usr/lib64/python2.7/xdrlib.pyt
get_buffer;scCs |jjtjd|��dS(Ns>L(RtwriteRtpack(Rtx((s/usr/lib64/python2.7/xdrlib.pyt	pack_uint@scCs |jjtjd|��dS(Ns>l(RRRR(RR((s/usr/lib64/python2.7/xdrlib.pytpack_intDscCs-|r|jjd�n|jjd�dS(Nss(RR(RR((s/usr/lib64/python2.7/xdrlib.pyt	pack_boolJscCs�y|j|d?d@�Wn/ttjfk
rJ}t|jd��nXy|j|d@�Wn/ttjfk
r�}t|jd��nXdS(Ni l��i(R t	TypeErrorRRRR(RRR((s/usr/lib64/python2.7/xdrlib.pytpack_uhyperNscCs |jjtjd|��dS(Ns>f(RRRR(RR((s/usr/lib64/python2.7/xdrlib.pyt
pack_floatZscCs |jjtjd|��dS(Ns>d(RRRR(RR((s/usr/lib64/python2.7/xdrlib.pytpack_double^scCs`|dkrtd�n|| }|ddd}||t|�d}|jj|�dS(Nis fstring size must be nonnegativeiis(t
ValueErrortlenRR(Rtntstdata((s/usr/lib64/python2.7/xdrlib.pytpack_fstringbs
cCs-t|�}|j|�|j||�dS(N(R(R R,(RR*R)((s/usr/lib64/python2.7/xdrlib.pytpack_stringls
cCs9x%|D]}|jd�||�qW|jd�dS(Nii(R (Rtlistt	pack_itemtitem((s/usr/lib64/python2.7/xdrlib.pyt	pack_listts

cCs=t|�|krtd�nx|D]}||�q%WdS(Nswrong array size(R(R'(RR)R.R/R0((s/usr/lib64/python2.7/xdrlib.pytpack_farrayzs
cCs0t|�}|j|�|j|||�dS(N(R(R R2(RR.R/R)((s/usr/lib64/python2.7/xdrlib.pyt
pack_array�s
(R
RRRRRtget_bufRR R!t	pack_enumR"R$t
pack_hyperR%R&R,tpack_fopaqueR-tpack_opaquet
pack_bytesR1R2R3(((s/usr/lib64/python2.7/xdrlib.pyR2s*					
				cBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
e
Zd	�Zd
�Z
d�Zd�Zd
�Zd�ZeZd�ZeZeZd�Zd�Zd�ZRS(s;Unpacks various data representations from the given buffer.cCs|j|�dS(N(R(RR+((s/usr/lib64/python2.7/xdrlib.pyR�scCs||_d|_dS(Ni(t_Unpacker__buft_Unpacker__pos(RR+((s/usr/lib64/python2.7/xdrlib.pyR�s	cCs|jS(N(R;(R((s/usr/lib64/python2.7/xdrlib.pytget_position�scCs
||_dS(N(R;(Rtposition((s/usr/lib64/python2.7/xdrlib.pytset_position�scCs|jS(N(R:(R((s/usr/lib64/python2.7/xdrlib.pyR�scCs+|jt|j�kr'td��ndS(Nsunextracted data remains(R;R(R:R(R((s/usr/lib64/python2.7/xdrlib.pytdone�scCs�|j}|d|_}|j||!}t|�dkrEt�ntjd|�d}yt|�SWntk
r}|SXdS(Nis>Li(R;R:R(tEOFErrorRtunpacktintt
OverflowError(RtitjR+R((s/usr/lib64/python2.7/xdrlib.pytunpack_uint�s		
cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>li(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pyt
unpack_int�s		cCst|j��S(N(tboolRG(R((s/usr/lib64/python2.7/xdrlib.pytunpack_bool�scCs*|j�}|j�}t|�d>|BS(Ni (RFtlong(Rthitlo((s/usr/lib64/python2.7/xdrlib.pyt
unpack_uhyper�scCs)|j�}|dkr%|d}n|S(Nll(RM(RR((s/usr/lib64/python2.7/xdrlib.pytunpack_hyper�s
cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>fi(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pytunpack_float�s		cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>di(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pyt
unpack_double�s		cCsp|dkrtd�n|j}||ddd}|t|j�krUt�n||_|j|||!S(Nis fstring size must be nonnegativeii(R'R;R(R:R@(RR)RDRE((s/usr/lib64/python2.7/xdrlib.pytunpack_fstring�s			cCs|j�}|j|�S(N(RFRQ(RR)((s/usr/lib64/python2.7/xdrlib.pyt
unpack_string�scCsbg}xU|j�}|dkr%Pn|dkrDtd|f�n|�}|j|�q	W|S(Niis0 or 1 expected, got %r(RFRtappend(Rtunpack_itemR.RR0((s/usr/lib64/python2.7/xdrlib.pytunpack_list�s	cCs1g}x$t|�D]}|j|��qW|S(N(trangeRS(RR)RTR.RD((s/usr/lib64/python2.7/xdrlib.pyt
unpack_farray�scCs|j�}|j||�S(N(RFRW(RRTR)((s/usr/lib64/python2.7/xdrlib.pytunpack_array�s(R
RRRRR<R>RR?RFRGtunpack_enumRIRMRNRORPRQtunpack_fopaqueRRt
unpack_opaquetunpack_bytesRURWRX(((s/usr/lib64/python2.7/xdrlib.pyR�s.														
			(((RRt	cStringIORRtImportErrort	functoolsRt__all__t	ExceptionRRRRR(((s/usr/lib64/python2.7/xdrlib.pyt<module>s
	U

?>