o
    y¬´\Ùb  ã                   @   s:  d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# e#j$ %ej&d¡Z'dd „ Z(d!d"„ Z)	#	#	#	#	#dLd$d%„Z*d&d'„ Z+d(d)„ Z,d*d+„ Z-d,d-„ Z.d.d/„ Z/dMd1d2„Z0d3d4„ Z1d5d6„ Z2d7d8„ Z3G d9d:„ d:e4ƒZ5G d;d<„ d<e5ƒZ6G d=d>„ d>e5ƒZ7d?d@„ Z8dNdBdC„Z9dDdE„ Z:	A	A	#dOdFdG„Z;G dHdI„ dIej<ƒZ=G dJdK„ dKe=ƒZ>dAS )Pz;High level utilities which build upon other modules here.

é    )Údeque)Úchainé   )Ú	operators)Úvisitors)Ú_deep_annotate)Ú_deep_deannotate)Ú_shallow_annotate)Ú_from_objects)Ú	ColumnSet)Úsort_tables)Ú_find_columns)Ú_label_reference)Ú_textual_label_reference)ÚBindParameter)ÚColumnClause)ÚColumnElement)ÚNull)ÚUnaryExpression)ÚColumn)Ú
FromClause)ÚFromGrouping)ÚJoin)ÚScalarSelect)Ú
SelectBaseé   )Úexc)Úutilz.sql.util.join_conditionc                 C   sF   t t|ƒƒ}t| ƒD ]\}}|D ]}| |¡r||f    S qq
dS )a”  Given a list of FROM clauses and a selectable,
    return the first index and element from the list of
    clauses which can be joined against the selectable.  returns
    None, None if no match is found.

    e.g.::

        clause1 = table1.join(table2)
        clause2 = table4.join(table5)

        join_to = table2.join(table3)

        find_join_source([clause1, clause2], join_to) == clause1

    )NN)Úlistr
   Ú	enumerateÚis_derived_from)ÚclausesÚjoin_toÚselectablesÚiÚfÚs© r'   úE/var/www/html/env/lib/python3.10/site-packages/sqlalchemy/sql/util.pyÚfind_join_source.   s   
ÿÿr)   c                    s$   g ‰‡ ‡‡fdd„‰t ˆ|ƒƒ dS )aý  Produce a traversal of the given expression, delivering
    column comparisons to the given function.

    The function is of the form::

        def my_fn(binary, left, right)

    For each binary expression located which has a
    comparison operator, the product of "left" and
    "right" will be delivered to that function,
    in terms of that binary.

    Hence an expression like::

        and_(
            (a + b) == q + func.sum(e + f),
            j == r
        )

    would have the traversal::

        a <eq> q
        a <eq> e
        a <eq> f
        b <eq> q
        b <eq> e
        b <eq> f
        j <eq> r

    That is, every combination of "left" and
    "right" that doesn't further contain
    a binary comparison is passed as pairs.

    c                 3   sÂ   � t | tƒr| V  d S | jdkrFt | j¡rFˆ d| ¡ ˆ| jƒD ]}ˆ| jƒD ]
}ˆ ˆd ||ƒ q(q!ˆ 	d¡ |  
¡ D ]}ˆ|ƒ q=d S t | tƒrN| V  |  
¡ D ]}ˆ|ƒD ]}|V  qXqRd S )NÚbinaryr   )Ú
isinstancer   Ú__visit_name__r   Úis_comparisonÚoperatorÚinsertÚleftÚrightÚpopÚget_childrenr   )ÚelementÚlÚrÚelemÚe©ÚfnÚstackÚvisitr'   r(   r<   m   s,   €

ÿÿ

ÿ
ÿÿz#visit_binary_product.<locals>.visitN)r   )r:   Úexprr'   r9   r(   Úvisit_binary_productH   s   #r>   Fc                    s–   g ‰ i }|rˆ j  |d< |d< |rˆ j |d< |rˆ j |d< |r/‡ fdd„ |d<  |d< |d	< |r;‡ fd
d„}||d< ˆ j |d< t | ddi|¡ ˆ S )z1locate Table objects within the given expression.ÚselectÚcompound_selectÚjoinÚaliasc                    s   ˆ   | j¡S ©N©ÚappendÚtable)Úent©Útablesr'   r(   Ú<lambda>Ÿ   s    zfind_tables.<locals>.<lambda>r/   ÚupdateÚdeletec                    ó   ˆ   | j¡ d S rC   rD   )ÚcolumnrH   r'   r(   Úvisit_column£   ó   z!find_tables.<locals>.visit_columnrN   rF   Úcolumn_collectionsF)rE   r   Útraverse)ÚclauseÚcheck_columnsÚinclude_aliasesÚinclude_joinsÚinclude_selectsÚinclude_crudÚ	_visitorsrO   r'   rH   r(   Úfind_tables†   s&   



þÿ
rZ   c                 C   sœ   t  ¡ }g }t| gƒ}|rL| ¡ }t|tƒr>t|tƒr!t |j	¡s>t|t
ƒr)|j}t|tƒr/q||vr=| |¡ | |¡ n| ¡ D ]}| |¡ qB|s|S )zqBreak up an 'order by' expression into individual column-expressions,
    without DESC/ASC/NULLS FIRST/NULLS LAST)r   Ú
column_setr   Úpopleftr+   r   r   r   Úis_ordering_modifierÚmodifierr   r4   r   ÚaddrE   r3   )rS   ÚcolsÚresultr;   ÚtÚcr'   r'   r(   Úunwrap_order_by®   s,   

ÿ
þ



€ñrd   c                 C   s   dd„ }t  | i |¡S )Nc                 S   s   t | ttfƒr
| jS d S rC   )r+   r   r   r4   )r7   r'   r'   r(   ÚreplaceÉ   s   ÿz'unwrap_label_reference.<locals>.replace)r   Úreplacement_traverse)r4   re   r'   r'   r(   Úunwrap_label_referenceÈ   s   rg   c                    s2   t dd„ | D ƒƒ‰ ‡ fdd„tdd„ |D ƒŽ D ƒS )zÜGiven the columns clause and ORDER BY of a selectable,
    return a list of column expressions that can be added to the collist
    corresponding to the ORDER BY, without repeating those already
    in the collist.

    c                 S   s    g | ]}|j d ur|jn|‘qS rC   )Ú_order_by_label_elementr4   ©Ú.0Úcolr'   r'   r(   Ú
<listcomp>Ø   s    ÿÿz4expand_column_list_from_order_by.<locals>.<listcomp>c                    s   g | ]}|ˆ vr|‘qS r'   r'   ri   ©Úcols_already_presentr'   r(   rl   Þ   s
    þc                 S   s   g | ]}t |ƒ‘qS r'   )rd   )rj   Úor'   r'   r(   rl   à   s    )Úsetr   )ÚcollistÚorder_byr'   rm   r(   Ú expand_column_list_from_order_byÐ   s   þÿ
þrs   c                 C   s    t |ƒD ]	}| |kr dS qdS )zÐGiven a target clause and a second to search within, return True
    if the target is plainly present in the search without any
    subqueries or aliases involved.

    Basically descends through Joins.

    TF)Úsurface_selectables)rS   Úsearchr7   r'   r'   r(   Úclause_is_presentå   s
   	ÿrv   c                 c   sZ   � | g}|r+|  ¡ }|V  t|tƒr| |j|jf¡ nt|tƒr'| |j¡ |sd S d S rC   )	r2   r+   r   Úextendr0   r1   r   rE   r4   )rS   r;   r7   r'   r'   r(   rt   õ   s   €

úrt   Tc                 c   sb   � t f}|s|tf7 }t| gƒ}|r/| ¡ }|V  | ¡ D ]}t||ƒr%q| |¡ q|sdS dS )z§traverse and yield only outer-exposed column elements, such as would
    be addressable in the WHERE clause of a SELECT if this element were
    in the columns clause.N)r   r   r   r\   r3   r+   rE   )rS   Úinclude_scalar_selectsÚfilter_r;   r7   Úsubr'   r'   r(   Úsurface_column_elements   s   €


úr{   c                 C   s   t tt| ƒƒ t|ƒ¡ƒS )z:Return True if left/right have some overlapping selectable)Úboolrp   rt   Úintersection)r0   r1   r'   r'   r(   Úselectables_overlap  s   ÿr~   c                    s&   g ‰ ‡ fdd„}t  | i d|i¡ ˆ S )zÑReturn an ordered list of "bound" values in the given clause.

    E.g.::

        >>> expr = and_(
        ...    table.c.foo==5, table.c.foo==7
        ... )
        >>> bind_values(expr)
        [5, 7]
    c                    rM   rC   )rE   Úeffective_value)Úbind©Úvr'   r(   Úvisit_bindparam)  rP   z$bind_values.<locals>.visit_bindparamÚ	bindparam)r   rR   )rS   rƒ   r'   r�   r(   Úbind_values  s   r…   c                 C   s(   t | tjƒr|  dd¡} d|  S t| ƒS )Nú'z''z'%s')r+   r   Ústring_typesre   Úrepr)r4   r'   r'   r(   Ú_quote_ddl_expr0  s   r‰   c                   @   s$   e Zd ZdZdZdZdZdd„ ZdS )Ú
_repr_baser   r   r   )Ú	max_charsc                 C   sP   t |ƒ}t|ƒ}|| jkr&| jd }|d|… d|| j   || d …  }|S )Nr   r   z# ... (%d characters truncated) ... )rˆ   Úlenr‹   )ÚselfÚvalueÚrepÚlenrepÚsegment_lengthr'   r'   r(   Útrunc?  s   


ÿþûÿz_repr_base.truncN)Ú__name__Ú
__module__Ú__qualname__Ú_LISTÚ_TUPLEÚ_DICTÚ	__slots__r’   r'   r'   r'   r(   rŠ   8  s    rŠ   c                   @   s&   e Zd ZdZdZd	dd„Zdd„ ZdS )
Ú	_repr_rowzProvide a string view of a row.)Úrowé,  c                 C   ó   || _ || _d S rC   )r›   r‹   )r�   r›   r‹   r'   r'   r(   Ú__init__T  ó   
z_repr_row.__init__c                    s>   | j ‰ dd ‡ fdd„| jD ƒ¡t| jƒdkrdf S df S )Nú(%s%s)ú, c                 3   ó   � | ]}ˆ |ƒV  qd S rC   r'   ©rj   rŽ   ©r’   r'   r(   Ú	<genexpr>[  ó   € z%_repr_row.__repr__.<locals>.<genexpr>r   ú,Ú )r’   rA   r›   rŒ   )r�   r'   r¤   r(   Ú__repr__X  s   þþz_repr_row.__repr__N©rœ   )r“   r”   r•   Ú__doc__r™   rž   r©   r'   r'   r'   r(   rš   O  s
    
rš   c                   @   s6   e Zd ZdZdZddd„Zdd„ Zdd	„ Zd
d„ ZdS )Ú_repr_paramsz±Provide a string view of bound parameters.

    Truncates display to a given numnber of 'multi' parameter sets,
    as well as long values to a given number of characters.

    )ÚparamsÚbatchesrœ   c                 C   s   || _ || _|| _d S rC   )r­   r®   r‹   )r�   r­   r®   r‹   r'   r'   r(   rž   j  s   
z_repr_params.__init__c              	   C   s  t | jtƒr| j}| jot | jd tttfƒ}n*t | jtƒr0| j}| jo.t | jd tttfƒ}nt | jtƒr<| j}d}n|  | j¡S |r{t	| jƒ| j
kr{d}d |  | jd | j
d … |¡dd… || j
t	| jƒf |  | jdd … |¡dd … f¡S |r„|  | j|¡S |  | j|¡S )	Nr   Fz8 ... displaying %i of %i total bound parameter sets ... ú r   éÿÿÿÿéþÿÿÿr   )r+   r­   r   r–   ÚdictÚtupler—   r˜   r’   rŒ   r®   rA   Ú_repr_multir¬   )r�   ÚtypÚismultiÚmsgr'   r'   r(   r©   o  s6   ÿÿÿûÿ	z_repr_params.__repr__c                    s”   |r;t |d tƒrˆj‰ n t |d tƒrˆj‰ nt |d tƒr#ˆj‰ n
J dt|d ƒ ƒ‚d ‡ ‡fdd„|D ƒ¡}nd}|ˆjkrFd| S d	| S )
Nr   FzUnknown parameter type %sr¡   c                 3   s   � | ]	}ˆ  |ˆ ¡V  qd S rC   )r¬   )rj   r­   ©Ú	elem_typer�   r'   r(   r¥   �  s   € 
ÿz+_repr_params._repr_multi.<locals>.<genexpr>r¨   ú[%s]z(%s))	r+   r   r–   r³   r—   r²   r˜   ÚtyperA   )r�   Úmulti_paramsrµ   Úelementsr'   r¸   r(   r´   �  s"   
ÿ
ÿ
z_repr_params._repr_multic                    sŠ   | j ‰ || ju rdd ‡ fdd„| ¡ D ƒ¡ S || ju r7dd ‡ fdd„|D ƒ¡t|ƒdkr3df S d	f S d
d ‡ fdd„|D ƒ¡ S )Nz{%s}r¡   c                 3   s$   � | ]\}}d |ˆ |ƒf V  qdS )z%r: %sNr'   )rj   ÚkeyrŽ   r¤   r'   r(   r¥   ¬  s
   € ÿ
ÿz,_repr_params._repr_params.<locals>.<genexpr>r    c                 3   r¢   rC   r'   r£   r¤   r'   r(   r¥   ³  r¦   r   r§   r¨   rº   c                 3   r¢   rC   r'   r£   r¤   r'   r(   r¥   ·  r¦   )r’   r˜   rA   Úitemsr—   rŒ   )r�   r­   rµ   r'   r¤   r(   r¬   ¨  s   
þÿ
þþz_repr_params._repr_paramsNrª   )	r“   r”   r•   r«   r™   rž   r©   r´   r¬   r'   r'   r'   r(   r¬   `  s    
!r¬   c                    s   ‡ fdd„}t  | i d|i¡S )zWgiven criterion containing bind params, convert selected elements
    to IS NULL.

    c                    sx   t | jtƒr| jjˆ v r| j| _tƒ | _tj| _tj	| _
d S t | jtƒr8| jjˆ v r:tƒ | _tj| _tj	| _
d S d S d S rC   )r+   r0   r   Ú_identifying_keyr1   r   r   Úis_r.   ÚisnotÚnegate©r*   ©Únullsr'   r(   Úvisit_binaryÀ  s   
ÿ
ÿúz-adapt_criterion_to_null.<locals>.visit_binaryr*   )r   Úcloned_traverse)ÚcritrÆ   rÇ   r'   rÅ   r(   Úadapt_criterion_to_nullº  s   rÊ   Nc                 C   s    | d u r|S |d fg}t | ƒ}d }|rN| ¡ \}}t|tƒr:||ur:| ¡ }| ¡  | |j¡|_| |j	|f¡ n| |¡}|d urF||_	|d u rL|}|s|S rC   )
ÚClauseAdapterr2   r+   r   Ú_cloneÚ_reset_exportedrR   ÚonclauserE   r0   )r0   r1   Ústop_onr;   ÚadapterÚretÚ	prevrightr'   r'   r(   Úsplice_joinsÕ  s&   

ôrÓ   c           
         s  |  dd¡}|  dd¡‰t ˆ ¡‰ t ¡ ‰ˆ D ]L}tdd„ |jD ƒŽ D ]?}ˆ D ]:}||u r.q'z|j}W n tjy@   |r?Y q'‚  tj	yL   |rKY q'‚ w | 
|¡raˆrZ|j|jkraˆ |¡  nq'q#q|r€‡ ‡‡fdd„}|D ]}	|	durt |	i d	|i¡ qptˆ  ˆ¡ƒS )
aC  given a list of columns, return a 'reduced' set based on natural
    equivalents.

    the set is reduced to the smallest list of columns which have no natural
    equivalent present in the list.  A "natural equivalent" means that two
    columns will ultimately represent the same value because they are related
    by a foreign key.

    \*clauses is an optional list of join clauses which will be traversed
    to further identify columns that are "equivalent".

    \**kw may specify 'ignore_nonexistent_tables' to ignore foreign keys
    whose tables are not yet configured, or columns that aren't yet present.

    This function is primarily used to determine the most minimal "primary
    key" from a selectable, by reducing the set of primary key columns present
    in the selectable to just those that are not repeated.

    Úignore_nonexistent_tablesFÚonly_synonymsc                 S   ó   g | ]}|j ‘qS r'   )Úforeign_keys©rj   rc   r'   r'   r(   rl   	  ó    z"reduce_columns.<locals>.<listcomp>c                    sŠ   | j tjkr=t tdd„ ˆ  ˆ¡D ƒŽ ¡}| j|v r?| j|v rAt	ˆ ƒD ]}| 
| j¡r<ˆr4|j| jjkr<ˆ |¡  d S q#d S d S d S d S )Nc                 S   rÖ   r'   )Ú	proxy_setrØ   r'   r'   r(   rl   (  rÙ   z8reduce_columns.<locals>.visit_binary.<locals>.<listcomp>)r.   r   Úeqr   r[   r   Ú
differencer0   r1   ÚreversedÚshares_lineageÚnamer_   )r*   r`   rc   ©ÚcolumnsÚomitrÕ   r'   r(   rÇ   %  s    ÿÿ
€öz$reduce_columns.<locals>.visit_binaryNr*   )r2   r   Úordered_column_setr[   r   rÚ   rN   r   ÚNoReferencedColumnErrorÚNoReferencedTableErrorrÞ   rß   r_   r   rR   r   rÜ   )
rá   r!   ÚkwrÔ   rk   Úfkrc   Úfk_colrÇ   rS   r'   rà   r(   Úreduce_columnsî  sF   

ú
ÿ
€è€ré   c                    sH   ˆr	ˆr	t  d¡‚dd„ ‰‡ ‡‡‡‡fdd„}g ‰t | i d|i¡ ˆS )z9traverse an expression and locate binary criterion pairs.zSCan only specify one of 'consider_as_foreign_keys' or 'consider_as_referenced_keys'c                 S   s
   |   |¡S rC   )Úcompare)ÚaÚbr'   r'   r(   Úcol_isH  s   
z"criterion_as_pairs.<locals>.col_isc                    s”  ˆ s
| j tjur
d S t| jtƒrt| jtƒsd S ˆrV| jˆv r6ˆ| j| jƒs+| jˆvr6ˆ | j| jf¡ d S | jˆv rRˆ| j| jƒsG| jˆvrTˆ | j| jf¡ d S d S d S ˆr”| jˆv rtˆ| j| jƒsi| jˆvrtˆ | j| jf¡ d S | jˆv r�ˆ| j| jƒs…| jˆvr’ˆ | j| jf¡ d S d S d S t| jtƒrÄt| jtƒrÆ| j 	| j¡r²ˆ | j| jf¡ d S | j 	| j¡rÈˆ | j| jf¡ d S d S d S d S rC   )
r.   r   rÛ   r+   r0   r   r1   rE   r   Ú
referencesrÄ   ©Úany_operatorrí   Úconsider_as_foreign_keysÚconsider_as_referenced_keysÚpairsr'   r(   rÇ   L  sR   ÿ
ÿ

ÿ
ü
ÿ

ÿ
üÿúz(criterion_as_pairs.<locals>.visit_binaryr*   )r   ÚArgumentErrorr   rR   )Ú
expressionrñ   rò   rð   rÇ   r'   rï   r(   Úcriterion_as_pairs9  s   ÿ'rö   c                   @   s:   e Zd ZdZ					d
dd„Zejfdd„Zdd	„ ZdS )rË   a5  Clones and modifies clauses based on column correspondence.

    E.g.::

      table1 = Table('sometable', metadata,
          Column('col1', Integer),
          Column('col2', Integer)
          )
      table2 = Table('someothertable', metadata,
          Column('col1', Integer),
          Column('col2', Integer)
          )

      condition = table1.c.col1 == table2.c.col1

    make an alias of table1::

      s = table1.alias('foo')

    calling ``ClauseAdapter(s).traverse(condition)`` converts
    condition to read::

      s.c.col1 == table2.c.col1

    NFc                 C   s:   |g|dœ| _ || _|| _|| _t |pi ¡| _|| _d S )N)rÏ   Úanonymize_labels)Ú__traverse_options__Ú
selectableÚ
include_fnÚ
exclude_fnr   Úcolumn_dictÚequivalentsÚadapt_on_names)r�   rù   rý   rú   rû   rþ   r÷   r'   r'   r(   rž   “  s   
þ
zClauseAdapter.__init__c                 C   s„   | j j||d�}|d u r1|| jv r1||vr1| j| D ]}| j||| |g¡d�}|d ur0|  S q| jr@|d u r@| j j |j¡}|S )N)Úrequire_embedded)rÿ   Ú_seen)	rù   Úcorresponding_columnrý   Ú_corresponding_columnÚunionrþ   rc   Úgetrß   )r�   rk   rÿ   r   ÚnewcolÚequivr'   r'   r(   r  ¦  s    ÿ
ýÿz#ClauseAdapter._corresponding_columnc                 C   s^   t |tƒr| j |¡r| jS t |tƒsd S | jr|  |¡sd S | jr)|  |¡r)d S |  |d¡S )NT)r+   r   rù   r    r   rú   rû   r  )r�   rk   r'   r'   r(   re   ¹  s   ÿ
zClauseAdapter.replace)NNNFF)	r“   r”   r•   r«   rž   r   Ú	EMPTY_SETr  re   r'   r'   r'   r(   rË   x  s    
ù
ÿrË   c                   @   sl   e Zd ZdZ								ddd„ZG dd„ deƒZd	d
„ Zdd„ ZeZ	e
jZdd„ Zdd„ Zdd„ ZdS )ÚColumnAdapteraƒ  Extends ClauseAdapter with extra utility functions.

    Key aspects of ColumnAdapter include:

    * Expressions that are adapted are stored in a persistent
      .columns collection; so that an expression E adapted into
      an expression E1, will return the same object E1 when adapted
      a second time.   This is important in particular for things like
      Label objects that are anonymized, so that the ColumnAdapter can
      be used to present a consistent "adapted" view of things.

    * Exclusion of items from the persistent collection based on
      include/exclude rules, but also independent of hash identity.
      This because "annotated" items all have the same hash identity as their
      parent.

    * "wrapping" capability is added, so that the replacement of an expression
      E can proceed through a series of adapters.  This differs from the
      visitor's "chaining" feature in that the resulting object is passed
      through all replacing functions unconditionally, rather than stopping
      at the first one that returns non-None.

    * An adapt_required option, used by eager loading to indicate that
      We don't trust a result row column that is not translated.
      This is to prevent a column from being interpreted as that
      of the child row in a self-referential scenario, see
      inheritance/test_basic.py->EagerTargetingTest.test_adapt_stringency

    NFTc
           
   	   C   sf   t j| ||||||	d� |r|  |¡ t | j¡| _| js | jr(|  	| | j¡| _|| _
|| _d | _d S )N)rú   rû   rþ   r÷   )rË   rž   r   r   Úpopulate_column_dictÚ_locate_colrá   rú   rû   Ú_IncludeExcludeMappingÚadapt_requiredÚallow_label_resolveÚ_wrap)
r�   rù   rý   Úchain_tor  rú   rû   rþ   r  r÷   r'   r'   r(   rž   ç  s"   ù


zColumnAdapter.__init__c                   @   s   e Zd Zdd„ Zdd„ ZdS )z$ColumnAdapter._IncludeExcludeMappingc                 C   r�   rC   )Úparentrá   )r�   r  rá   r'   r'   r(   rž     rŸ   z-ColumnAdapter._IncludeExcludeMapping.__init__c                 C   sL   | j jr
| j  |¡r| j jr!| j  |¡r!| j jr| j jj| S |S | j| S rC   )r  rú   rû   r  rá   )r�   r¾   r'   r'   r(   Ú__getitem__  s   ÿ
ÿþ
þ
z0ColumnAdapter._IncludeExcludeMapping.__getitem__N)r“   r”   r•   rž   r  r'   r'   r'   r(   r    s    r  c                 C   sP   | j  | j ¡}|j | j¡ ||_t |j¡|_|j	s|j
r&|  ||j¡|_|S rC   )Ú	__class__Ú__new__Ú__dict__rK   r  r   r	  r
  rá   rú   rû   r  )r�   rÐ   Úacr'   r'   r(   Úwrap  s   zColumnAdapter.wrapc                 C   s
   | j | S rC   )rá   )r�   Úobjr'   r'   r(   rR     s   
zColumnAdapter.traversec                 C   sH   t  | |¡}| jr| j |¡}|d ur|}| jr||u rd S | j|_|S rC   )rË   rR   r  r
  r  r  Ú_allow_label_resolve)r�   rk   rc   Úc2r'   r'   r(   r
  %  s   zColumnAdapter._locate_colc                 C   s   | j  ¡ }|d= |S )Nrá   )r  Úcopy)r�   Údr'   r'   r(   Ú__getstate__5  s   
zColumnAdapter.__getstate__c                 C   s   | j  |¡ t | j¡| _d S rC   )r  rK   r   ÚPopulateDictr
  rá   )r�   Ústater'   r'   r(   Ú__setstate__:  s   zColumnAdapter.__setstate__)NNFNNFTF)r“   r”   r•   r«   rž   Úobjectr  r  rR   Úadapt_clauserË   Úcopy_and_processÚ
adapt_listr
  r  r  r'   r'   r'   r(   r  È  s&    !
ö
r  )FFFFF)TrC   )NNF)?r«   Úcollectionsr   Ú	itertoolsr   r¨   r   r   Ú
annotationr   r   r	   Úbaser
   r   Úddlr   r½   r   r   r   r   r   r   r   r   Úschemar   rù   r   r   r   r   r   r   r   ÚlanghelpersÚpublic_factoryÚ_join_conditionÚjoin_conditionr)   r>   rZ   rd   rg   rs   rv   rt   r{   r~   r…   r‰   r   rŠ   rš   r¬   rÊ   rÓ   ré   rö   ÚReplacingCloningVisitorrË   r  r'   r'   r'   r(   Ú<module>   sv   ÿ@
ú(
Z
M
ü?P