ó zfc@sËdZddlZyddlmZWn!ek rIddlmZnXddlmZddddgZde fd „ƒYZ de fd „ƒYZ d „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„Z d„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.pyt pack_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.pyt pack_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.pyt pack_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.pyt pack_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-t pack_opaquet pack_bytesR1R2R3(((s/usr/lib64/python2.7/xdrlib.pyR2s*         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/lib64/python2.7/xdrlib.pyRŠscCs||_d|_dS(Ni(t_Unpacker__buft_Unpacker__pos(RR+((s/usr/lib64/python2.7/xdrlib.pyRs 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.pyt unpack_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.pyt unpack_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(Rt unpack_itemR.RR0((s/usr/lib64/python2.7/xdrlib.pyt unpack_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?RFRGt unpack_enumRIRMRNRORPRQtunpack_fopaqueRRt unpack_opaquet unpack_bytesRURWRX(((s/usr/lib64/python2.7/xdrlib.pyR‡s.               (((RRt cStringIORRt ImportErrort functoolsRt__all__t ExceptionRRRRR(((s/usr/lib64/python2.7/xdrlib.pyts   U