�
Ϫ�f?4 � �p � d Z ddlmZ ddlmZ G d� d� Z G d� d� Z G d� d � Z G d
� d� Zy)
z+
Event Dispatching and Callback utilities.
� )�log)�xpathc � � e Zd ZdZd� Zd� Zy)�_MethodWrapperz3
Internal class for tracking method calls.
c �. � || _ || _ || _ y �N)�method�args�kwargs)�selfr r
r s �</usr/lib/python3/dist-packages/twisted/words/xish/utility.py�__init__z_MethodWrapper.__init__ s � ������ ���� c � � | j |z }| j j � }|j |� | j |i |�� y r )r
r �copy�updater )r r
r �nargs�nkwargss r
�__call__z_MethodWrapper.__call__ sA � �� � �D� ���+�+�"�"�$�����v������U�&�g�&r N)�__name__�
__module__�__qualname__�__doc__r r � r r
r r s � ���
'r r c �. � e Zd ZdZd� Zd� Zd� Zd� Zd� Zy)�CallbackLista�
Container for callbacks.
Event queries are linked to lists of callables. When a matching event
occurs, these callables are called in sequence. One-time callbacks
are removed from the list after the first time the event was triggered.
Arguments to callbacks are split spread across two sets. The first set,
callback specific, is passed to C{addCallback} and is used for all
subsequent event triggers. The second set is passed to C{callback} and is
event specific. Positional arguments in the second set come after the
positional arguments of the first set. Keyword arguments in the second set
override those in the first set.
@ivar callbacks: The registered callbacks as mapping from the callable to a
tuple of a wrapper for that callable that keeps the
callback specific arguments and a boolean that signifies
if it is to be called only once.
@type callbacks: C{dict}
c � � i | _ y r �� callbacks�r s r
r zCallbackList.__init__6 s � ���r c �^ � || j vrt |g|��i |��|f| j |< |