Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
‹EYc@s2dZddlmZddlmZddlZddlmZddd	d
ddd
dddddgZdefd„ƒYZ	d„Z
deje	eƒfd„ƒYZ
d	efd„ƒYZd
efd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„Zd„Zd„Zd„ZdS( 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ÿÿÿÿ(tdequei(tutilN(texct
VisitableTypet	Visitablet
ClauseVisitortCloningVisitortReplacingCloningVisitortiteratetiterate_depthfirstttraverse_usingttraversettraverse_depthfirsttcloned_traversetreplacement_traversecBseZdZd„ZRS(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|dƒr(t|ƒntt|ƒj|||ƒdS(NRt__visit_name__(thasattrt_generate_dispatchtsuperRt__init__(tclstclsnametbasestclsdict((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR7s
(t__name__t
__module__t__doc__R(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR'scswdˆjkrsˆj}t|tƒrOtjd|ƒ‰‡‡fd†}n‡fd†}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(sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyt_compiler_dispatchKs

csWd|j}yt||ƒ}Wn#tk
rEtj|ˆƒ‚nX|||SdS(Nsvisit_%s(RtgetattrRRR(RRRt
visit_attrR (R(sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR"Vs

sˆLook 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!sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR?s		cBseZdZRS(sTBase class for visitable objects, applies the
    ``VisitableType`` metaclass.

    (RRR(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRfscBsYeZdZiZd„Zd„Zd„Zejd„ƒZ	e
d„ƒZd„ZRS(sZBase class for visitor objects which can traverse using
    the traverse() function.

    cKsDx=|jD]2}t|d|jdƒ}|r
|||Sq
WdS(Nsvisit_%s(t_visitor_iteratorR#RtNone(RtobjRtvR ((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyttraverse_singleuscCst||jƒS(satraverse the given expression structure, returning an iterator
        of all elements.

        (Rt__traverse_options__(RR-((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR{scCst||j|jƒS(s2traverse and visit the given expression structure.(RR0t
_visitor_dict(RR-((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR‚scCsJi}x=t|ƒD]/}|jdƒrt||ƒ||d<qqW|S(Ntvisit_i(tdirt
startswithR#(Rtvisitorstname((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR1‡s
ccs.|}x!|r)|Vt|ddƒ}q	WdS(s8iterate through this visitor and each 'chained' visitor.t_nextN(R#R,(RR.((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR+s	cCs t|jƒd}||_|S(s‘'chain' an additional ClauseVisitor onto this ClauseVisitor.

        the chained visitor will receive all visit events after this one.

        iÿÿÿÿ(tlistR+R7(RRttail((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pytchain™s	(
RRRR0R/RRRtmemoized_propertyR1tpropertyR+R:(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRms					cBs eZdZd„Zd„ZRS(saBase class for visitor objects which can traverse using
    the cloned_traverse() function.

    cCs g|D]}|j|ƒ^qS(s`Apply cloned traversal to the given list of elements, and return
        the new list.

        (R(Rtlist_tx((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pytcopy_and_processªscCst||j|jƒS(s2traverse and visit the given expression structure.(R
R0R1(RR-((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR±s(RRRR?R(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR¤s	cBs eZdZd„Zd„ZRS(sfBase class for visitor objects which can traverse using
    the replacement_traverse() function.

    cCsdS(sreceive pre-copied elements during a cloning traversal.

        If the method returns a new element, the element is used
        instead of creating a simple copy of the element.  Traversal
        will halt on the newly returned element if it is re-encountered.
        N(R,(Rtelem((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pytreplace¾scs"‡fd†}t|ˆj|ƒS(s2traverse and visit the given expression structure.cs7x0ˆjD]%}|j|ƒ}|dk	r
|Sq
WdS(N(R+RAR,(R@R.te(R(sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRAÊs(RR0(RR-RA((RsL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRÇs(RRRRAR(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR¸s		cCs‹|j|}|s|gStƒ}t|gƒ}xJ|r€|jƒ}|j|ƒx$|j|D]}|j|ƒqfWq7Wt|ƒS(swtraverse the given expression structure, returning an iterator.

    traversal is configured to be breadth-first.

    (tget_childrenRtpoplefttappendtiter(R-toptstchildrent	traversaltstacktttc((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRÒs		
cCs‹|j|}|s|gSt|gƒ}tƒ}xJ|r€|jƒ}|j|ƒx$|j|D]}|j|ƒqfWq7Wt|ƒS(sutraverse the given expression structure, returning an iterator.

    traversal is configured to be depth-first.

    (RCRtpopt
appendleftRERF(R-RGRHRJRIRKRL((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR	çs		
cCs=x6|D].}|j|jdƒ}|r||ƒqqW|S(sSvisit the given expression structure using the given iterator of
    objects.

    N(tgetRR,(titeratorR-R5ttargetR ((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR
üs

cCstt||ƒ||ƒS(sXtraverse and visit the given expression structure using the default
     iterator.

    (R
R(R-RGR5((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRscCstt||ƒ||ƒS(s[traverse and visit the given expression structure using the
    depth-first iterator.

    (R
R	(R-RGR5((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRscsUi‰t|jdgƒƒ‰‡‡‡‡fd†‰|dk	rQˆ|ƒ}n|S(sMclone the given expression structure, allowing
    modifications by visitors.tstop_oncs‰|ˆkr|St|ƒˆkrw|jƒˆt|ƒ<}|jdˆƒˆj|jdƒ}|rw||ƒqwnˆt|ƒSdS(Ntclone(tidt_clonet_copy_internalsRORR,(R@tnewelemR (RStclonedRRR5(sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRSsN(tsetROR,(R-RGR5((RSRXRRR5sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR
scsqi‰tg|jdgƒD]}t|ƒ^qƒ‰‡‡‡‡fd†‰|dk	rmˆ||}n|S(sgclone the given expression structure, allowing element
    replacement by a given replacement function.RRcs–t|ƒˆks!d|jkr%|Sˆ|ƒ}|dk	rTˆjt|ƒƒ|S|ˆkrŠ|jƒˆ|<}|jdˆ|nˆ|SdS(Ntno_replacement_traverseRS(RTt_annotationsR,taddRURV(R@RRW(RSRXRARR(sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyRS7sN(RYRORTR,(R-RGRAR>((RSRXRARRsL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyR0s1(RtcollectionsRtRR(Rt__all__ttypeRRtwith_metaclasstobjectRRRRRR	R
RRR
R(((sL/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/visitors.pyt<module>s,				'"7