관리-도구
편집 파일: instrumentation.cpython-311.pyc
� �܋f�H � �& � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej � � Z G d � d e � � Z G d� de� � Z G d � de� � Z e� � Zej xZZej xZZej xZZd� Zd� Zd� Zd� 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 �^ � e Zd ZdZej Zej Z e e j e� � � � ZdZ ej ZdZd� Zd� Zd� Zed� � � Zed� � � Zed� � � Zed � � � Ze j d � � � Zd/d�Zd/d�Zd � Zd� Zd� Z d� Z!e j d� � � Z"d� Z#d� Z$e j% d� � � Z&e j% d� � � Z'e j% d� � � Z(d0d�Z)d� Z*d� Z+d0d�Z,d� Z-d� Z.d� Z/d� Z0d � Z1d!� Z2d"� Z3d0d#�Z4d$� Z5ed%� � � Z6d/d&�Z7d/d'�Z8d(� Z9d)� Z:d*� Z;d+� Z<d0d,�Z=d-� Z>e>Z?d.� Z@dS )1�ClassManagerz,Tracks state information at the class level.Nc � � || _ i | _ d | _ i | _ i | _ d� d� | j j D � � D � � | _ | j D ]}| � |� � �| j j � || � � |j D ]2}t |� � }|�| j � |j � � �3| � � � | � � � d|j v rt# j d|z � � d S d S )Nc � � g | ]}|�|��S �N� )�.0�mgrs �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/instrumentation.py� <listcomp>z)ClassManager.__init__.<locals>.<listcomp>A s) � � � � �� �� � ��� c �V � g | ]&}t |t � � �t |� � ��'S r )� isinstance�type�manager_of_class)r r s r r z)ClassManager.__init__.<locals>.<listcomp>C s@ � � � � ���d�D�)�)�� ��&�&�� � r �__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__�_bases�update�dispatch�_events�_new_classmanager_instance�__mro__r �_update�manage�_instrument_init�__dict__r �warn)�selfr �base_�baseclsr s r �__init__zClassManager.__init__: sJ � ������ ��� ������� � �� � �K�1�� � � � � ��� �[� � �E��K�K������� ��8�8���F�F�F� �~� 4� 4�G�"�7�+�+�C���� �%�%�c�l�3�3�3����� � � ����������'�'��I�@� CI�I� � � � � � (�'r c � � t | � � S r )�id�r+ s r �__hash__zClassManager.__hash__` s � ��$�x�x�r c � � || u S r r )r+ �others r �__eq__zClassManager.__eq__c s � ���}�r c � � d| j v S )N�mapper)r) r1 s r � is_mappedzClassManager.is_mappedf s � ��4�=�(�(r c � � t | � � S r )� frozensetr1 s r �_all_key_setzClassManager._all_key_setj s � �����r c �X � t d� | � � � D � � � � S )Nc �4 � g | ]}|j j �|j ��S r )�impl� collection�key�r �attrs r r z6ClassManager._collection_impl_keys.<locals>.<listcomp>q s$ � �H�H�H�$�4�9�3G�H�T�X�H�H�Hr �r: �valuesr1 s r �_collection_impl_keysz"ClassManager._collection_impl_keysn s- � ��H�H�$�+�+�-�-�H�H�H� � � r c �X � t d� | � � � D � � � � S )Nc �4 � g | ]}|j j �|j ��S r )r>