
    !h                    `    S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r
  S SKJr   " S S5      rg	)
    )annotations)Any)
dispatcher)Deferred)signal)maybe_deferred_to_futurec                  |    \ rS rSr\R
                  4SS jjrSS jrSS jrSS jr	      SS jr
SS jrS rS	rg
)SignalManager   c                    Xl         g Nsender)selfr   s     [/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/scrapy/signalmanager.py__init__SignalManager.__init__   s    !    c                j    UR                  SU R                  5        [        R                  " X40 UD6  g)aL  
Connect a receiver function to a signal.

The signal can be any object, although Scrapy comes with some
predefined signals that are documented in the :ref:`topics-signals`
section.

:param receiver: the function to be connected
:type receiver: collections.abc.Callable

:param signal: the signal to connect to
:type signal: object
r   N)
setdefaultr   r   connectr   receiverr   kwargss       r   r   SignalManager.connect   s+     	(DKK086v6r   c                j    UR                  SU R                  5        [        R                  " X40 UD6  g)z
Disconnect a receiver function from a signal. This has the
opposite effect of the :meth:`connect` method, and the arguments
are the same.
r   N)r   r   r   
disconnectr   s       r   r   SignalManager.disconnect!   s+     	(DKK0h9&9r   c                h    UR                  SU R                  5        [        R                  " U40 UD6$ )z
Send a signal, catch exceptions and log them.

The keyword arguments are passed to the signal handlers (connected
through the :meth:`connect` method).
r   )r   r   _signalsend_catch_logr   r   r   s      r   r!   SignalManager.send_catch_log*   s.     	(DKK0%%f777r   c                h    UR                  SU R                  5        [        R                  " U40 UD6$ )af  
Like :meth:`send_catch_log` but supports returning
:class:`~twisted.internet.defer.Deferred` objects from signal handlers.

Returns a Deferred that gets fired once all signal handlers
deferreds were fired. Send a signal, catch exceptions and log them.

The keyword arguments are passed to the signal handlers (connected
through the :meth:`connect` method).
r   )r   r   r    send_catch_log_deferredr"   s      r   r%   %SignalManager.send_catch_log_deferred4   s.     	(DKK0..v@@@r   c                j    UR                  SU R                  5        [        R                  " U40 UD6  g)zt
Disconnect all receivers from the given signal.

:param signal: the signal to disconnect from
:type signal: object
r   N)r   r   r    disconnect_allr"   s      r   r(   SignalManager.disconnect_allD   s+     	(DKK0v00r   c                   ^ ^^^#    [        5       mUUU U4S jmT R                  TT5        [        T5      I Sh  vN   g N7f)zIAwait the next *signal*.

See :ref:`start-requests-lazy` for an example.
c                 L   > TR                  TT5        T R                  S 5        g r   )r   callback)dhandler   r   s   r   r.   &SignalManager.wait_for.<locals>.handleU   s    OOFF+JJtr   N)r   r   r   )r   r   r-   r.   s   ``@@r   wait_forSignalManager.wait_forN   s7     
 J	 	 	VV$&q)))s   4AA Ar   N)r   r   )r   r   r   r   r   r   returnNone)r   r   r   r   r2   zlist[tuple[Any, Any]])r   r   r   r   r2   zDeferred[list[tuple[Any, Any]]])r   r   r   r   r2   r3   )__name__
__module____qualname____firstlineno__r   	Anonymousr   r   r   r!   r%   r(   r0   __static_attributes__ r   r   r
   r
      sJ    %/%9%9 "7":8AA%(A	(A 1*r   r
   N)
__future__r   typingr   
pydispatchr   twisted.internet.deferr   scrapy.utilsr   r    scrapy.utils.deferr   r
   r:   r   r   <module>rA      s#    "  ! + * 7N* N*r   