Qf6dZddlZddlmZddlmZddlZejedgdZ Gdd e Z Gd d e Z d Z Gd dZGddZy)zRImplements (a subset of) Sun XDR -- eXternal Data Representation. See: RFC 1014 N)BytesIOwraps) )remove)ErrorPackerUnpackerConversionErrorc"eZdZdZdZdZdZy)r zException class for this module. Use: except xdrlib.Error as var: # var has the Error instance for the exception Public ivars: msg -- contains the message c||_yN)msg)selfrs -/opt/alt/python312/lib64/python3.12/xdrlib.py__init__zError.__init__s c,t|jSr)reprrrs r__repr__zError.__repr__sDHH~rc,t|jSr)strrrs r__str__z Error.__str__s488}rN)__name__ __module__ __qualname____doc__rrrrrr r srr c eZdZy)r N)rrrr rrr r #srr c.tfd}|S)z5 Wrap any raised struct.errors in a ConversionError. c ||S#tj$r}t|jddd}~wwxYwNr)structerrorr args)rvalueefunctions rresultz&raise_conversion_error..result)s> 7D%( (|| 7!!&&),$ 6 7s =8=r)r*r+s` rraise_conversion_errorr,&s" 8_77 MrceZdZdZdZdZdZeZedZ edZ e Z dZ dZ e Zed Zed Zd ZeZd ZeZeZd ZdZdZy)r z0Pack various data representations into a buffer.c$|jyrresetrs rrzPacker.__init__5s  rc"t|_yr)r _Packer__bufrs rr0z Packer.reset8s Y rc6|jjSr)r2getvaluers r get_bufferzPacker.get_buffer;szz""$$rcb|jjtjd|y)N>Lr2writer%packrxs r pack_uintzPacker.pack_uint@ T1-.rcb|jjtjd|y)N>lr8r;s rpack_intzPacker.pack_intDr>rcv|r|jjdy|jjdy)Nss)r2r9r;s r pack_boolzPacker.pack_boolJs( djj{+jj{+rcF |j|dz dz |j|dzy#ttjf$r}t |j ddd}~wwxYw#ttjf$r}t |j ddd}~wwxYw)N lr)r= TypeErrorr%r&r r')rr<r)s r pack_uhyperzPacker.pack_uhyperNs 7 NN1b5:- . 7 NN1z> *6<<( 7!!&&),$ 6 76<<( 7!!&&),$ 6 7s,/A)A&A!!A&)B BB cb|jjtjd|y)N>fr8r;s r pack_floatzPacker.pack_floatZr>rcb|jjtjd|y)N>dr8r;s r pack_doublezPacker.pack_double^r>rc|dkr td|d|}|dzdzdz}||t|z dzz}|jj|y)Nr fstring size must be nonnegativer) ValueErrorlenr2r9)rnsdatas r pack_fstringzPacker.pack_fstringbsZ q5?@ @!ucAXqLq3t9}-- rc`t|}|j||j||yr)rSr=rW)rrUrTs r pack_stringzPacker.pack_stringls' F q !Qrcf|D]}|jd|||jdy)Nr)r=)rlist pack_itemitems r pack_listzPacker.pack_listts-D NN1  dO qrcTt||k7r td|D] }|| y)Nzwrong array size)rSrR)rrTr\r]r^s r pack_farrayzPacker.pack_farrayzs* t9>/0 0D dOrcbt|}|j||j|||yr)rSr=ra)rr\r]rTs r pack_arrayzPacker.pack_arrays) I q D),rN)rrrrrr0r5get_bufr,r=rA pack_enumrCrG pack_hyperrJrMrW pack_fopaquerY pack_opaque pack_bytesr_rarcr rrr r 2s:%G////I,7J//// L KJ  -rr ceZdZdZdZdZdZdZdZdZ dZ d Z e Z d Z d Zd Zd ZdZdZeZdZeZeZdZdZdZy)r z;Unpacks various data representations from the given buffer.c&|j|yrr/rrVs rrzUnpacker.__init__s 4rc ||_d|_yr$)_Unpacker__buf_Unpacker__posrls rr0zUnpacker.resets  rc|jSrrors r get_positionzUnpacker.get_position zzrc||_yrrq)rpositions r set_positionzUnpacker.set_positions  rc|jSr)rnrs rr5zUnpacker.get_bufferrsrc^|jt|jkr tdy)Nzunextracted data remains)rorSrnr rs rdonez Unpacker.dones' ::DJJ '23 3 (rc|j}|dzx|_}|j||}t|dkrtt j d|dS)NrPr7rrornrSEOFErrorr%unpackrijrVs r unpack_uintzUnpacker.unpack_uintP JJ1 Qzz!A t9q=N}}T4(++rc|j}|dzx|_}|j||}t|dkrtt j d|dS)NrPr@rr{r~s r unpack_intzUnpacker.unpack_intrrc4t|jSr)boolrrs r unpack_boolzUnpacker.unpack_boolsDOO%&&rcd|j}|j}t|dz|zS)NrE)rint)rhilos r unpack_uhyperzUnpacker.unpack_uhypers1        2w{Rrc:|j}|dk\r|dz }|S)Nll)rr;s r unpack_hyperzUnpacker.unpack_hypers)     " "''Arc|j}|dzx|_}|j||}t|dkrtt j d|dS)NrPrIrr{r~s r unpack_floatzUnpacker.unpack_floatrrc|j}|dzx|_}|j||}t|dkrtt j d|dS)NrLrr{r~s r unpack_doublezUnpacker.unpack_doublerrc|dkr td|j}||dzdzdzz}|t|jkDrt||_|j|||zS)NrrOrrP)rRrorSrnr|)rrTrrs runpack_fstringzUnpacker.unpack_fstringsd q5?@ @ JJ 1q N s4:: N zz!AaC  rcD|j}|j|Sr)rr)rrTs r unpack_stringzUnpacker.unpack_strings!    ""1%%rcg}|jx}dk7rA|dk7rtd||}|j||jx}dk7rA|S)Nrr[z0 or 1 expected, got )rr append)r unpack_itemr\r<r^s r unpack_listzUnpacker.unpack_listsd$$&&q1,Av%1&FGG=D KK  $$&&q1,  rcVg}t|D]}|j||Sr)ranger)rrTrr\rs r unpack_farrayzUnpacker.unpack_farrays(qA KK & rcF|j}|j||Sr)rr)rrrTs r unpack_arrayzUnpacker.unpack_arrays#    !!![11rN)rrrrrr0rrrvr5ryrr unpack_enumrrrrrrunpack_fopaquer unpack_opaque unpack_bytesrrrr rrr r syE4,,K'  ,,!$N&"M L 2rr )rr%ior functoolsrwarnings _deprecatedr__all__ Exceptionr r r,r r r rrrse Xg. <I$ e  Q-Q-jk2k2r