ó i'dWc@słdZddlZddlmZddlZddlmZmZd„Z d„Z d„Z d„Z d „Z d „Zie ej6e ej6d „ej6ee ejƒej6e ej6eej6ee ejƒej6ee ejƒej6ee ejƒej6ee ejƒej6ee ejƒej6ee ej ƒej!6ee ej"ƒej#6ee ej$ƒej%6ee ej&ƒej'6ee ej(ƒej)6ee ej*ƒej+6ee ej,ƒej-6ee ej.ƒej/6ee ej0ƒej16ee ej2ƒej36ee ej4ƒej56ee ej6ƒej76ee ej8ƒej96ee ej:ƒej;6ee ej<ƒej=6ee ej>ƒej?6ee ej@ƒejA6ZBdS( s Provide thin wrappers around C functions for retrieving values from an nvpairp VALUE: each key maps to a function with this signature: function(nvpairp) -> value value will be the appropriate Python type, e.g. VALUE[DATA_TYPE_BOOLEAN](nvpairp) -> bool For C funtions that are of DATA_TYPE *_ARRAY, the value returned is a tuple of the Python type. i˙˙˙˙N(tpartial(tcfunctconstcCstdƒ‚dS(Ns+nvpairp "DATA_TYPE_UNKNOWN" can't get vaule(t RuntimeError(tnvp((s ../value.pytnvp_value_unknown-scCstdƒ‚dS(Ns*nvpairp "DATA_TYPE_HRTIME" not implemented(tNotImplementedError(R((s ../value.pytnvp_value_hrtime3scCs}|jdjƒ}||tj|ƒƒ}|dkr_t|d|jtj|ƒfƒ‚nt|dƒru|j S|SdS(s;mostly does what is right for any nvpair_value_*() functioniis%s(): %stvalueN( targtypest_type_tCtbyreftOSErrort__name__toststrerrorthasattrR(t cfunctionRRterr((s ../value.pyt nvp_scalar7s (cCstttj|ƒƒS(s$nvp_value_boolean_value(nvp) -> bool(tboolRRtnvpair_value_boolean_value(R((s ../value.pytnvp_value_boolean_valueEscCsľtjƒ}|jdjƒ}||tj|ƒtj|ƒƒ}|dkrwt|d|jtj|ƒfƒ‚nt ƒ}x(t |j ƒD]}|j ||ƒqWt |ƒS(sK mostly does what is right for any nvpair_value_*_array() function iis%s(): %s(R tc_uintR R R R RRRtlisttxrangeRtappendttuple(RRtnelemtpvalueRtrlisttidx((s ../value.pyt nvp_arrayJs $ ( cCs%ttj|ƒ}ttt|ƒƒS(s)value_boolean_array(nvp) -> tuple of bool(R!Rtnvpair_value_boolean_arrayRtmapR(Rtret((s ../value.pytnvp_value_boolean_array[scCstS(N(tTrue(R((s ../value.pytds(Ct__doc__tctypesR t functoolsRRt libnvpairRRRRRRR!R%tDATA_TYPE_UNKNOWNtDATA_TYPE_HRTIMEtDATA_TYPE_BOOLEANtnvpair_value_doubletDATA_TYPE_DOUBLEtDATA_TYPE_BOOLEAN_VALUEtDATA_TYPE_BOOLEAN_ARRAYtnvpair_value_bytetDATA_TYPE_BYTEtnvpair_value_byte_arraytDATA_TYPE_BYTE_ARRAYtnvpair_value_int8tDATA_TYPE_INT8tnvpair_value_int8_arraytDATA_TYPE_INT8_ARRAYtnvpair_value_int16tDATA_TYPE_INT16tnvpair_value_int16_arraytDATA_TYPE_INT16_ARRAYtnvpair_value_int32tDATA_TYPE_INT32tnvpair_value_int32_arraytDATA_TYPE_INT32_ARRAYtnvpair_value_int64tDATA_TYPE_INT64tnvpair_value_int64_arraytDATA_TYPE_INT64_ARRAYtnvpair_value_uint8tDATA_TYPE_UINT8tnvpair_value_uint8_arraytDATA_TYPE_UINT8_ARRAYtnvpair_value_uint16tDATA_TYPE_UINT16tnvpair_value_uint16_arraytDATA_TYPE_UINT16_ARRAYtnvpair_value_uint32tDATA_TYPE_UINT32tnvpair_value_uint32_arraytDATA_TYPE_UINT32_ARRAYtnvpair_value_uint64tDATA_TYPE_UINT64tnvpair_value_uint64_arraytDATA_TYPE_UINT64_ARRAYtnvpair_value_stringtDATA_TYPE_STRINGtnvpair_value_string_arraytDATA_TYPE_STRING_ARRAYtnvpair_value_nvlisttDATA_TYPE_NVLISTtnvpair_value_nvlist_arraytDATA_TYPE_NVLIST_ARRAYtVALUE(((s ../value.pyt%s|