V Qc@sdZddlZdd dYZdd dYZdddYZed diZd Zed kr|endS(s?Generic metaclass. XXX This is very much a work in progress. iNtMetaMethodWrappercBseZdZdZRS(cCs%||_||_|jj|_dS(N(tfunctinstt__name__(tselfRR((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyt__init__ s  cOst|j|jf||S(N(tapplyRR(Rtargstkw((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyt__call__s(Rt __module__RR (((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR s t MetaHelpercBs eZeZdZdZRS(cCs ||_dS(N(t__formalclass__(Rt formalclass((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyt__helperinit__scCsy|jj|}WnTtk rly|jjd}Wn ttfk r^t|nX|||SXt|tjkr|S|j||S(Nt__usergetattr__(R t __getattr__tAttributeErrortKeyErrorttypettypest FunctionTypet__methodwrapper__(Rtnametrawtga((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyRs  (RR RRRR(((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR s t MetaClasscBs>eZdZeZdZdZdZdZdZ RS(scA generic metaclass. This can be subclassed to implement various kinds of meta-behavior. icCs[y|d}Wntk r!nX||d<|d=||_||_||_d|_dS(NRRi(RRt __bases__t __realdict__t_MetaClass__inited(RRtbasestdictR((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR4s     cCsiy|j|SWnStk rdx6|jD]+}y|j|SWq)tk rSq)Xq)Wt|nXdS(N(RRRRR(RRtbase((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyRAs  cCs*|js||j|Xs(t __helper__RRRR(RRRRtinit((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR Rs    ( RR t__doc__R R&RRRR#R (((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR(s tMetacCsidtfdY}|GH|}|GH|jdd|fdY}|}|jGH|jGHdS(NtCcBseZdZdZRS(cWs dG|GHdS(Ns__init__, args =((RR((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyRbscSsd|fGHdS(Nsm1(x=%r)((Rtx((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pytm1ds(RR RR,(((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR*as i tDcBseZdZRS(cSs$|d dkrt|nd|S(Nit__s getattr:%s(R(RR((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyRks (RR R(((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyR-js(R)R,tfoot_foo(R*R+R-((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyt_test`s   t__main__(((((R(RRR RR)R1R(((s-/usr/lib64/python2.7/Demo/metaclasses/Meta.pyts  5