%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyo

�
��4]c@s2dZddlmZddlZddlmZddlmZddd	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����(tdequeNi(texc(tutilt
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((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.pyR2scswd�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(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

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!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.pyRpscBsYeZdZiZd�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(tvisitor_iteratorR#RtNone(RtobjRtvR ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyttraverse_singlescCst||j�S(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.pyR�scCst||j|j�S(s2traverse and visit the given expression structure.(RR0t
_visitor_dict(RR-((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR�scCsJi}x=t|�D]/}|jd�rt||�||d<qqW|S(Ntvisit_i(tdirt
startswithR#(Rtvisitorstname((sJ/opt/alt/python27/lib64/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.((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pytchain�s	(
RRRR0R/RRRtmemoized_propertyR1tpropertyR+R:(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRws					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((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pytcopy_and_process�scCst||j|j�S(s2traverse and visit the given expression structure.(R
R0R1(RR-((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR�s(RRRR?R(((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/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(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRA�s(RR0(RR-RA((RsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR�s(RRRRAR(((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/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 ((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/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((sJ/opt/alt/python27/lib64/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(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyRS+sN(tsetROR,(R-RGR5((RSRXRRR5sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyR
$scs\i�d�|jdg�D������fd��|dk	rX�||�}n|S(sgclone the given expression structure, allowing element
    replacement by a given replacement function.cSsh|]}t|��qS((RT(t.0R>((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pys	<setcomp>As	RRcs�t|��ks!d|jkr%|S�|�}|dk	rT�jt|��|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(RtcollectionsRR(tRRt__all__ttypeRRtwith_metaclasstobjectRRRRRR	R
RRR
R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.pyt<module>s:		'"7						

Zerion Mini Shell 1.0