관리-도구
편집 파일: instrumentation.cpython-37.pyc
B ��4]�F � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ e�� Z G d d � d e �ZG dd� de�Z G d d� de�Ze� Zej ZZej ZZej ZZdd� Zdd� Zdd� Zdd� ZdS )a� Defines SQLAlchemy's system of class instrumentation. This module is usually not directly visible to user applications, but defines a large part of the ORM's interactivity. instrumentation.py deals with registration of end-user classes for state tracking. It interacts closely with state.py and attributes.py which establish per-instance and per-class-attribute instrumentation, respectively. The class instrumentation system can be customized on a per-class or global basis using the :mod:`sqlalchemy.ext.instrumentation` module, which provides the means to build and specify alternate instrumentation forms. .. versionchanged: 0.8 The instrumentation extension system was moved out of the ORM and into the external :mod:`sqlalchemy.ext.instrumentation` package. When that package is imported, it installs itself within sqlalchemy.orm so that its more comprehensive resolution mechanics take effect. � )�base)�collections)�exc)� interfaces)�state� )�utilc @ s� e Zd ZdZejZejZe e �e��ZdZ ejZdZdd� Zdd� Zdd� Zed d � �Zedd� �Zed d� �Zedd� �Ze jdd� �ZdZdd�Zd[dd�Zdd� Zdd� Zdd� Z dd� Z!e jdd � �Z"d!d"� Z#d#d$� Z$e j%d%d&� �Z&e j%d'd(� �Z'e j%d)d*� �Z(d\d,d-�Z)d.d/� Z*d0d1� Z+d]d2d3�Z,d4d5� Z-d6d7� Z.d8d9� Z/d:d;� Z0d<d=� Z1d>d?� Z2d@dA� Z3d^dBdC�Z4dDdE� Z5edFdG� �Z6d_dHdI�Z7d`dJdK�Z8dLdM� Z9dNdO� Z:dPdQ� Z;dRdS� Z<dadTdU�Z=dVdW� Z>e>Z?dXdY� Z@dS )b�ClassManagerz,tracks state information at the class level.Nc C s� || _ i | _d | _i | _i | _dd� dd� | j jD �D �| _x| jD ]}| �|� qDW | jj � || � x,|jD ]"}t|�}|d k rn| j� |j� qnW | �� | �� d|jkr�t�d| � d S )Nc S s g | ]}|d k r|�qS )N� )�.0�mgrr r �Q/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/orm/instrumentation.py� <listcomp>B s z)ClassManager.__init__.<locals>.<listcomp>c S s g | ]}t |t�rt|��qS r )� isinstance�type�manager_of_class)r r r r r r D s �__del__z�__del__() method on class %s will cause unreachable cycles and memory leaks, as SQLAlchemy instrumentation often creates reference cycles. Please remove this method.)�class_�info�new_init�local_attrs� originals� __bases__Z_bases�update�dispatchZ_eventsZ_new_classmanager_instance�__mro__r Z_update�manage�_instrument_init�__dict__r �warn)�selfr Zbase_Zbaseclsr r r r �__init__: s* zClassManager.__init__c C s t | �S )N)�id)r r r r �__hash__` s zClassManager.__hash__c C s || kS )Nr )r �otherr r r �__eq__c s zClassManager.__eq__c C s d| j kS )N�mapper)r )r r r r � is_mappedf s zClassManager.is_mappedc C s t | �S )N)� frozenset)r r r r �_all_key_setj s zClassManager._all_key_setc C s t dd� | �� D ��S )Nc S s g | ]}|j jr|j�qS r )�implZ collection�key)r �attrr r r r q s z6ClassManager._collection_impl_keys.<locals>.<listcomp>)r( �values)r r r r �_collection_impl_keysn s z"ClassManager._collection_impl_keysc C s t dd� | �� D ��S )Nc S s g | ]}|j jr|j �qS r )r* Zaccepts_scalar_loader)r r, r r r r x s z5ClassManager._scalar_loader_impls.<locals>.<listcomp>)r( r- )r r r r �_scalar_loader_implst s z!ClassManager._scalar_loader_implsc C s t �| j��d S )N)r ZUnmappedClassErrorr )r r r r r&