관리-도구
편집 파일: unitofwork.cpython-38.pyc
U -?�f�i � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd l m Z dd l mZ ddl m Z dd l mZ ddl m Z ddl mZ er�ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd� ZG dd� d�ZG dd� d�ZG dd� de�ZG dd� d�Z G dd � d ee �Z!G d!d"� d"e �Z"G d#d$� d$e �Z#G d%d&� d&e �Z$G d'd(� d(e �Z%G d)d*� d*e �Z&G d+d,� d,e �Z'd-S ).z�The internals for the unit of work system. The session's flush() process passes objects to a contextual object here, which assembles flush tasks based on mappers and their properties, organizes them in order of dependency, and executes. � )�annotations)�Any)�Dict)�Optional)�Set)� TYPE_CHECKING� �� attributes)�exc)�util� )�event)�topological)�DependencyProcessor)�MapperProperty)�Mapper)�Session)�SessionTransaction)� InstanceStatec s� |j � � fdd�}� fdd�}� fdd�}tj| d|ddd � tj| d |dddd� tj| d|dddd� tj| d |dddd� dS )z\Establish event listeners on object attributes which handle cascade-on-set/append. c sh |d krd S | j }|rd|jr&|�d� | jjj� }t�|�}|jj rd� |j krd|�|�sd|�|� |S )Nzcollection append) �session�_warn_on_events�_flush_warning�manager�mapper�_propsr �instance_state�_cascade�save_update�key�_contains_state�_save_or_update_state��state�item� initiator�kw�sess�propZ item_state�r � �I/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/orm/unitofwork.py�append2 s ��� z$track_cascade_events.<locals>.appendc s� |d krd S | j }| jjj� }|r>|jr>|�|jr8dnd� |d k r�|tjk r�|tj k r�|j jr�t�|�}|j� |�r�|r�||jkr�|�|� nd|_d S )Nzcollection removezrelated attribute deleteT)r r r r r r Zuselistr � NEVER_SET�PASSIVE_NO_RESULTr � delete_orphanr � _is_orphan�_new�expungeZ_orphaned_outside_of_sessionr"