https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/dispatch/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/dispatch/__pycache__/dispatcher.cpython-310.pyc
o

3�a�+�@srddlZddlZddlZddlZddlmZddlmZe�d�Z	dd�Z
e
d�Ze�Z
Gdd�d�Zd	d
�ZdS)�N)�RemovedInDjango40Warning)�func_accepts_kwargszdjango.dispatchcCs&t|d�rt|j�t|j�fSt|�S)N�__func__)�hasattr�id�__self__r)�target�r	�</usr/lib/python3/dist-packages/django/dispatch/dispatcher.py�_make_ids
rc@sbeZdZdZddd�Zddd�Zdd	d
�Zddd�Zd
d�Zdd�Z	dd�Z
dd�Zddd�ZdS)�Signalz�
    Base class for all signals

    Internal attributes:

        receivers
            { receiverkey (id) : weakref(receiver) }
    NFcCsJg|_|durtjdtdd�t��|_||_|rt�	�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_argsrr	r	r
�__init__!s�

zSignal.__init__Tcsddlm}|jr|jrt|�sJd��t|�std��|r%|t|�f�nt|�t|�f�|rOtj	}|}t
|d�rDt
|d�rDtj}|j}||�}t�
||j�|j�&|��t�fdd�|jD��sk|j��|f�|j��Wd	�d	S1s{wYd	S)
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).rrc3s�|]	\}}|�kVqdS�Nr	)�.0�r_key�_��
lookup_keyr	r
�	<genexpr>ts�z!Signal.connect.<locals>.<genexpr>N)�django.confr�
configured�DEBUG�callabler�
ValueErrorrr�refr�
WeakMethodr�finalize�_remove_receiverr�_clear_dead_receivers�anyr�appendr�clear)r�receiver�sender�weak�dispatch_uidrr*�receiver_objectr	r"r
�connect8s,!"�zSignal.connectc	Cs�|r	|t|�f}nt|�t|�f}d}|j�/|��tt|j��D]}|j|\}}||kr7d}|j|=nq"|j��Wd�|S1sHwY|S)a
        Disconnect receiver from sender for signal.

        If weak references are used, disconnect need not be called. The receiver
        will be removed from dispatch automatically.

        Arguments:

            receiver
                The registered receiver to disconnect. May be none if
                dispatch_uid is specified.

            sender
                The registered sender to disconnect

            dispatch_uid
                the unique identifier of the receiver to disconnect
        FTN)rrr.�range�lenrrr1)	rr2r3r5r#�disconnected�indexr r!r	r	r
�
disconnectxs$�
�	�	zSignal.disconnectcCst|�|��Sr)�bool�_live_receivers)rr3r	r	r
�
has_listeners�szSignal.has_listenerscs6�jr�j���tur
gS���fdd�����D�S)a
        Send signal from sender to all connected receivers.

        If any receiver raises an error, the error propagates back through send,
        terminating the dispatch loop. So it's possible that all receivers
        won't be called if an error is raised.

        Arguments:

            sender
                The sender of the signal. Either a specific object or None.

            named
                Named arguments which will be passed to receivers.

        Return a list of tuple pairs [(receiver, response), ... ].
        cs$g|]}||d��d����f�qS)��signalr3r	r	)rr2��namedrr3r	r
�
<listcomp>�s��zSignal.send.<locals>.<listcomp>)rr�get�NO_RECEIVERSr>)rr3rCr	rBr
�send�s
�zSignal.sendcKs�|jr|j�|�tur
gSg}|�|�D]9}z|d||d�|��}Wn#tyE}ztjd|j||d�|�	||f�WYd}~qd}~ww|�	||f�q|S)ab
        Send signal from sender to all connected receivers catching errors.

        Arguments:

            sender
                The sender of the signal. Can be any Python object (normally one
                registered with a connect if you actually want something to
                occur).

            named
                Named arguments which will be passed to receivers.

        Return a list of tuple pairs [(receiver, response), ... ].

        If any receiver raises an error (specifically any subclass of
        Exception), return the error instance as the result for that receiver.
        r@z-Error calling %s in Signal.send_robust() (%s))�exc_infoNr	)
rrrErFr>�	Exception�logger�error�__qualname__r0)rr3rC�	responsesr2�response�errr	r	r
�send_robust�s$���	zSignal.send_robustcCs&|jrd|_dd�|jD�|_dSdS)NFcSs.g|]}t|dtj�r|d�dus|�qS)�N)�
isinstancer�
ReferenceType)r�rr	r	r
rD�s��z0Signal._clear_dead_receivers.<locals>.<listcomp>)rr)rr	r	r
r.�s��zSignal._clear_dead_receiverscCs�d}|jr|js|j�|�}|turgS|dur\|j�9|��t|�}g}|jD]\\}}}|t	ks7||kr<|�
|�q)|jrM|sHt|j|<n||j|<Wd�n1sWwYg}|D]}t|tj
�ru|�}|durt|�
|�q`|�
|�q`|S)z�
        Filter sequence of receivers to get resolved, live receivers.

        This checks for weak references and resolves them, then returning only
        live receivers.
        N)rrrrErFrr.rr�NONE_IDr0rRrrS)rr3r�	senderkey�receiverkey�r_senderkeyr2�non_weak_receiversr	r	r
r>�s:
�
��

�zSignal._live_receiverscCs
d|_dS)NT)r)rr2r	r	r
r-s
zSignal._remove_receiver)NF)NTN)NNNr)
�__name__�
__module__rL�__doc__rr7r<r?rGrPr.r>r-r	r	r	r
rs


@
$(	'rcs��fdd�}|S)a~
    A decorator for connecting receivers to signals. Used by passing in the
    signal (or list of signals) and keyword arguments to connect::

        @receiver(post_save, sender=MyModel)
        def signal_receiver(sender, **kwargs):
            ...

        @receiver([post_save, post_delete], sender=MyModel)
        def signals_receiver(sender, **kwargs):
            ...
    csDt�ttf�r�D]}|j|fi���q	|S�j|fi���|Sr)rR�list�tupler7)�func�s��kwargsrAr	r
�
_decorator(s�zreceiver.<locals>._decoratorr	)rArbrcr	rar
r2s
r2)�loggingrrr�django.utils.deprecationr�django.utils.inspectr�	getLoggerrJrrU�objectrFrr2r	r	r	r
�<module>s


https://t.me/RX1948 - 2025