mς ‘γΈEc@sΖdZdklZdklZlZlZdklZlZdk l Z dk l Z l Z dk lZdklZd„Zd „Zd „ZeeƒZeeƒZd efd „ƒYZd S(s”Marker interfaces adapter. Allows for arbitrary application of marker interfaces to objects. $Id: marker.py 67820 2006-05-02 09:21:45Z philikon $ (sSet(s implementss implementedBys providedBy(sdirectlyProvidessdirectlyProvidedBy(s IInterface(s getInterfacesinterfaceToName(ssearchInterface(sIMarkerInterfacescs‡d†}|S(Ncs0t|tƒot||ƒ}nˆ||ƒS(N(t isinstancet interfacetstrt getInterfacetobtf(RR(R(t=/data/zmath/zope/lib/python/Products/Five/utilities/marker.pytwrappers(R(RR((RRtinterfaceStringChecks cCst|t|ƒ|ƒdS(N(tdirectlyProvidesRtdirectlyProvidedByR(RR((Rtmark%scCst|t|ƒ|ƒdS(N(R RR R(RR((Rterase(stMarkerInterfacesAdaptercBs₯tZeeƒeeƒZeeƒZd„Zd„Zd„Z d„Z d„Z d„Z d„Z d„Zd „Zd „Zffd „Zd „Zd „ZRS(NcCs ||_dS(N(tcontexttself(RR((Rt__init__6scCs+g}|D]}|t|i|ƒq ~S(N(t_[1]tseqtdottedRRR(RRRR((RtdottedToInterfaces9scCs t|iƒS(N(R RR(R((RtgetDirectlyProvided<scCs|i|iƒƒS(N(Rt_getInterfaceNamesR(R((RtgetDirectlyProvidedNames?scCsξg}tt|iƒƒ}g}xΐ|oΈ|iƒ}|i |ƒx<|i D]1}||jo||jo|i |ƒqNqNW|i |ƒ}x@|D]8}||jo%|i|iƒ o|i |ƒq™q™W||7}q$Wt|ƒS(N(tresultstlistt providedByRRttodotdonetpopRtappendt __bases__tbaset_getDirectMarkersOftmarkersttuple(RRR"RR RR((RtgetAvailableInterfacesBs$   !cCs#|i|iƒƒ}|iƒ|S(N(RRR$tnamestsort(RR%((RtgetAvailableInterfaceNamesTs cCstt|iiƒƒS(N(R#t implementedByRRt __class__(R((Rt getInterfacesYscCs|i|iƒƒS(N(RRR*(R((RtgetInterfaceNames\scCs t|iƒS(N(RRR(R((Rt getProvided_scCs|i|iƒƒS(N(RRR,(R((RtgetProvidedNamesbscCs΄|iƒ}t|ƒo?g}t|ƒt|ƒ@D]}|t|i |ƒq4~n|i ƒ}t|ƒo?g}t|ƒt|ƒ@D]}|t |i |ƒqŒ~ndS(sJCurrently update adds and then removes, rendering duplicate null. N(RR$t marker_ifacestlentaddRtSetRR RRt direct_ifacestremoveR (RR0R3RRR2R.((Rtupdatees  ?  cCs(g}|D]}|t||ƒq ~S(N(Rt interfacestifacetinterfaceToNameR(RR5RR6((RRrscCsƒg}tdd|ƒ}xT|D]L}ti|ƒpqn||ijo|i ƒ o|i |ƒqqW|i ƒt |ƒS(sEGet empty interfaces directly inheriting from the given one. R N( RtsearchInterfacetNoneR R5Rt IInterfaceRRR%RR&R#(RR R5RR((RR!us (t__name__t __module__t implementstIMarkerInterfacest staticmethodR R RRRRR$R'R*R+R,R-R4RR!(((RR /s               N(t__doc__tsetsR1tzope.interfaceR=R(RR R tzope.interface.interfacesR:tzope.component.interfaceRR7R8R5R>RR R tobjectR (R=R7R(R1RR R R R R:R>RRR8R ((Rt?s