ó Û_e[c@s*ddlZddlZddlZddlZddlmZejdfkr[eZne Z e Z e Zd„Zdefd„ƒYZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿNi(tmodelicCs t|gƒS(N(tbytes(tnum((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt st CTypesTypecBseZRS((t__name__t __module__(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR st CTypesDatacBsdeZeZdgZdZd„Zed„ƒZed„ƒZ ed„ƒZ ed„ƒZ ed„ƒZ edd „ƒZ ed „ƒZd „Zd „Zdd „Zd„Zed„ƒZd„Zed„ƒZd„Zed„ƒZd„Zd„ZedƒZedƒZedƒZedƒZedƒZedƒZ d„Z!d„Z"RS(t __weakref__scGstd|jfƒ‚dS(Nscannot instantiate %r(t TypeErrort __class__(tselftargs((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt__init__scCstd|jƒfƒ‚dS(Ns+expected a pointer or array ctype, got '%s'(R t _get_c_name(tclstinit((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_newpscCs t‚dS(N(R (tvalue((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _to_ctypesscGs}y |j}Wn$tk r3td|fƒ‚nX|rm|j|Œ}t||ƒsy|j|ƒ}qyn |jƒ}|S(Nscannot create an instance of %r(t_ctypetAttributeErrorR Rt isinstance(RRtctypetres((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_arg_to_ctypes s   cCs'|dkr|jƒS|j|ƒSdS(N(tNoneR(RR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_create_ctype_obj.s  cCs t‚dS(N(R (t ctypes_value((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _from_ctypes5stcCs|jjd|ƒS(Ns &(t _reftypenametreplace(Rt replace_with((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR9scCs9d|jƒf|_d|jƒf|_d|_dS(Ns CData<%s>tffi(RRt __qualname__R(R((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _fix_class=scCs t‚dS(N(tNotImplementedError(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _get_own_reprCscCsI|dkrdS|dkr=|ddtjtjƒ>7}nd|SdS(NitNULLiis0x%x(tctypestsizeoftc_void_p(R taddress((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _addr_reprFs   !cCs&|jƒ}d|p|jƒ|fS(Ns (R&R(R tc_nametown((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt__repr__Ns cCsN|dkr(td|jƒfƒ‚n"td|jƒ|jƒfƒ‚dS(Nscannot convert %r to an addressscannot convert %r to %r(RR R(R tBClass((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_convert_to_addressRs  cCstj|jƒS(N(R(R)R(R((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _get_sizeZscCstj|jƒS(N(R(R)R(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_get_size_of_instance^scCstd|jƒfƒ‚dS(Nscannot cast to %r(R R(Rtsource((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _cast_fromascCs |jdƒS(N(R1R(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt_cast_to_integerescCstj|jƒS(N(R(t alignmentR(R((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _alignmenthscCstd|jƒƒ‚dS(Ns#cdata %r does not support iteration(R R(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt__iter__lscs+tt|ƒ‰‡fd†}||_|S(Ncs±t|tƒ }t|tƒo,t|tƒ }|rZ|rZˆ|jdƒ|jdƒƒS|sf|rjtSt|tƒr…|j}nt|tƒr |j}nˆ||ƒSdS(N(RtCTypesGenericPrimitiveRR1RtNotImplementedt_value(R tothertv_is_ptrtw_is_ptr(tcmpfunc(s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytcmprs    (tgetattrtoperatort func_name(tnameRA((R@s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _make_cmpps t__eq__t__ne__t__lt__t__le__t__gt__t__ge__cCst|jdƒƒS(N(thashR1R(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt__hash__‹scCstd|fƒ‚dS(Ns string(): %r(R (R tmaxlen((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _to_stringŽsN(#RRRt __metaclass__t __slots__R t classmethodRt staticmethodRRRRRR$R&R,RR/R1R2R3R5R6R8R9RFRGRHRIRJRKRLRNRP(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRs>                 R:cBs eZgZd„Zd„ZRS(cCs t|jƒS(N(RMR<(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRN•scCst|j|jƒƒS(N(treprRR<(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR&˜s(RRRRRNR&(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR:’s tCTypesGenericArraycBs/eZgZed„ƒZd„Zd„ZRS(cCs ||ƒS(N((RR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRŸsccs*x#tt|ƒƒD]}||VqWdS(N(txrangetlen(R ti((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR9£scCs|jtj|jƒƒS(N(R,R(t addressoft_blob(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR&§s(RRRRRSRR9R&(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRVœs tCTypesGenericPtrcBs¤eZddgZeZdZed„ƒZed„ƒZed„ƒZ d„Z d„Z d„Z e Z ed „ƒZed „ƒZed „ƒZd „ZRS( t_addresst _as_ctype_ptrtpointercCs ||ƒS(N((RR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR°scCs}|dkrd}n[t|tƒr3|jƒ}n=t|ttfƒrQ|}ntd|t|ƒjfƒ‚|j |ƒS(Nisbad type for cast to %r: %r( RRRR6tinttlongR ttypeRt_new_pointer_at(RR4R+((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR5´s   cCs4|j|ƒ}||_tj||jƒ|_|S(N(t__new__R]R(tcastRR^(RR+R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRcÁs cCs-y|j|jƒSWntk r(dSXdS(Ns???(R,R]R(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR&Ès cCs|jS(N(R](R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR6ÎscCs t|jƒS(N(tboolR](R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt __nonzero__ÑscCsMt|tƒs+tdt|ƒjƒ‚n|j|ƒ}tj||jƒS(Nsunexpected %s object( RRR RbRR1R(ReR(RRR+((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRÕscCs+tj|tjƒjpd}|j|ƒS(Ni(R(ReR*RRc(Rt ctypes_ptrR+((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRÜscCs"|r|j|ƒj|_ndS(N(Rtcontents(RRhR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _initializeáscCsB||jdfks'|js'|jr.|jStj||ƒSdS(N(R Rt_automatic_castsR]RR1(R R0((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR1æs (RRRRtFalseRktkindRSRR5RcR&R6Rgt__bool__RRRjR1(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR\«s     tCTypesBaseStructOrUnioncBskeZdgZed„ƒZd„Zed„ƒZd„Zed„ƒZed„ƒZ dd„Z RS( R[cCstd|fƒ‚dS(Ns!cannot instantiate opaque type %s(R (RR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRñscCs|jtj|jƒƒS(N(R,R(RZR[(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR&öscCst|j|ƒjS(N(RBRtoffset(Rt fieldname((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt _offsetofùscCs?t|ddƒ|jkr+tj|jƒStj||ƒSdS(Nt_BItem(RBRR R(RZR[RR1(R R0((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR1ýscCs|j|ƒ}||_|S(N(RdR[(Rtctypes_struct_or_unionR ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRs cCs|jS(N(R[(RR((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR scCstj||p|jdƒƒS(Ns &(RR/R(R R-((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR/ sN( RRRRRSRR&RrR1RRRR/(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRoîs   t CTypesBackendcBsøeZiejd6ejd6ejd6ejd6ejd6ejd6ej d6ej d6ej d6ej d 6ej d 6ejd 6ejd 6ejd 6Zx˜d d dddgD]ZejeeƒZeeedde|j}yd|ˆ|fSWntk r9t|ƒSXdS(Ns%d: %s(R<tKeyErrortstr(R R(treverse_mapping(s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR&·s   cs4|j}y ˆ|SWntk r/t|ƒSXdS(N(R<RR(R ROR(R(s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRP¾s    (RRRRRR&RP((RER(s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR³s (RRRåRáRãtreversedR$(R REt enumeratorst enumvaluest CTypesIntR((RERs3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt new_enum_type®s  cCs tjƒS(N(R(t get_errno(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR!ÈscCstj|ƒdS(N(R(t set_errno(R R((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR"ËscCs |j|ƒS(N(RP(R tbRO((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytstringÎscCstdƒ‚dS(Nsbuffer() with ctypes backend(R%(R tbptrtsize((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytbufferÑscCs<t|tƒr|jƒSt|tƒs.t‚|jƒSdS(N(RRR3R¾RåR2(R tcdata_or_BType((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR)Ôs cCst|tƒst‚|jƒS(N(R¾RRåR8(R tBType((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytalignofÛscCs%t|tƒst‚n|j|ƒS(N(R¾RR R(R R)R4((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytnewpßs cCs |j|ƒS(N(R5(R R)R4((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyReäscCs|dkst‚|||ƒS(N(RRå(R R)R4R tonerror((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRçscsï|jdkrFddl}d|jfd„ƒY}i|f|_n|j\‰}|dkr–yˆ||ƒ=Wntk r‘tdƒ‚nXdS‡fd†}|j|j|ƒ|ƒ}||k sÒt‚||fˆ|||ƒ<|S(NiÿÿÿÿtMyRefcBs#eZd„Zd„Zd„ZRS(cSs.|ƒ}||kp-|dk o-||ƒkS(N(R(R R=tmyref((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRGñs  cSs ||k S(N((R R=((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRHõscSs9y |jSWn'tk r4t|ƒƒ|_|jSXdS(N(t_hashRRM(R ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRN÷s   (RRRGRHRN(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR-ðs  sFCan remove destructor only on a object previously returned by ffi.gc()cs5ˆj|dƒ\}}|dk r1||ƒndS(N(NN(tpopR(tktcdatat destructor(t weak_cache(s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytremoves ( t_weakref_cache_refRtweakreftrefRR RettypeofRå(R R2R3R&R7R-R5t new_cdata((R4s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytgcpís     cCs |j|ƒS(N(R(R R)R!((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytgetcnamescCs.t|tƒr|dkr6t|tƒr6|j}nt|tƒsTtdƒ‚n|j|}|tkr|tdƒ‚n||j |ƒfSt|t t fƒrt|t ƒr¿|j }nt|tƒsÝtdƒ‚n|j}|jƒ|}|tjkrt‚n||fStt|ƒƒ‚dS(Nis expected a struct or union ctypesnot supported for bitfieldssexpected an array or ptr ctype(RRR¾R\RsRoR RôRñRrR`RaRVRÐR2R¶R·R˜Rb(R R)RqRRçR¬Rp((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt typeoffsetofs(       cCs t|tƒr0tjt|ƒj|ƒƒ}nŽt|tƒr‹|dksdtt|ƒj tƒ rst dƒ‚nt|ƒj|ƒ}n3t|t ƒr²t|ƒj|ƒ}n t dƒ‚|rþtj tj tj |tj ƒj|ƒt|ƒƒ}n|j|ƒS(Nsunexpected cdata types$expected a (RRoR(R_RbRR\RR¾RsR RVReR*RR(R tBTypePtrR2Rptptr((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt rawaddressof.s !  N(5RRR(R¹tc_shorttc_inttc_longt c_longlongtc_bytetc_ubytetc_ushorttc_uinttc_ulongt c_ulonglongtc_floattc_doubletc_boolRžRR)t_sizeR*tc_size_tR R„R…R‹RŽRŸRÃRÒR×RÚRÝRRR R!R"R$R'R*R+ReRRR6R;RbR9R<R=R@(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyRusx                     š ` u   l e           %  R‡cBs,eZd„Zd„Zd„Zd„ZRS(cCs||_||_dS(N(tbackendRŠ(R RPRŠ((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR Ds cCs.t|j|ƒ}|j|ƒ}||_|S(N(RBRŠRR(R R)REtc_functfuncobj((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt load_functionHs cCsKy|jj|j|ƒ}Wntk r=}t|ƒ‚nX|j|ƒS(N(Rtin_dllRŠRR%R(R R)REt ctypes_objte((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyt read_variableNs cCs\|j|ƒ}|jj|j|ƒ}tjtj|ƒtj|ƒtj|jƒƒdS(N(RRRTRŠR(tmemmoveRZR)(R R)RERtnew_ctypes_objRU((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pytwrite_variableUs  (RRR RSRWRZ(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyR‡Bs   (R(t ctypes.utilRCR¶RRt version_infoRœR•RRâR`RaR»RWRbRtobjectRR:RVR\RoRuR‡(((s3/tmp/pip-install-KP2Jbq/cffi/cffi/backend_ctypes.pyts$0  ƒ C#ÿÿÿ4