관리-도구
편집 파일: instrumentation.cpython-37.pyc
B ��4]8 � @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lmZ dd l mZ ddl mZ ddl mZ dd l mZ ddl mZ dZdd� ZegZG dd� de�Ze� e_Zee_G dd� de�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_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 �Q/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/ext/instrumentation.py�%find_native_user_instrumentation_hook; s r c st e Zd ZdZe�� Ze�� Ze�� ZdZ dd� Z dd� Zdd� Zd d � Z � fdd�Zd d� Zdd� Zdd� Z� ZS )�ExtendedInstrumentationRegistryz�Extends :class:`.InstrumentationFactory` with additional bookkeeping, to accommodate multiple types of class managers. Fc C s: x4t D ](}||�}|d k r| �||�}||fS qW dS d S )N)NN)�instrumentation_finders�_extended_class_manager)�self�class_�finder�factory�managerr r r �_locate_extended_factory] 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_conflictsf s z0ExtendedInstrumentationRegistry._check_conflictsc C sd ||�}t |t�st||�}|tkr6| js6d| _t� |�� | j|<