HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.local/lib/python3.10/site-packages/sqlalchemy/orm/__pycache__/sync.cpython-310.pyc
o

���g��@spdZddlmZddlmZddlmZddlmZdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�ZdS)zgprivate module containing functions used for copying data
between instances based on join conditions.

�)�annotations�)�exc)�util)�PassiveFlagcCs|j}|j}|D]{\}	}
z|j|	}|j|jj�||tj�}Wntj	y<}
zt
d||	||
|
�WYd}
~
nd}
~
wwz|j|
}|j|jj�|||d�Wntj	ym}
zt
d||	||
|
�WYd}
~
nd}
~
ww|r�|	jr�|
jr�|
�
|	�r�d|jd||
f<qdS)NFT�pk_cascaded)�dict�_columntoproperty�manager�key�impl�getr�PASSIVE_OFFr�UnmappedColumnError�_raise_col_to_prop�set�primary_key�
references�
attributes)�source�
source_mapper�dest�dest_mapper�synchronize_pairs�	uowcommit�flag_cascaded_pks�source_dict�	dest_dict�l�r�prop�value�err�r#�F/home/arjun/.local/lib/python3.10/site-packages/sqlalchemy/orm/sync.py�populates<	
���
��	������r%cCs�|D]U\}}z|j|}||j}Wntjy.}ztd|||||�WYd}~nd}~wwz|j|}|||j<WqtjyW}ztd|||||�WYd}~qd}~wwdS)NFT)r	rrrr)rrrrrr r!r"r#r#r$�bulk_populate_inherit_keysAs 
��
���r&cCs�|D]J\}}|jr%|�||j|�tjvr%td|�d|�dt�|��d���z|�||j|d�Wqtj	yL}zt
dd||||�WYd}~qd}~wwdS)NzDependency rule on column 'z)' tried to blank-out primary key column 'z' on instance '�'T)r�_get_state_attr_by_columnr�orm_util�	_none_set�AssertionError�	state_str�_set_state_attr_by_columnrrr)rrrrrr"r#r#r$�clearQs(��������r.c
Cs�|D]B\}}z|�|��|�}|j||j|tjd�}Wntjy7}	ztd||d||	�WYd}	~	nd}	~	ww|||j	<||||j	<qdS�N)�passiveF)
�_get_committed_attr_by_column�objr(rrrrrrr)
rrr�
old_prefixrrr�oldvaluer!r"r#r#r$�updatecs�
���
�r5cCsp|D]3\}}z
|j||j|tjd�}Wntjy/}ztd||d||�WYd}~nd}~ww|||j<qdSr/)r(rrrrrrr)rr�dict_rrrr!r"r#r#r$�
populate_dictrs
����r7c	Cs||D]9\}}z|j|}Wntjy)}ztd||d||�WYd}~nd}~ww|�||jtj�}t|j	�r;dSqdS)zpreturn true if the source object has changes from an old to a
    new value on the given synchronize pairs

    FNT)
r	rrr�get_attribute_historyrr�PASSIVE_NO_INITIALIZE�bool�deleted)	rrrrrrr r"�historyr#r#r$�source_modified~s��
�
�r=cCs.|rt�d||f�|�t�d|||f�|�)Nz�Can't execute sync rule for destination column '%s'; mapper '%s' does not map this column.  Try using an explicit `foreign_keys` collection which does not include this column (or use a viewonly=True relation).z�Can't execute sync rule for source column '%s'; mapper '%s' does not map this column.  Try using an explicit `foreign_keys` collection which does not include destination column '%s' (or use a viewonly=True relation).)rr)�isdestr�
source_columnr�dest_columnr"r#r#r$r�s������rN)�__doc__�
__future__r�rrr)�baserr%r&r.r5r7r=rr#r#r#r$�<module>s	+