!;Vc@sdZddklZddkZddkZddkZddklZlZddk Z ddk Z ddk Z ddk Z e i ddee iddd d gZe id d d dd gZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZdefdYZd efd!YZd"efd#YZd$efd%YZd&efd'YZ h d(dgei"6d)egei#6d*egei$6d+egei%6d,egei&6d-egei'6d.egei(6d/egei)6d0e gei*6Z+ddd1Z,d2Z-d3Z.d4efd5YZ/d6efd7YZ0d8efd9YZ1d:e1fd;YZ2d<e2fd=YZ3d>e4fd?YZ5d@e2fdAYZ6dBe1fdCYZ7dDe1fdEYZ8dFe1fdGYZ9dHe1fdIYZ:dJe1fdKYZ;dLe1fdMYZ<dNe1fdOYZ=dPe1fdQYZ>dRe1fdSYZ?dTe1fdUYZ@dVe1fdWYZAdXe1fdYYZBdZZCd[ZDeDZEd\e2fd]YZFd^efd_YZGd`eGfdaYZHdbeGfdcYZIdde2fdeYZJeJZKdfZLdgZMdS(hsxclient - RAD python client language binding This module is the main implementation of the RAD python language binding. i(twrapsN(t RADPackert RADUnpackertignoretcategorytTypettypetsubtypetnullablet Parametertnametvaluet_SchemecBseZdZdZdZRS(s RAD Search Schemes. ii(t__name__t __module__t__doc__tGLOBtREGEX(((s../common/client.pyR 7st_OpcBs8eZdZdZdZdZdZdZdZdZ RS(s RAD protocol Operations. iiiiiii( R RRtINVOKEtGETATTRtSETATTRtLOOKUPtLISTtSUBtUNSUB(((s../common/client.pyR=st_ErrorcBsDeZdZdZdZdZdZdZdZdZ dZ d Z RS( s RAD protocol error codes. iiiiiiiii( R RRtOKtOBJECTtNOMEMtNOTFOUNDtPRIVtSYSTEMtEXISTStMISMATCHtILLEGAL(((s../common/client.pyRHst _RequestErrorcBs;eZdZdZdZdZdZdZRS(s A RAD protocol request error. cCs)tt|i||_||_dS(s Create a _RequestError object. N(tsuperR$t__init__t_errort_payload(tselfterrortpayload((s../common/client.pyR&Ws cCsdt|id|ifS(s! Return a _RequestError message. s%s (%d)i(t_ErrorsR'(R)((s../common/client.pyt get_message]scCs|iS(s! Return a _RequestError payload. (R((R)((s../common/client.pyt get_payloadascCs|iS(s Return a _RequestError error. (R'(R)((s../common/client.pyt get_errorescCsd|iS(NsRequest error: (R-(R)((s../common/client.pyt__str__is(R RRR&R-R.R/R0(((s../common/client.pyR$Us     t_ContainerErrorcBs;eZdZddddZdZdZdZRS(s A RAD error base class. cCstt|i||_|dj o|idj o4|iit|i |i |i||_ q|idj o.|iit|i |i ||_ qd|_ n d|_ dS(s" Create a _ContainerError object. N( R%R1R&t_msgtNoneRRt_unpackRR.RR((R)tmsgtexR*tconn((s../common/client.pyR&os   cCs|iS(s# Return a _ContainerError message. (R2(R)((s../common/client.pyR-scCs|iS(s# Return a _ContainerError payload. (R((R)((s../common/client.pyR.scCs#|io|iiS|iSdS(N(R(R0R2(R)((s../common/client.pyR0s N(R RRR3R&R-R.R0(((s../common/client.pyR1ms   t ObjectErrorcBs eZdZddddZRS(s A RAD ObjectError. cCstt|i||_|dj o|idj o4|iit|i |i |i||_ q|idj o.|iit|i |i ||_ qd|_ n d|_ dS(s" Create a _ContainerError object. N( R%R1R&R2R3RRR4RR.RR((R)R5R6R*R7((s../common/client.pyR&s   N(R RRR3R&(((s../common/client.pyR8st NomemErrorcBseZdZRS(s A RAD No Memory Error. (R RR(((s../common/client.pyR9st NotFoundErrorcBseZdZRS(s A RAD Not Found Error. (R RR(((s../common/client.pyR:st PrivErrorcBseZdZRS(s A RAD Privilege Error. (R RR(((s../common/client.pyR;st SystemErrorcBseZdZRS(s A RAD System Error. (R RR(((s../common/client.pyR<st ExistsErrorcBseZdZRS(s A RAD Exists Error. (R RR(((s../common/client.pyR=st MismatchErrorcBseZdZRS(s A RAD Mismatch Error. (R RR(((s../common/client.pyR>st IllegalErrorcBseZdZRS(s A RAD Illegal Error. (R RR(((s../common/client.pyR?ssno errorsobject-specific errors out of memorys not foundsinsufficient privilegess system errorsalready existss type mismatchsillegal accesscCsX|idjo$t|id||||n!t|id||d|dS(s Raise a RAD error. iN(R'R,R3(R6R5R*R7((s../common/client.pyt _raise_errors$cCsB|i}|i}tii|}|tid|dS(s* Read a packed RAD time from an unpacker. t microsecondsi(t unpack_hypert unpack_inttdatetimetutcfromtimestampt timedelta(tunpackertsecondstnanostdtval((s../common/client.pyt _read_times  cCs|idjp|ii|dj}|o|tiddd}n#|tidddd|i}|tidd}|i|d|i|dddS(s! Write a RAD time into a packer. iittzinfoRAi@BiN(RLR3t utcoffsetRDRFt pack_hypertpack_int(tpackertdatatnaivetdeltat timestamp((s../common/client.pyt _write_times("tRADArraycBs,eZdZedZedZRS(s A RAD Array (list). cCsP|o)|dj }|i||pdSn|i||ii|dS(s9 Pack the supplied array value into the supplied packer. N(R3t pack_boolt pack_arrayRt_get_array_packer(tclstapackerR Rtatypetisdata((s../common/client.pyt_packs    cCs6|o|i odS|i|ii||S(s3 Unpack an array value from the supplied unpacker. N(t unpack_boolR3t unpack_arrayRt_get_array_unpacker(RZt aunpackerRR\R7((s../common/client.pyR4s(R RRt classmethodR^R4(((s../common/client.pyRVs tRADDictcBs,eZdZedZedZRS(s Derived (dict) RAD Types. c Cs|\}}|o)|dj }|i||pdSn|it|x>|D]6}|ii||t|ii|||tqVWdS(s3 Pack the supplied value into the supplied packer. N(R3RWROtlenRR^tFalse( RZRPR RtstypetktypetvtypeR]tkey((s../common/client.pyR^s    c Cs|\}}|o|i odSt}|i}xHt|D]:} |ii|t|} |ii|t||| s(t _get_unpacker(RZRtR7Ru((Rbs../common/client.pyRa6scCst||iS(s* Return a packer for the supplied object. (tgetattrt_packer(RZRt((s../common/client.pyRsCscCst||iS(s- Return an unpacker for the supplied object. (Rwt _unpacker(RZRt((s../common/client.pyRvHscCsG|o)|dj }|i||pdSn|i||dS(s3 Pack the supplied value into the supplied packer. N(R3RWRs(RZRPR RR]((s../common/client.pyR^Ms    cCs3|o|i}|pdSn|i|S(s, Unpack a value from the supplied unpacker. N(R_R3Rv(RZRGRR7R]((s../common/client.pyR4Ws   N(R RRRxRyR3R&RcRYRaRsRvR^R4(((s../common/client.pyRp!s    t RADObjectcBs\eZdZedZedZedZedZdZdZ RS(s+ An abstract class for all Base RAD Types. cs%|ifd}|S(sh Return a packer suitable for use when packing an array of the supplied object. cs|tS(s1 Return a closure which uses the correct packer. (Rf(R (RtR[(s../common/client.pyRrms(Rs(RZRtRr((R[Rts../common/client.pyRYescs(|ifd}|S(sm Return an unpacker suitable for use when unpacking an array of the supplied object. cstS(s3 Return a closure which uses the correct unpacker. (Rf((RbRtR7(s../common/client.pyRuzs(Rv(RZRtR7Ru((RbRtR7s../common/client.pyRarscCs|iS(s* Return a packer for the supplied object. (R^(RZRt((s../common/client.pyRsscCs|iS(s- Return an unpacker for the supplied object. (R4(RZRt((s../common/client.pyRvscCs2t|t|jo|i|ijStSdS(N(Rt__dict__Rf(R)tother((s../common/client.pyt__eq__scCs|i| S(N(R}(R)R|((s../common/client.pyt__ne__s( R RRRcRYRaRsRvR}R~(((s../common/client.pyRzbs   t RADStructcBs5eZdZedZedZdZRS(s Derived (struct) RAD Types. cCs|o)|dj }|i||pdSnx|iD]}|didj o<|dii|t||d|di|diq:|dii|t||d|diq:WdS(s3 Pack the supplied value into the supplied packer. Nii(R3RWt_fieldsRRR^RwR(RZRPR RR]tattr((s../common/client.pyR^s      c Cs|o|i odS|i|}x|iD]}|didj o?t||d|dii||di|di|q3t||d|dii||di|q3W|S(s, Unpack a value from the supplied unpacker. iiN( R_R3t__new__RRtsetattrRR4R(RZRGRR7RmR((s../common/client.pyR4s  c Csfd|ii}d}x?|iD]4}|d||dt||df7}d}q W|d7}|S(Ns%s(ts %s%s = %ris, t)(t __class__R RRw(R)tbuftseptfield((s../common/client.pyt__repr__s (  (R RRRcR^R4R(((s../common/client.pyRst RADEnumInitcBseZdZdZRS(s; A metaclass to simplify the creation of RAD Enumerations. cCs]ti||||d}x:|dD].}t||||d||d}q'WdS(Nit_slotst_valuesi(RR&R(tmcsR tbasestmydictRmtenum((s../common/client.pyR&s  (R RRR&(((s../common/client.pyRstRADEnumcBsYeZdZdZedZedZdZdZdZ dZ RS(s Enumerated (enum) RAD Types. cCs5tt|i|ii||_||_dS(N(R%RR&Rtindext_indexRq(R)R ((s../common/client.pyR&scCsD|o)|dj }|i||pdSn|i|idS(N(R3RWt pack_uintR(RZRPR RR]((s../common/client.pyR^s    cCs=|o|i odS|i}||i|}|S(N(R_R3t unpack_uintR(RZRGRR7tvalRm((s../common/client.pyR4s  cCs,t||io|i|ijStSdS(N(t isinstanceRR{Rf(R)R|((s../common/client.pyR}scCs|i| S(N(R}(R)R|((s../common/client.pyR~scCs|i|ii|iS(N(RRRRq(R)((s../common/client.pyR0scCs0|i|ii|i}d|ii|fS(Ns%s(value = %s)(RRRRqRR (R)R((s../common/client.pyRs( R RRR&RcR^R4R}R~R0R(((s../common/client.pyRs     t RADBooleancBs#eZdZdZdZdZRS(s Boolean (boolean) RAD Type. RWR_cCsG|djott|i|ntt|it|dS(N(R3R%RR&tbool(R)R ((s../common/client.pyR&s (R RRRxRyR&(((s../common/client.pyRst RADIntegercBs#eZdZdZdZdZRS(s Integer (integer) RAD Type. RORCcCsG|djott|i|ntt|it|dS(N(R3R%RR&tint(R)R ((s../common/client.pyR& s (R RRRxRyR&(((s../common/client.pyRst RADUIntegercBs#eZdZdZdZdZRS(s' Unsigned Integer (uinteger) RAD Type. RRcCsG|djott|i|ntt|it|dS(N(R3R%RR&R(R)R ((s../common/client.pyR&s (R RRRxRyR&(((s../common/client.pyRstRADLongcBs#eZdZdZdZdZRS(s Long (long) RAD Type. RNRBcCsG|djott|i|ntt|it|dS(N(R3R%RR&tlong(R)R ((s../common/client.pyR&$s (R RRRxRyR&(((s../common/client.pyRstRADULongcBs#eZdZdZdZdZRS(s! Unsigned Long (ulong) RAD Type. t pack_uhypert unpack_uhypercCsG|djott|i|ntt|it|dS(N(R3R%RR&R(R)R ((s../common/client.pyR&1s (R RRRxRyR&(((s../common/client.pyR+stRADFloatcBs#eZdZdZdZdZRS(s Float (float) RAD Type. t pack_floatt unpack_floatcCsG|djott|i|ntt|it|dS(N(R3R%RR&tfloat(R)R ((s../common/client.pyR&>s (R RRRxRyR&(((s../common/client.pyR8st RADDoublecBs#eZdZdZdZdZRS(s Double (double) RAD Type. t pack_doublet unpack_doublecCsG|djott|i|ntt|it|dS(N(R3R%RR&R(R)R ((s../common/client.pyR&Ks (R RRRxRyR&(((s../common/client.pyREstRADTimecBs5eZdZedZedZdZRS(s Time (time) RAD Type. cCst||dS(N(RU(RZRPR R((s../common/client.pyR^UscCs t|S(N(RK(RZRGRR7((s../common/client.pyR4YscCsJ|djott|i|n tt|iti|dS(N(R3R%RR&RDttime(R)R ((s../common/client.pyR&]s (R RRRcR^R4R&(((s../common/client.pyRRst RADStringcBs#eZdZdZdZdZRS(s String (string) RAD Type. t pack_stringt unpack_stringcCsG|djott|i|ntt|it|dS(N(R3R%RR&tstr(R)R ((s../common/client.pyR&js (R RRRxRyR&(((s../common/client.pyRdst RADOpaquecBs#eZdZdZdZdZRS(s Opaque (opaque) RAD Type. t pack_opaquet unpack_opaquecCsG|djott|i|ntt|it|dS(N(R3R%RR&R(R)R ((s../common/client.pyR&ws (R RRRxRyR&(((s../common/client.pyRqstRADVoidcBs5eZdZedZedZdZRS(s Void RAD Type. cCsdS(N((RZtvpackerR R((s../common/client.pyR^scCsdS(N(R3(RZRRR7((s../common/client.pyR4scCstt|i|dS(N(R%RR&(R)R ((s../common/client.pyR&s(R RRRcR^R4R&(((s../common/client.pyR~st RADSecretcBs#eZdZdZdZdZRS(s Secret (string) RAD Type. RRcCsG|djott|i|ntt|it|dS(N(R3R%RR&R(R)R ((s../common/client.pyR&s (R RRRxRyR&(((s../common/client.pyRscsfd}|S(s. Class decorator. Identifies class stability. cs |_|S(N(t_rad_stability(tklass(t stability(s../common/client.pytinners ((RR((Rs../common/client.pytClassStabilityscsfd}|S(s0 Method decorator. Identifies method stability. cs(_tfd}|S(Ncs ||S(N((targstkwargs(tf(s../common/client.pyt wrapped_fs(RR(RR(R(Rs../common/client.pytwraps ((RR((Rs../common/client.pytMethodStabilityst RADInterfacecBseZdZhZdddddZedZedZdZ dZ dZ dZ d Z d Zd Zd Zd ZRS(s+ Abstract, base class for all RAD objects. icCs||_||_|oC|i|ijo#td|it|fn||_n)t|ih|id6d|i|_|o ||_ n|t i |i|ifRR RRR^Rt get_bufferRt _make_requestRRt_read_responseR4R$R@RR'( R)tmethtresultR*RtmpackerRmt argpackertsertrespRtR6((s../common/client.pyt_invokes:   (    c Cs t}|i|i|i||iiti|i}y~|ii |}|dj o[|i dj o(|i i ||i|i |i}n|i i ||i|i}|SWn>tj o2}t|d||i|if||inXdS(s5 Remotely retrieve a property and return the result. sError getting %s from %s: %dN(RRNRRRRRRRRR3RRR4RR$R@RR'( R)RRR*tppackerRRRtR6((s../common/client.pyt_getter s     c Cs<t}|i|i|i|t}|itjo!|djotd|n|idj o#|i i |||i|in|i i |||i|i |i |i iti|i }y|i i|WnAtj o5}t|d|i|i|if||i nXdS(s Remotely update a property. s0Non-nullable property '%s' cannot be set to NonesError setting %s on %s: %dN(RRNRRRRfR3R>RRR^RRRRRRRR$R@RR'( R)RRR*R RRQRR6((s../common/client.pyt_setters"   # cCs d|iit|ifS(Ns%s(%s)(RR RR(R)((s../common/client.pyR4sN(R RRRR3R&RcR^R4R0RRRRRRRR(((s../common/client.pyRs       "  t _ADRPatterncBsMeZdZdZdZdZdZdZdZdZ RS(sD A RAD ADR pattern class. Base pattern matching class. cCs||_||_||_dS(s Base Pattern class constructor. Arguments: kvs: dictionary key/value pairs pattern: string string representation of this pattern scheme: _Scheme the pattern _Scheme this instance belongs to N(t_kvst_patternt_scheme(R)tkvstpatterntscheme((s../common/client.pyR&?s  cCs|pdS|i|ijS(Ni(R(R)R|((s../common/client.pyt__cmp__RscCs|iS(N(R(R)((s../common/client.pyR0XscCs d|iS(s+ A string representation of this instance. s Pattern: (R(R)((s../common/client.pyR[scCs|iS(N(R(R)((s../common/client.pyt get_pattern_scCs|iS(N(R(R)((s../common/client.pyt get_schemebscCs |i|S(N(R(R)Rj((s../common/client.pyt get_valuees( R RRR&RR0RRRR(((s../common/client.pyR8s      tADRRegexPatterncBs eZdZdZdZRS(s The ADRRegexPattern class serves as a pattern to match object names. An ADRRegexPattern is an "Extended Regular Expression" (ERE) which may be used to match the names of RAD objects. cCscdig}|iD]\}}|d||fq~}tt|i||tidS(s Create a pattern object using the supplied dictionary. Arguments: kvs: dictionary of keys and values the regex pattern Returns: ADRRegexPattern a new ADRRegexPattern t,s%s=%sN(tjointitemsR%RR&R R(R)Rt_[1]tktvR((s../common/client.pyR&qs @cCsXxQ|iD]F}y*ti|i||i|ptSWq tj oq Xq WtS(s Match the pattern object against the supplied name. Arguments: name: ADRName the name to match Returns: Boolean True/false (Rtretmatcht_kvpairsRfRtTrue(R)R Rj((s../common/client.pyRs !  (R RRR&R(((s../common/client.pyRis tADRGlobPatterncBs eZdZdZdZRS(s The ADRGlobPattern class serves as a pattern to match object names. An ADRGlobPattern is an glob style pattern which may be used to match the names of RAD objects. cCscdig}|iD]\}}|d||fq~}tt|i||tidS(s Create a pattern object using the supplied dictionary. Arguments: kvs: dictionary of keys and values the glob pattern Returns: ADRGlobPattern a new ADRGlobPattern Rs%s=%sN(RRR%RR&R R(R)RRRRR((s../common/client.pyR&s @cCsXxQ|iD]F}y*ti|i||i|ptSWq tj oq Xq WtS(s Match the pattern object against the supplied name. Arguments: name: ADRName the name to match Returns: Boolean True/false (RtfnmatchRRfRR(R)R Rj((s../common/client.pyRs !  (R RRR&R(((s../common/client.pyRs RcBskeZdZd d dZdZedZed dZdZ dZ dZ dZ RS( s5 The ADRName class serves as an object name. cCstt|i||_|djo d}n||_||_|djo|i}nt|t p |i }n||_ dS(s Create a Name object using the supplied name and version details. Arguments: name: string representation of name Returns: ADRName a new ADRName iiN(ii( R%RR&RR3RRt_ADRName__proxy_from_strRRRt_proxy(R)tdomaintkvpairsRtversion((s../common/client.pyR&s        c Cs|id}d}g}xi|D]a}|id||ify(|id||i|idfWq tj o q q Xq Wx<|D]4}ytti||SWqtj oqXqWtd|dS( NRtbindingstservers rad.%s.%ss rad.%s.%s_%disCan't locate class: %s(RR( RtappendRRRRwtsystmodulest ValueError(R)t klassnametmodstmodnamestmodtmodname((s../common/client.pyt__proxy_from_strs$    cCs|o)|dj }|i||pdSn|i|i|it|ix2|iD]'}|i||i|i|q`WdS(N(R3RWRRRReR(RZtnpackerR RR]Rj((s../common/client.pyR^s     c Cs|o|i odSh}|i}|i}x6t|D](}|i} |i} | || |i|ijo+|i|ijo|i|ijotStSdS(N(RRRRRRf(R)R|((s../common/client.pyR}s ,cCst|i}|t|id7}|t|id7}x8|iD]-}|t|7}|t|i|7}qGWt|S(Nii(thashRRR(R)thvRj((s../common/client.pyt__hash__s cCse|id}xQt|iD]@\}}|djo|d7}n||d|i|7}qW|S(Nt:iRt=(Rt enumerateR(R)R RmRj((s../common/client.pyR0s   cCs%dt||id|idfS(s+ A string representation of this instance. sName: %s Version: (%s.%s)ii(RR(R)((s../common/client.pyR'sN( R RRR3R&RRcR^R4R}RR0R(((s../common/client.pyRs    cCs\t|do |iiSt|do |iiSt|do |iiS|iSdS(s. Return the stability level of the component. tfgettfsettfdelN(thasattrRRRR(t component((s../common/client.pytrad_get_stability0s   cCsti|iS(s' Return the module version of the obj. (tinspectt getmoduletvers(Rt((s../common/client.pytrad_get_version<s(NRt functoolsRRDRRtrad.encodings.xdrRRt collectionsRRtwarningstfilterwarningstDeprecationWarningt namedtupleRR tobjectR RRRR$R1R8R9R:R;R<R=R>R?R3RRRRRR R!R"R#R,R@RKRURVRdRpRzRRRRRRRRRRRRRRRRRRtPropertyStabilityRRRRRtRADNameRR(((s../common/client.pyt s          !  A10 *           1--j