관리-도구
편집 파일: instrumentation.cpython-38.pyc
U -?�f[= � @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lmZ ddlmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ dZdd� ZegZG dd� de�Ze� e_Zee_G dd� d�ZG dd� de�Zdd� Zdd� Zdd� ZdS )a� Extensible class instrumentation. The :mod:`sqlalchemy.ext.instrumentation` package provides for alternate systems of class instrumentation within the ORM. Class instrumentation refers to how the ORM places attributes on the class which maintain data and track changes to that data, as well as event hooks installed on the class. .. note:: The extension package is provided for the benefit of integration with other object management packages, which already perform their own instrumentation. It is not intended for general use. For examples of how the instrumentation extension is used, see the example :ref:`examples_instrumentation`. � N� )�util)� attributes)�base)�collections)�exc)�instrumentation)�_default_dict_getter)�_default_manager_getter)�_default_opt_manager_getter)�_default_state_getter)�ClassManager)�InstrumentationFactoryZ__sa_instrumentation_manager__c C s t | td�S )z;Find user-specified instrumentation management for a class.N)�getattr�INSTRUMENTATION_MANAGER��cls� r �N/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/ext/instrumentation.py�%find_native_user_instrumentation_hookE s r c s| e Zd ZdZe�� Ze�� Ze�� ZdZ dd� Z dd� Zdd� Zd d � Z � fdd�Zd d� Zdd� Zdd� Zdd� Z� ZS )�ExtendedInstrumentationRegistryz�Extends :class:`.InstrumentationFactory` with additional bookkeeping, to accommodate multiple types of class managers. Fc C s6 t D ],}||�}|d k r| �||�}||f S qdS )N)NN)�instrumentation_finders�_extended_class_manager)�self�class_�finder�factory�managerr r r �_locate_extended_factoryg s z8ExtendedInstrumentationRegistry._locate_extended_factoryc C s0 | � |��|g�}|r,td|jt|�f ��d S )NzRmultiple instrumentation implementations specified in %s inheritance hierarchy: %r)�!_collect_management_factories_for� difference� TypeError�__name__�list)r r r Zexisting_factoriesr r r �_check_conflictsp s ����z0ExtendedInstrumentationRegistry._check_conflictsc C sd ||�}t |t�st||�}|tkr6| js6d| _t� |�� | j|<