zfc@sdZddlZyddlmZWn!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 iN(tStringIO(twrapstErrortPackertUnpackertConversionErrorcBs)eZdZdZdZdZRS(sException 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|jS(N(treprR(R((s/usr/lib64/python2.7/xdrlib.pyt__repr__scCs t|jS(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#scstfd}|S(s5 Wrap any raised struct.errors in a ConversionError. csAy||SWn)tjk r<}t|jdnXdS(Ni(tstructterrorRtargs(Rtvaluete(tfunction(s/usr/lib64/python2.7/xdrlib.pytresult)s(R(RR((Rs/usr/lib64/python2.7/xdrlib.pytraise_conversion_error&scBseZdZdZdZdZeZedZedZ e Z dZ dZ e Z edZed Zd ZeZd ZeZeZd Zd ZdZRS(s0Pack various data representations into a buffer.cCs|jdS(N(treset(R((s/usr/lib64/python2.7/xdrlib.pyR5scCst|_dS(N(t _StringIOt _Packer__buf(R((s/usr/lib64/python2.7/xdrlib.pyR8scCs |jjS(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|jjdn|jjddS(Nss(RR(RR((s/usr/lib64/python2.7/xdrlib.pyt pack_boolJscCsy|j|d?d@Wn/ttjfk rJ}t|jdnXy|j|d@Wn/ttjfk r}t|jdnXdS(Ni li(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`|dkrtdn|| }|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|jddS(Nii(R (Rtlistt pack_itemtitem((s/usr/lib64/python2.7/xdrlib.pyt pack_listts  cCs=t||krtdnx|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_arrays  (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*         cBseZdZdZdZdZdZdZdZdZ dZ e Z d Z d Z d Zd Zd ZdZeZdZeZeZdZdZdZRS(s;Unpacks various data representations from the given buffer.cCs|j|dS(N(R(RR+((s/usr/lib64/python2.7/xdrlib.pyRscCs||_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_positionscCs ||_dS(N(R;(Rtposition((s/usr/lib64/python2.7/xdrlib.pyt set_positionscCs|jS(N(R:(R((s/usr/lib64/python2.7/xdrlib.pyRscCs+|jt|jkr'tdndS(Nsunextracted data remains(R;R(R:R(R((s/usr/lib64/python2.7/xdrlib.pytdonescCs|j}|d|_}|j||!}t|dkrEtntjd|d}yt|SWntk r}|SXdS(Nis>Li(R;R:R(tEOFErrorRtunpacktintt OverflowError(RtitjR+R((s/usr/lib64/python2.7/xdrlib.pyt unpack_uints   cCsY|j}|d|_}|j||!}t|dkrEtntjd|dS(Nis>li(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pyt unpack_ints   cCst|jS(N(tboolRG(R((s/usr/lib64/python2.7/xdrlib.pyt unpack_boolscCs*|j}|j}t|d>|BS(Ni (RFtlong(Rthitlo((s/usr/lib64/python2.7/xdrlib.pyt unpack_uhypers  cCs)|j}|dkr%|d}n|S(Nll(RM(RR((s/usr/lib64/python2.7/xdrlib.pyt unpack_hypers   cCsY|j}|d|_}|j||!}t|dkrEtntjd|dS(Nis>fi(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pyt unpack_floats   cCsY|j}|d|_}|j||!}t|dkrEtntjd|dS(Nis>di(R;R:R(R@RRA(RRDRER+((s/usr/lib64/python2.7/xdrlib.pyt unpack_doubles   cCsp|dkrtdn|j}||ddd}|t|jkrUtn||_|j|||!S(Nis fstring size must be nonnegativeii(R'R;R(R:R@(RR)RDRE((s/usr/lib64/python2.7/xdrlib.pytunpack_fstrings     cCs|j}|j|S(N(RFRQ(RR)((s/usr/lib64/python2.7/xdrlib.pyt unpack_strings cCsbg}xU|j}|dkr%Pn|dkrDtd|fn|}|j|q W|S(Niis0 or 1 expected, got %r(RFRtappend(Rt unpack_itemR.RR0((s/usr/lib64/python2.7/xdrlib.pyt unpack_lists    cCs1g}x$t|D]}|j|qW|S(N(trangeRS(RR)RTR.RD((s/usr/lib64/python2.7/xdrlib.pyt unpack_farrayscCs|j}|j||S(N(RFRW(RRTR)((s/usr/lib64/python2.7/xdrlib.pyt unpack_arrays (R RRRRR<R>RR?RFRGt unpack_enumRIRMRNRORPRQtunpack_fopaqueRRt unpack_opaquet unpack_bytesRURWRX(((s/usr/lib64/python2.7/xdrlib.pyRs.               (((RRt cStringIORRt ImportErrort functoolsRt__all__t ExceptionRRRRR(((s/usr/lib64/python2.7/xdrlib.pyts   U