ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c @s2dZddlmZddlZddlmZddlmZddd d d d d dddddg ZdefdYZ dZ dej e e fdYZ d e fdYZd efdYZd efdYZdZdZdZdZdZdZdZdS( sOVisitor/traversal interface and library functions. SQLAlchemy schema and expression constructs rely on a Python-centric version of the classic "visitor" pattern as the primary way in which they apply functionality. The most common use of this pattern is statement compilation, where individual expression classes match up to rendering methods that produce a string result. Beyond this, the visitor system is also used to inspect expressions for various information and patterns, as well as for usage in some kinds of expression transformation. Other kinds of transformation use a non-visitor traversal system. For many examples of how the visit system is used, see the sqlalchemy.sql.util and the sqlalchemy.sql.compiler modules. For an introduction to clause adaption, see http://techspot.zzzeek.org/2008/01/23/expression-transformations/ i(tdequeNi(texc(tutilt VisitableTypet Visitablet ClauseVisitortCloningVisitortReplacingCloningVisitortiteratetiterate_depthfirstttraverse_usingttraversettraverse_depthfirsttcloned_traversetreplacement_traversecBseZdZdZRS(seMetaclass which assigns a `_compiler_dispatch` method to classes having a `__visit_name__` attribute. The _compiler_dispatch attribute becomes an instance method which looks approximately like the following:: def _compiler_dispatch (self, visitor, **kw): '''Look for an attribute named "visit_" + self.__visit_name__ on the visitor, and call it with the same kw params.''' visit_attr = 'visit_%s' % self.__visit_name__ return getattr(visitor, visit_attr)(self, **kw) Classes having no __visit_name__ attribute will remain unaffected. cCsH|dkr(t|dr(t|ntt|j|||dS(NRt__visit_name__(thasattrt_generate_dispatchtsuperRt__init__(tclstclsnametbasestclsdict((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRBs (t__name__t __module__t__doc__R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR2scswdjkrsj}t|trOtjd|fd}nfd}d|_|_ndS(sYReturn an optimized visit dispatch function for the cls for use by the compiler. Rsvisit_%scsGy|}Wn#tk r5tj|nX|||SdS(N(tAttributeErrorRtUnsupportedCompilationError(tselftvisitortkwtmeth(Rtgetter(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyt_compiler_dispatchUs  csWd|j}yt||}Wn#tk rEtj|nX|||SdS(Nsvisit_%s(RtgetattrRRR(RRRt visit_attrR (R(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR"as   sLook for an attribute named "visit_" + self.__visit_name__ on the visitor, and call it with the same kw params. N(t__dict__Rt isinstancetstrtoperatort attrgetterRR"(Rt visit_nameR"((RR!sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRIs   cBseZdZRS(sTBase class for visitable objects, applies the ``VisitableType`` metaclass. (RRR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRpscBsYeZdZiZdZdZdZejdZ e dZ dZ RS(sZBase class for visitor objects which can traverse using the traverse() function. cKsDx=|jD]2}t|d|jd}|r |||Sq WdS(Nsvisit_%s(tvisitor_iteratorR#RtNone(RtobjRtvR ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyttraverse_singlescCst||jS(satraverse the given expression structure, returning an iterator of all elements. (Rt__traverse_options__(RR-((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRscCst||j|jS(s2traverse and visit the given expression structure.(R R0t _visitor_dict(RR-((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR scCsJi}x=t|D]/}|jdrt||||d((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pys As RRcst|ks!d|jkr%|S|}|dk rTjt||S|kr|j|<}|jd|n|SdS(Ntno_replacement_traverseRS(RTt _annotationsR,taddRURV(R@RRW(RSRXRARR(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRSCs   N(ROR,(R-RGRA((RSRXRARRsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR<s  (Rt collectionsRR(tRRt__all__ttypeRRtwith_metaclasstobjectRRRRRR R R R R R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyts:   '"7