Ñò ‰„[Jc@sdZddklZddkZddklZddkZddddd d d d d ddg Zdefd„ƒYZ de fd„ƒYZ de fd„ƒYZ de fd„ƒYZ d e fd„ƒYZd„Zd„Zd„Zd„Zd„Zd„Zd„ZdS(s6Visitor/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/?p=19 . iÿÿÿÿ(tdequeN(tutilt VisitableTypet Visitablet ClauseVisitortCloningVisitortReplacingCloningVisitortiteratetiterate_depthfirstttraverse_usingttraversetcloned_traversetreplacement_traversecBseZdZd„ZRS(syMetaclass which checks for a `__visit_name__` attribute and applies `_compiler_dispatch` method to classes. cs¢|idjo!tt|ƒi|||ƒdS|i}t|tƒo&tid|ƒ‰‡fd†}n d„}||_ tt|ƒi|||ƒdS(NRsvisit_%scsˆ|ƒ||S(N((tselftvisitortkw(tgetter(s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyt_compiler_dispatch1sc[st|d|iƒ||S(Nsvisit_%s(tgetattrt__visit_name__(R RR((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR4s( t__name__tsuperRt__init__Rt isinstancetstrtoperatort attrgetterR(tclstclsnametbasestclsdictt visit_nameR((Rs;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR$s   (Rt __module__t__doc__R(((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyRscBseZdZeZRS(sXBase class for visitable objects, applies the ``VisitableType`` metaclass. (RR R!Rt __metaclass__(((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR;scBsYeZdZhZd„Zd„Zd„Zeid„ƒZ e d„ƒZ d„Z RS(s_Base class for visitor objects which can traverse using the traverse() function. cCsCx<|iD]1}t|d|idƒ}|o ||ƒSq WdS(Nsvisit_%s(t_visitor_iteratorRRtNone(R tobjtvtmeth((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyttraverse_singleKs  cCst||iƒS(sOtraverse the given expression structure, returning an iterator of all elements.(Rt__traverse_options__(R R%((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyRQscCst||i|iƒS(s2traverse and visit the given expression structure.(R R)t _visitor_dict(R R%((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR VscCsLh}x?t|ƒD]1}|idƒot||ƒ||dR?titer(R%R@RAt traversalRBRC((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR­s   cCs?x8|D]0}|i|idƒ}|o||ƒqqW|S(sIvisit the given expression structure using the given iterator of objects.N(tgetRR$(titeratorR%R.ttargetR'((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR ¼s cCstt||ƒ||ƒS(sMtraverse and visit the given expression structure using the default iterator.(R R(R%R@R.((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR ÅscCstt||ƒ||ƒS(sQtraverse and visit the given expression structure using the depth-first iterator.(R R(R%R@R.((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyttraverse_depthfirstÊscsÄtiƒ‰‡fd†}||ƒ}|g}x|o…|iƒ}|ˆjoq3n|id|ƒ|i|idƒ}|o||ƒnx$|i|D]}|i|ƒq¤Wq3W|S(sIclone the given expression structure, allowing modifications by visitors.cs)|ˆjo|iƒˆ|R?(R%R@R.RORARBR'RC((RNs;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR Ïs"     cs»tiƒ‰ti|idgƒƒ‰‡‡‡fd†}||ƒ}|g}xc|o[|iƒ}|ˆjoqTn|id|ƒx$|i|D]}|i|ƒq›WqTW|S(scclone the given expression structure, allowing element replacement by a given replacement function.tstop_oncsNˆ|ƒ}|oˆi|ƒ|S|ˆjo|iƒˆ|R?(R%R@R;RORARBRC((RRRNR;s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyR ês     (R!t collectionsRtret sqlalchemyRRt__all__ttypeRtobjectRRRRRRR R RKR R (((s;/usr/lib/python2.6/site-packages/sqlalchemy/sql/visitors.pyts(      4