ó õ^‚Rc@s²dZddlZyddlmZWn!ek rIddlmZnXddddgZdefd„ƒYZdefd „ƒYZ dd d „ƒYZ dd d „ƒYZ dS(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/usr/lib/python2.7/xdrlib.pyt__init__scCs t|jƒS(N(treprR(R((s/usr/lib/python2.7/xdrlib.pyt__repr__scCs t|jƒS(N(tstrR(R((s/usr/lib/python2.7/xdrlib.pyt__str__s(t__name__t __module__t__doc__RR R (((s/usr/lib/python2.7/xdrlib.pyRs   cBseZRS((R R (((s/usr/lib/python2.7/xdrlib.pyR"scBs°eZdZd„Zd„Zd„ZeZd„Zd„ZeZ d„Z d„Z e Z d„Z d „Zd „ZeZd „ZeZeZd „Zd „Zd„ZRS(s0Pack various data representations into a buffer.cCs|jƒdS(N(treset(R((s/usr/lib/python2.7/xdrlib.pyR*scCstƒ|_dS(N(t _StringIOt _Packer__buf(R((s/usr/lib/python2.7/xdrlib.pyR-scCs |jjƒS(N(Rtgetvalue(R((s/usr/lib/python2.7/xdrlib.pyt get_buffer0scCs |jjtjd|ƒƒdS(Ns>L(Rtwritetstructtpack(Rtx((s/usr/lib/python2.7/xdrlib.pyt pack_uint5scCs |jjtjd|ƒƒdS(Ns>l(RRRR(RR((s/usr/lib/python2.7/xdrlib.pytpack_int8scCs-|r|jjdƒn|jjdƒdS(Ntt(RR(RR((s/usr/lib/python2.7/xdrlib.pyt pack_bool=scCs*|j|d?d@ƒ|j|d@ƒdS(Ni lÿÿ(R(RR((s/usr/lib/python2.7/xdrlib.pyt pack_uhyperAscCsFy |jjtjd|ƒƒWntjk rA}t|‚nXdS(Ns>f(RRRRterrorR(RRR((s/usr/lib/python2.7/xdrlib.pyt pack_floatGs cCsFy |jjtjd|ƒƒWntjk rA}t|‚nXdS(Ns>d(RRRRRR(RRR((s/usr/lib/python2.7/xdrlib.pyt pack_doubleLs cCs`|dkrtd‚n|| }|ddd}||t|ƒd}|jj|ƒdS(Nis fstring size must be nonnegativeiit(t ValueErrortlenRR(Rtntstdata((s/usr/lib/python2.7/xdrlib.pyt pack_fstringQs    cCs-t|ƒ}|j|ƒ|j||ƒdS(N(R#RR'(RR%R$((s/usr/lib/python2.7/xdrlib.pyt pack_string[s  cCs9x%|D]}|jdƒ||ƒqW|jdƒdS(Nii(R(Rtlistt pack_itemtitem((s/usr/lib/python2.7/xdrlib.pyt pack_listcs  cCs=t|ƒ|krtd‚nx|D]}||ƒq%WdS(Nswrong array size(R#R"(RR$R)R*R+((s/usr/lib/python2.7/xdrlib.pyt pack_farrayis  cCs0t|ƒ}|j|ƒ|j|||ƒdS(N(R#RR-(RR)R*R$((s/usr/lib/python2.7/xdrlib.pyt pack_arrayos  (R R RRRRtget_bufRRt pack_enumRRt pack_hyperRR R't pack_fopaqueR(t pack_opaquet pack_bytesR,R-R.(((s/usr/lib/python2.7/xdrlib.pyR's*             cBsÈeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z e Z d „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/lib/python2.7/xdrlib.pyRyscCs||_d|_dS(Ni(t_Unpacker__buft_Unpacker__pos(RR&((s/usr/lib/python2.7/xdrlib.pyR|s cCs|jS(N(R6(R((s/usr/lib/python2.7/xdrlib.pyt get_position€scCs ||_dS(N(R6(Rtposition((s/usr/lib/python2.7/xdrlib.pyt set_positionƒscCs|jS(N(R5(R((s/usr/lib/python2.7/xdrlib.pyR†scCs+|jt|jƒkr'tdƒ‚ndS(Nsunextracted data remains(R6R#R5R(R((s/usr/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/usr/lib/python2.7/xdrlib.pyt unpack_uints   cCsY|j}|d|_}|j||!}t|ƒdkrEt‚ntjd|ƒdS(Nis>li(R6R5R#R;RR<(RR?R@R&((s/usr/lib/python2.7/xdrlib.pyt unpack_int™s   cCst|jƒƒS(N(tboolRB(R((s/usr/lib/python2.7/xdrlib.pyt unpack_bool£scCs*|jƒ}|jƒ}t|ƒd>|BS(Ni (RAtlong(Rthitlo((s/usr/lib/python2.7/xdrlib.pyt unpack_uhyper¦s  cCs)|jƒ}|dkr%|d}n|S(Nll(RH(RR((s/usr/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/usr/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/usr/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/usr/lib/python2.7/xdrlib.pytunpack_fstringÁs     cCs|jƒ}|j|ƒS(N(RARL(RR$((s/usr/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(Rt unpack_itemR)RR+((s/usr/lib/python2.7/xdrlib.pyt unpack_listÔs    cCs1g}x$t|ƒD]}|j|ƒƒqW|S(N(trangeRN(RR$ROR)R?((s/usr/lib/python2.7/xdrlib.pyt unpack_farrayßscCs|jƒ}|j||ƒS(N(RARR(RROR$((s/usr/lib/python2.7/xdrlib.pyt unpack_arrayås (R R RRRR7R9RR:RARBt unpack_enumRDRHRIRJRKRLtunpack_fopaqueRMt unpack_opaquet unpack_bytesRPRRRS(((s/usr/lib/python2.7/xdrlib.pyRvs.               ((( RRt cStringIORRt ImportErrort__all__t ExceptionRRRR(((s/usr/lib/python2.7/xdrlib.pyts  O