Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/xdrlib.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�dZddlZyddlmZWn!ek
rIddlmZnXddddgZdefd��YZdefd	��YZ	ddd
��YZ
dd
d��YZdS(sRImplements (a subset of) Sun XDR -- eXternal Data Representation.

See: RFC 1014

i�N(tStringIOtErrortPackertUnpackertConversionErrorcBs)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/sys/lib/python2.7/xdrlib.pyt__init__scCs
t|j�S(N(treprR(R((s/sys/lib/python2.7/xdrlib.pyt__repr__scCs
t|j�S(N(tstrR(R((s/sys/lib/python2.7/xdrlib.pyt__str__s(t__name__t
__module__t__doc__RR	R(((s/sys/lib/python2.7/xdrlib.pyRs			cBseZRS((RR
(((s/sys/lib/python2.7/xdrlib.pyR"scBs�eZdZd�Zd�Zd�ZeZd�Zd�ZeZ	d�Z
d�ZeZd�Z
d	�Zd
�ZeZd�ZeZeZd�Zd
�Zd�ZRS(s0Pack various data representations into a buffer.cCs|j�dS(N(treset(R((s/sys/lib/python2.7/xdrlib.pyR*scCst�|_dS(N(t	_StringIOt_Packer__buf(R((s/sys/lib/python2.7/xdrlib.pyR-scCs
|jj�S(N(Rtgetvalue(R((s/sys/lib/python2.7/xdrlib.pyt
get_buffer0scCs |jjtjd|��dS(Ns>L(Rtwritetstructtpack(Rtx((s/sys/lib/python2.7/xdrlib.pyt	pack_uint5scCs |jjtjd|��dS(Ns>l(RRRR(RR((s/sys/lib/python2.7/xdrlib.pytpack_int8scCs-|r|jjd�n|jjd�dS(Ntt(RR(RR((s/sys/lib/python2.7/xdrlib.pyt	pack_bool=scCs*|j|d?d@�|j|d@�dS(Ni l�(R(RR((s/sys/lib/python2.7/xdrlib.pytpack_uhyperAscCsFy |jjtjd|��Wntjk
rA}t|�nXdS(Ns>f(RRRRterrorR(RRR((s/sys/lib/python2.7/xdrlib.pyt
pack_floatGs cCsFy |jjtjd|��Wntjk
rA}t|�nXdS(Ns>d(RRRRRR(RRR((s/sys/lib/python2.7/xdrlib.pytpack_doubleLs cCs`|dkrtd�n|| }|ddd}||t|�d}|jj|�dS(Nis fstring size must be nonnegativeiit(t
ValueErrortlenRR(Rtntstdata((s/sys/lib/python2.7/xdrlib.pytpack_fstringQs
cCs-t|�}|j|�|j||�dS(N(R#RR'(RR%R$((s/sys/lib/python2.7/xdrlib.pytpack_string[s
cCs9x%|D]}|jd�||�qW|jd�dS(Nii(R(Rtlistt	pack_itemtitem((s/sys/lib/python2.7/xdrlib.pyt	pack_listcs

cCs=t|�|krtd�nx|D]}||�q%WdS(Nswrong array size(R#R"(RR$R)R*R+((s/sys/lib/python2.7/xdrlib.pytpack_farrayis
cCs0t|�}|j|�|j|||�dS(N(R#RR-(RR)R*R$((s/sys/lib/python2.7/xdrlib.pyt
pack_arrayos
(RR
RRRRtget_bufRRt	pack_enumRRt
pack_hyperRR R'tpack_fopaqueR(tpack_opaquet
pack_bytesR,R-R.(((s/sys/lib/python2.7/xdrlib.pyR's*													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/sys/lib/python2.7/xdrlib.pyRyscCs||_d|_dS(Ni(t_Unpacker__buft_Unpacker__pos(RR&((s/sys/lib/python2.7/xdrlib.pyR|s	cCs|jS(N(R6(R((s/sys/lib/python2.7/xdrlib.pytget_position�scCs
||_dS(N(R6(Rtposition((s/sys/lib/python2.7/xdrlib.pytset_position�scCs|jS(N(R5(R((s/sys/lib/python2.7/xdrlib.pyR�scCs+|jt|j�kr'td��ndS(Nsunextracted data remains(R6R#R5R(R((s/sys/lib/python2.7/xdrlib.pytdone�scCs�|j}|d|_}|j||!}t|�dkrEt�ntjd|�d}yt|�SWntk
r}|SXdS(Nis>Li(R6R5R#tEOFErrorRtunpacktintt
OverflowError(RtitjR&R((s/sys/lib/python2.7/xdrlib.pytunpack_uint�s		
cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>li(R6R5R#R;RR<(RR?R@R&((s/sys/lib/python2.7/xdrlib.pyt
unpack_int�s		cCst|j��S(N(tboolRB(R((s/sys/lib/python2.7/xdrlib.pytunpack_bool�scCs*|j�}|j�}t|�d>|BS(Ni (RAtlong(Rthitlo((s/sys/lib/python2.7/xdrlib.pyt
unpack_uhyper�scCs)|j�}|dkr%|d}n|S(Nll(RH(RR((s/sys/lib/python2.7/xdrlib.pytunpack_hyper�s
cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>fi(R6R5R#R;RR<(RR?R@R&((s/sys/lib/python2.7/xdrlib.pytunpack_float�s		cCsY|j}|d|_}|j||!}t|�dkrEt�ntjd|�dS(Nis>di(R6R5R#R;RR<(RR?R@R&((s/sys/lib/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"R6R#R5R;(RR$R?R@((s/sys/lib/python2.7/xdrlib.pytunpack_fstring�s			cCs|j�}|j|�S(N(RARL(RR$((s/sys/lib/python2.7/xdrlib.pyt
unpack_string�scCsag}xT|j�}|dkr%Pn|dkrDtd|f�n|�}|j|�q	|S(Niis0 or 1 expected, got %r(RARtappend(Rtunpack_itemR)RR+((s/sys/lib/python2.7/xdrlib.pytunpack_list�s	cCs1g}x$t|�D]}|j|��qW|S(N(trangeRN(RR$ROR)R?((s/sys/lib/python2.7/xdrlib.pyt
unpack_farray�scCs|j�}|j||�S(N(RARR(RROR$((s/sys/lib/python2.7/xdrlib.pytunpack_array�s(RR
RRRR7R9RR:RARBtunpack_enumRDRHRIRJRKRLtunpack_fopaqueRMt
unpack_opaquetunpack_bytesRPRRRS(((s/sys/lib/python2.7/xdrlib.pyRvs.														
			(((RRt	cStringIORRtImportErrort__all__t	ExceptionRRRR(((s/sys/lib/python2.7/xdrlib.pyt<module>s
O

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].