Ńņ i'dWc @sĻdZddkZddklZlZddklZddkZddk l Z l Z d„Z d„Z d„Zd „Zd „Zd „Zd „Zhe e i6e e i6ee i6eee iƒe i6ee i6ee i6eee iƒe i6eee iƒe i6eee iƒe i6eee i ƒe i!6eee i"ƒe i#6eee i$ƒe i%6eee i&ƒe i'6eee i(ƒe i)6eee i*ƒe i+6eee i,ƒe i-6eee i.ƒe i/6eee i0ƒe i16eee i2ƒe i36eee i4ƒe i56eee i6ƒe i76eee i8ƒe i96eee i:ƒe i;6eee i<ƒe i=6eee i>ƒe i?6eee i@ƒe iA6eee iBƒe iC6eee iDƒe iE6ZFdS( sŽ Provide thin wrappers around C functions for looking up values in an nvlist. LOOKUP: each key maps to a function with this signature: function(nvlistp, str) -> value value will be the appropriate Python type, e.g. LIST_LOOKUP[DATA_TYPE_BOOLEAN](nvlistp, str) -> bool For C funtions that are of DATA_TYPE *_ARRAY, the value returned is a tuple of the Python type. i’’’’N(tEINVALtENOENT(tpartial(tconsttcfunccCstdƒ‚dS(Ns+can't lookup "DATA_TYPE_UNKNOWN" for nvlist(t RuntimeError(tnvltname((s ../lookup.pytnvl_lookup_unknown/scCstdƒ‚dS(Ns*can't lookup "DATA_TYPE_HRTIME" for nvlist(tNotImplementedError(RR((s ../lookup.pytnvl_lookup_hrtime4scCsĖ|idiƒ}|||ti|ƒƒ}|djoj|tjotd|iƒ‚n|tjot|ƒ‚nt |d|it i |ƒfƒ‚ny |i SWnt j o|SXdS(s<mostly does what is right for any nvlist_lookup_*() functioniis%s(): invalid arguments%s(): %sN(targtypest_type_tCtbyrefRt TypeErrort__name__RtKeyErrortOSErrortoststrerrortvaluetAttributeError(t cfunctionRRRterr((s ../lookup.pyt nvl_scalar8s   ) cCssti||ƒ}|djotS|tjotS|tjotdƒ‚nt|dti |ƒƒ‚dS(Nis)nvlist_lookup_boolean(): invalid argumentsnvlist_lookup_boolean(): %s( Rtnvlist_lookup_booleantTrueRtFalseRRRRR(RRR((s ../lookup.pytnvl_lookup_booleanKs   cCsttti||ƒƒS(N(tboolRRtnvlist_lookup_boolean_value(RR((s ../lookup.pytnvl_lookup_boolean_valueXscCsūtiƒ}|idiƒ}|||ti|ƒti|ƒƒ}|djoj|tjotd|iƒ‚n|tjot |ƒ‚nt |d|it i |ƒfƒ‚nt ƒ}x(t|iƒD]}|i||ƒqÖWt|ƒS(sBmostly does what is right for any nvlist_lookup_*_array() functioniis%s(): invalid arguments%s(): %s(R tc_uintR R RRRRRRRRRtlisttxrangeRtappendttuple(RRRtnelemRRtretltidx((s ../lookup.pyt nvl_array\s '   ) cCs(tti||ƒ}ttt|ƒƒS(N(R)Rtnvlist_lookup_boolean_arrayR%tmapR(RRtret((s ../lookup.pytnvl_lookup_boolean_arrayns(Gt__doc__tctypesR terrnoRRt functoolsRRt libnvpairRRRR RRR R)R-tDATA_TYPE_UNKNOWNtDATA_TYPE_HRTIMEtDATA_TYPE_BOOLEANtnvlist_lookup_doubletDATA_TYPE_DOUBLEtDATA_TYPE_BOOLEAN_VALUEtDATA_TYPE_BOOLEAN_ARRAYtnvlist_lookup_bytetDATA_TYPE_BYTEtnvlist_lookup_byte_arraytDATA_TYPE_BYTE_ARRAYtnvlist_lookup_int8tDATA_TYPE_INT8tnvlist_lookup_int8_arraytDATA_TYPE_INT8_ARRAYtnvlist_lookup_int16tDATA_TYPE_INT16tnvlist_lookup_int16_arraytDATA_TYPE_INT16_ARRAYtnvlist_lookup_int32tDATA_TYPE_INT32tnvlist_lookup_int32_arraytDATA_TYPE_INT32_ARRAYtnvlist_lookup_int64tDATA_TYPE_INT64tnvlist_lookup_int64_arraytDATA_TYPE_INT64_ARRAYtnvlist_lookup_uint8tDATA_TYPE_UINT8tnvlist_lookup_uint8_arraytDATA_TYPE_UINT8_ARRAYtnvlist_lookup_uint16tDATA_TYPE_UINT16tnvlist_lookup_uint16_arraytDATA_TYPE_UINT16_ARRAYtnvlist_lookup_uint32tDATA_TYPE_UINT32tnvlist_lookup_uint32_arraytDATA_TYPE_UINT32_ARRAYtnvlist_lookup_uint64tDATA_TYPE_UINT64tnvlist_lookup_uint64_arraytDATA_TYPE_UINT64_ARRAYtnvlist_lookup_nvlisttDATA_TYPE_NVLISTtnvlist_lookup_nvlist_arraytDATA_TYPE_NVLIST_ARRAYtnvlist_lookup_stringtDATA_TYPE_STRINGtnvlist_lookup_string_arraytDATA_TYPE_STRING_ARRAYtLOOKUP(((s ../lookup.pyt%s€