mς #αΈEc@s¬dZdklZdkZdklZlZdklZdklZdk Z dk l Z dk l Z de fd „ƒYZd klZlZlZd klZdS( sxInterface object implementation Revision information: $Id: _InterfaceClass.py 40218 2005-11-18 14:39:19Z andreasjung $ (s currentframeN(sMethods fromFunction(s Attribute(s FunctionType(sElement(s isInstancet InterfacecBsΆtZdZfeeed„Zd„Zdd„Zd„Zd„Zd„Z dd „Z dd „Z d „Z ed „Z d „Zd„Zd„Zd„Zd„Zd„ZRS(s4Prototype (scarecrow) Interfaces Implementation c CsΡ|djoi|dj o%|idƒo|d}|d=qvytƒiid}Wqvttfj oqvXn||_x+|D]#}t |t ƒp td‚q†q†W||_|djo h}n|idƒo&|djo|d}n|d=n|dj o ||_n d|_ti|||ƒxˆ|iƒD]z\}}t |tƒo$||_|ip ||_qΐqFt|tƒot||ƒ|||iD]3}||jodSn|i|ƒodSq'q'WdS(s*Does an interface extend another? iiN(tstrictR totherRRtextends(R R$R#R((R!R%Xs   cCs"||jodSn|i|ƒS(s#Same interface or extends? iN(R R$R%(R R$((R!tisEqualOrExtendedBycs cCs:t|ƒ}|dj ot|||i|iƒSndS(s7Does the given object implement the interface? iN(t getImplementstobjecttiRtvisitImplementsR R&t _getInterface(R R(R)((R!tisImplementedByjs   cCs:t|ƒ}|dj ot|||i|iƒSndS(sADo instances of the given class implement the interface? iN(tgetImplementsOfInstancestklassR)RR*R R&R+(R R.R)((R!tisImplementedByInstancesOfss   icCs„|p|iiƒSnh}x!|iiƒD]}d||Return a defered class corresponding to the interface t _deferredsclass %s: passN(thasattrR R;R.Rt _Interface__dt__dict__(R R.((R!tdeferred±s   cCsdS(s- Retrieve a named interface. N(R(R tobR((R!R+ΐscCstxL|iiƒD];\}}t|tƒo|i|ƒ o|||(R RRRtmt __class__tid(R RDR((R!t__repr__Ξs   cCs|iS(N(R R(R ((R!t __reduce__ΥscCs t|ƒS(s  interface instances need to be hashable, and inheriting from extensionclass makes instances unhashable unless we declare a __hash__ method hereN(RFR (R ((R!t__hash__Ψs(RRRRRR"R%R&R,R/R4R6R8R7R?R+R=RGRHRI(((R!Rs" /         (sgetImplementsOfInstancessvisitImplementss getImplements(sinstancesOfObjectImplements(RtinspectRtsysRARRttypesRRt_ElementRt_objectRRt ImplementsR-R*R'tinstancesOfObjectImplements(R*R-RRRRKRRPRRRRARR'((R!t?s       Β