mò "á¸Ec@sdZdkZdkZdkZeiideiƒƒdklZdk l Z dk l Z dk lZeidƒZeidƒZeid ƒZd d „Zd „Zdhd„Zd„Zd„Zedjo&x#eid D]ZeeƒqìWndS(s[ Generate method skeletins for intefaces. Usage: python pyskel.py dotted_name Example: cd lib/python python Interface/pyskel.py Zope2.App.Security.IRoleService.IRoleService The dotted name is the module name and interface object name connected with a dot. Revision information: $Id: pyskel.py 40218 2005-11-18 14:39:19Z andreasjung $ Ni(s isInstance(s ModuleType(sMethod(s Attributes#\s*class\s+([a-zA-Z_][a-zA-Z0-9_]*)s!\s*def\s+([a-zA-Z_][a-zA-Z0-9_]*)s+\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*Attributeic CsWd|i|if} t|iƒi}|idƒo|d }ntt |ƒƒ}t ||ƒ}|o|oHdGHdG| GHnx–|D]Ž\}}t|tƒoK|iƒdd!}|od|}nd}Hd ||fGHd | GHqt|tƒoHd | GHd |GHqqWx/|iD]$}|idjot|ƒq+q+WdS(Ns%s.%stpyciÿÿÿÿs* ######################################s # from:isself, %stselfs def %s(%s):s 'See %s's # See %ss %s = Nonet Interface(R(tifacet __module__t__name__tnametresolvet__file__tfiletendswitht guessOrdertopentordertgetAttributesInOrdertnamesAndDescriptionst print_ifacetanametadest isInstancetMethodtgetSignatureStringtsigt Attributet __bases__tbasetrskel( RRRRRR RRR R((t//data/zmath/zope/lib/python/Interface/pyskel.pyR.s8     cCst|ƒ}|i}|idƒo|d}nd|i|ifGHHd|GHHdG|iGHHdGHdGHdG|GHt|d ƒHdGHdGHdS( NtIisfrom %s import %ss class %s:s __implements__ = s@ ############################################################s* # Implementation methods for interfaces #i(RRRRt class_namet startswithRR(RRR((RtskelNs"      t__doc__c CsÑd|jp|idƒoÃ|idƒptiƒ} xptidD]]}|djoJ| i|ƒo:tii| t |ƒd|ƒ}tii |ƒ}PqGqGWn|idƒo|d }n|i ddƒ}n|d djod|}n|ddjo|d }d}nd }|i dƒ}|d}di|d ƒ} xtt| |||ƒ}yt||ƒ}Wntj on%X| pt|ƒtj o|Sn| d|7} qYWdS( Nt/s.pyitiýÿÿÿt.t ZopeProductsiÿÿÿÿi(RR Rtostgetcwdtcwdtsystpathtjointlentnormpathtreplacetrepeattsplittnamestlasttmodt __import__t_globalst_sillytmtgetattrtatAttributeErrorttypet ModuleType( RR5R4R8R.R1R6R0R)R'R2((RRds> #    cCsòh}|iƒ}d}xÓ|D]Ë}ti|ƒ}|o!|i ƒo|i ƒd}qx‹t i|ƒt i|ƒfD]k}|o^|i ƒoQ|i ƒd}|i|ƒ}|djog}|||R@R RH((RR ‘s$  cCs·|i|iƒ}|djo|iiƒSn„g}x`|iƒD]R\}}||jo#|i |i |ƒ||fƒqC|i d||fƒqCW|i ƒtd„|ƒSdS(NiŸ†cCs|dS(Ni(titem(RJ((Rt·s(R RGt interfaceRRHR?t__dict__titemsRtkeytvalueRItindextsorttmap(RLR RNRPRORH((RR§s   # t__main__(s__doc__(R R(R%treR)tinsertR&t_objectRttypesR;tInterface.MethodRtInterface.AttributeRtcompileRARDRERRRR RRtargvR8(R8RERRRARR RDR(RURR;RR%RR((Rt?s$     -