File: //usr/local/lib/python3.10/dist-packages/sqlalchemy/ext/__pycache__/instrumentation.cpython-310.pyc
o
���g[= � @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z
dd lmZ ddlmZ
dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ dZ dd� ZegZ G 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)�InstrumentationFactory�__sa_instrumentation_manager__c C s t | td�S )z;Find user-specified instrumentation management for a class.N)�getattr�INSTRUMENTATION_MANAGER��cls� r �I/usr/local/lib/python3.10/dist-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 ur| �||�}||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�}|rtd|jt|�f ��d S )NzRmultiple instrumentation implementations specified in %s inheritance hierarchy: %r)�!_collect_management_factories_for�
difference� TypeError�__name__�list)r r r �existing_factoriesr r r �_check_conflictsp s �����z0ExtendedInstrumentationRegistry._check_conflictsc C sd ||�}t |t�st||�}|tkr| jsd| _t� |�� | j|<