← Back
Editing: dispatcher.cpython-311.pyc
� �|�e�+ � � � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ e j d� � Z d� Z e d� � Z e� � Z G d� d� � Zd� ZdS ) � N)�RemovedInDjango40Warning)�func_accepts_kwargszdjango.dispatchc � � t | d� � r(t | j � � t | j � � fS t | � � S )N�__func__)�hasattr�id�__self__r )�targets �</usr/lib/python3/dist-packages/django/dispatch/dispatcher.py�_make_idr s? � ��v�z�"�"� :��6�?�#�#�R���%8�%8�9�9� �f�:�:�� c �R � e Zd ZdZdd�Zdd�Zdd�Zdd�Zd � Zd � Z d� Z d� Zdd �ZdS )�Signalz� Base class for all signals Internal attributes: receivers { receiverkey (id) : weakref(receiver) } NFc �� � g | _ |�t j dt d�� � t j � � | _ || _ |rt j � � ni | _ d| _ dS )z& Create a new signal. Nz�The providing_args argument is deprecated. As it is purely documentational, it has no replacement. If you rely on this argument as documentation, you can move the text to a code comment or docstring.� )� stacklevelF)� receivers�warnings�warnr � threading�Lock�lock�use_caching�weakref�WeakKeyDictionary�sender_receivers_cache�_dead_receivers)�self�providing_argsr s r �__init__zSignal.__init__! s} � � ����%��M�(� )�Q� � � � � �N�$�$�� �&��� FQ�&X�g�&?�&A�&A�&A�VX��#�$����r Tc �� �� ddl m} |j r>|j r7t |� � s J d� � �t |� � st d� � �|r|t |� � f�nt |� � t |� � f�|rft j }|}t |d� � r#t |d� � rt j }|j } ||� � }t j || j � � | j 5 | � � � t# �fd�| j D � � � � s| j � �|f� � | j � � � ddd� � dS # 1 swxY w Y dS ) a� Connect receiver to sender for signal. Arguments: receiver A function or an instance method which is to receive signals. Receivers must be hashable objects. If weak is True, then receiver must be weak referenceable. Receivers must be able to accept keyword arguments. If a receiver is connected with a dispatch_uid argument, it will not be added if another receiver was already connected with that dispatch_uid. sender The sender to which the receiver should respond. Must either be a Python object, or None to receive events from any sender. weak Whether to use weak references to the receiver. By default, the module will attempt to use weak references to the receiver objects. If this parameter is false, then strong references will be used. dispatch_uid An identifier used to uniquely identify a particular instance of a receiver. This will usually be a string, though it may be anything hashable. r )�settingsz"Signal receivers must be callable.z:Signal receivers must accept keyword arguments (**kwargs).r r c 3 �* �K � | ] \ }}|�k V � �d S �N� )�.0�r_key�_� lookup_keys �r � <genexpr>z!Signal.connect.<locals>.<genexpr>t s, �� � � �J�J�x�u�a�u� �*�J�J�J�J�J�Jr N)�django.confr"