관리-도구
편집 파일: attr.cpython-311.pyc
� �܋f6 � �d � d Z ddlmZ ddlmZ ddlZddlmZ ddlZddlm Z ddlm Z d d lmZ d dlmZ d dlm Z G d � dej � � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � ZdS )a� Attribute implementation for _Dispatch classes. The various listener targets for a particular event class are represented as attributes, which refer to collections of listeners to be fired off. These collections can exist at the class level as well as at the instance level. An event is fired off using code like this:: some_object.dispatch.first_connect(arg1, arg2) Above, ``some_object.dispatch`` would be an instance of ``_Dispatch`` and ``first_connect`` is typically an instance of ``_ListenerCollection`` if event listeners are present, or ``_EmptyListener`` if none are present. The attribute mechanics here spend effort trying to ensure listener functions are available with a minimum of function call overhead, that unnecessary objects aren't created (i.e. many empty per-instance listener collections), as well as that everything is garbage collectable when owning references are lost. Other features such as "propagation" of listener functions across many ``_Dispatch`` instances, "joining" of multiple ``_Dispatch`` instances, as well as support for subclass propagation (e.g. events assigned to ``Pool`` vs. ``QueuePool``) are all implemented here. � )�absolute_import)�with_statementN)�chain� )�legacy)�registry� )�exc)�util)� threadingc � � e Zd ZdZd� ZdS )� RefCollection)�refc �@ � t j | t j � � S �N)�weakrefr r �_collection_gced��selfs �L/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/event/attr.py�_memoized_attr_refz RefCollection._memoized_attr_ref1 s � ��{�4��!:�;�;�;� N)�__name__� __module__�__qualname__� __slots__r � r r r r . s( � � � � � ��I�<� <� <� <� <r r c �, � e Zd Zd� Zd� Zd� Zd� Zd� ZdS )�_empty_collectionc � � d S r r �r �elements r �appendz_empty_collection.append6 � � ��r c � � d S r r )r �others r �extendz_empty_collection.extend9 r$ r c � � d S r r r! s r �removez_empty_collection.remove<