Ñò †°Ic @sädZddklZddkZddkZyddkZeiƒZWn%ej od„Z e ƒZnXde fd„ƒYZ de fd„ƒYZ d e fd „ƒYZd e fd „ƒYZd e fd„ƒYZdS(sã Declarative objects for FormEncode. Declarative objects have a simple protocol: you can use classes in lieu of instances and they are equivalent, and any keyword arguments you give to the constructor will override those instance variables. (So if a class is received, we'll simply instantiate an instance with no arguments). You can provide a variable __unpackargs__ (a list of strings), and if the constructor is called with non-keyword arguments they will be interpreted as the given keyword arguments. If __unpackargs__ is ('*', name), then all the arguments will be put in a variable by that name. Also, you can define a __classinit__(cls, new_attrs) method, which will be called when the class is created (including subclasses). iÿÿÿÿ(t generatorsNccsd}x|d7}|Vq dS(Nii((ti((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyt_counters tclassinstancemethodcBs#eZdZd„Zdd„ZRS(s÷ Acts like a class method when called from a class, like an instance method when called by an instance. The method should take two arguments, 'self' and 'cls'; one of these will be None depending on how the method was called. cCs ||_dS(N(tfunc(tselfR((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyt__init__-scCst|id|d|ƒS(Ntobjttype(t_methodwrapperR(RRR((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyt__get__0sN(t__name__t __module__t__doc__RtNoneR (((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR%s R cBs#eZd„Zd„Zd„ZRS(cCs||_||_||_dS(N(RRR(RRRR((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR5s  cOsL|idƒ o|idƒ p td‚|i|i|if||ŽS(NRtclssAYou cannot use 'self' or 'cls' arguments to a classinstancemethod(thas_keytAssertionErrorRRR(Rtargstkw((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyt__call__:s%cCsO|idjod|ii|iifSd|ii|ii|ifSdS(Nss(RRRR Rt func_name(R((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyt__repr__@s (R R RRR(((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR 3s  tDeclarativeMetacBseZd„ZRS(cCs'ti||||ƒ}x3|iD](}t||tit||ƒƒƒq"Wtiƒ|_|i dƒo4t |i t ƒ o t|dt |i i ƒƒn|i ||ƒt|ddƒ}|oYxV|D]J}|ii|ƒ}|o+t |tƒ ot||t|ƒƒqÑqÑWn|S(Nt __classinit__t__singletonmethods__(Rt__new__t__mutableattributes__tsetattrtcopytgetattrtcountertnexttdeclarative_countRt isinstanceRt staticmethodtim_funcRt__dict__tgettsingletonmethod(tmetat class_nametbasest new_attrsRtnametnamestmeth((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRKs$ & "(R R R(((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRIsR'cBs#eZdZd„Zdd„ZRS(s» For Declarative subclasses, this decorator will call the method on the cls.singleton() object if called as a class method (or as normal if called as an instance method). cCs ||_dS(N(R(RR((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRdscCsM|djo|iƒ}n|djo |i}nti|i||ƒS(N(Rt singletont __class__tnewtinstancemethodR(RRR((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR gs    N(R R R RRR (((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR']s t DeclarativecBs³eZd Zd ZeZd Zd„Zd„Zd„Z d„Z d„Z e e ƒZ d d„Zd d„Zd d„Ze eƒZd„Zd „ZeeƒZeeƒZRS(cCsdS(N((RR+((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRxsc OsÎ|ioz|iddjoft|iƒdjptd|i‚|id}|i|ƒotd|ƒ‚n|||s<%s %s>t ( R0R R%RRtkeyst _repr_varsRGRH(RRR,RKR-Rtn((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRÑs     cCsQg}|D]/}|idƒ o|djo ||q q ~}|iƒ|S(Nt_R!(t startswithtsort(t dictNamesRLRUR-((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyRTäs ! (((N(R R R5RRt __metaclass__RRRR:RR/t classmethodRRMRARQRRTR#R(((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyR3ns$            (R t __future__RRR1t itertoolstcountRt ImportErrorRtobjectRR RRR'R3(((s:/usr/lib/python2.6/site-packages/formencode/declarative.pyts