관리-도구
편집 파일: deprecated_interfaces.cpython-311.pyc
� �܋fQ � �> � d dl mZ ddlmZ ddlmZ ej � d� � G d� de� � � � Zej � d� � G d� d e� � � � Z ej � d� � G d � de� � � � Z dS ) � ��EXT_CONTINUE� )�event)�utilzsqlalchemy.orm.interfacesc � � e Zd ZdZed� � � Zed� � � Zed� � � Zd� Zd� Z d� Z d� Zd � Zd � Z d� Zd� Zd � Zd� ZdS )�MapperExtensionae Base implementation for :class:`_orm.Mapper` event hooks. .. deprecated:: 0.7 :class:`.MapperExtension` is deprecated and will be removed in a future release. Please refer to :func:`.event.listen` in conjunction with the :class:`.MapperEvents` listener interface. New extension classes subclass :class:`.MapperExtension` and are specified using the ``extension`` mapper() argument, which is a single :class:`.MapperExtension` or a list of such:: from sqlalchemy.orm.interfaces import MapperExtension class MyExtension(MapperExtension): def before_insert(self, mapper, connection, instance): print "instance %s before insert !" % instance m = mapper(User, users_table, extension=MyExtension()) A single mapper can maintain a chain of ``MapperExtension`` objects. When a particular mapping event occurs, the corresponding method on each ``MapperExtension`` is invoked serially, and each method has the ability to halt the chain from proceeding further:: m = mapper(User, users_table, extension=[ext1, ext2, ext3]) Each ``MapperExtension`` method returns the symbol EXT_CONTINUE by default. This symbol generally means "move to the next ``MapperExtension`` for processing". For methods that return objects like translated rows or new object instances, EXT_CONTINUE means the result of the method should be ignored. In some cases it's required for a default mapper activity to be performed, such as adding a new instance to a result list. The symbol EXT_STOP has significance within a chain of ``MapperExtension`` objects that the chain will be stopped when this symbol is returned. Like EXT_CONTINUE, it also has additional significance in some cases that a default mapper activity will not be performed. c �4 � | � ||d� � d S )N)�instrument_class��_adapt_listener_methods��cls�self�listeners �[/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/orm/deprecated_interfaces.py�_adapt_instrument_classz'MapperExtension._adapt_instrument_class<