§
    �Ÿjå  ã                   óª   — d Z ddlmZ  G d„ de¦  «        Zi Zd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	ed	„ ¦   «         Z
ed
„ ¦   «         ZdS )ao  Infrastructure for registering and firing callbacks on application events.

Unlike :mod:`IPython.core.hooks`, which lets end users set single functions to
be called at specific times, or a collection of alternative methods to try,
callbacks are designed to be used by extension authors. A number of callbacks
can be registered for the same event without needing to be aware of one another.

The functions defined in this module are no-ops indicating the names of available
events and the arguments which will be passed to them.

.. note::

   This API is experimental in IPython 2.0, and may be revised in future versions.
é    )Úcallback_prototypec                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚEventManagera3  Manage a collection of events and a sequence of callbacks for each.
    
    This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell`
    instances as an ``events`` attribute.
    
    .. note::

       This API is experimental in IPython 2.0, and may be revised in future versions.
    c                 ó6   — || _         d„ |D ¦   «         | _        dS )a  Initialise the :class:`CallbackManager`.

        Parameters
        ----------
        shell
            The :class:`~IPython.core.interactiveshell.InteractiveShell` instance
        available_events
            An iterable of names for callback events.
        c                 ó   — i | ]}|g “ŒS © r   )Ú.0Úns     ú`/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/core/events.pyú
<dictcomp>z)EventManager.__init__.<locals>.<dictcomp>(   s   € Ð9Ð9Ð9 1˜!˜BÐ9Ð9Ð9ó    N)ÚshellÚ	callbacks)Úselfr   Úavailable_eventss      r   Ú__init__zEventManager.__init__   s%   € ð ˆŒ
Ø9Ð9Ð(8Ð9Ñ9Ô9ˆŒˆˆr   c                 ó  — t          |¦  «        st          d|z  ¦  «        ‚t                               |¦  «        }|| j        |         vr5| j        |                              |                     |¦  «        ¦  «         dS dS )aï  Register a new event callback.

        Parameters
        ----------
        event : str
            The event for which to register this callback.
        function : callable
            A function to be called on the given event. It should take the same
            parameters as the appropriate callback prototype.

        Raises
        ------
        TypeError
            If ``function`` is not callable.
        KeyError
            If ``event`` is not one of the known events.
        zNeed a callable, got %rN)ÚcallableÚ	TypeErrorr   Úgetr   ÚappendÚadapt)r   ÚeventÚfunctionÚcallback_protos       r   ÚregisterzEventManager.register*   s…   € õ$ ˜Ñ!Ô!ð 	BÝÐ5¸Ñ@ÑAÔAÐAÝ)×-Ò-¨eÑ4Ô4ˆØ˜4œ>¨%Ô0Ð0Ð0ØŒN˜5Ô!×(Ò(¨×)=Ò)=¸hÑ)GÔ)GÑHÔHÐHÐHÐHð 1Ð0r   c                 ó>  — || j         |         v r | j         |                              |¦  «        S | j         |         D ]>}	 |j        |u r"| j         |                              |¦  «        c S Œ/# t          $ r Y Œ;w xY wt	          d                     ||¦  «        ¦  «        ‚)z'Remove a callback from the given event.z0Function {!r} is not registered as a {} callback)r   ÚremoveÚ__wrapped__ÚAttributeErrorÚ
ValueErrorÚformat)r   r   r   Úcallbacks       r   Ú
unregisterzEventManager.unregisterB   sÃ   € à�t”~ eÔ,Ð,Ð,Ø”> %Ô(×/Ò/°Ñ9Ô9Ð9ð œ uÔ-ð 	ð 	ˆHðØÔ'¨8Ð3Ð3Øœ>¨%Ô0×7Ò7¸ÑAÔAÐAÐAÐAð 4øå!ð ð ð Ø�ðøøøõ ÐK×RÒRÐS[Ð]bÑcÔcÑdÔdÐds   Á (A,Á,
A9Á8A9c                 óî   — | j         |         dd…         D ]^}	  ||i |¤Ž Œ# t          t          f$ r? t          d                     ||¦  «        ¦  «         | j                             ¦   «          Y Œ[w xY wdS )zÉCall callbacks for ``event``.

        Any additional arguments are passed to all callbacks registered for this
        event. Exceptions raised by callbacks are caught, and a message printed.
        NzError in callback {} (for {}):)r   Ú	ExceptionÚKeyboardInterruptÚprintr"   r   Úshowtraceback)r   r   ÚargsÚkwargsÚfuncs        r   ÚtriggerzEventManager.triggerQ   s¤   € ð ”N 5Ô)¨!¨!¨!Ô,ð 	+ð 	+ˆDð+Ø��dÐ%˜fÐ%Ð%Ð%Ð%øÝÕ0Ð1ð +ð +ð +ÝÐ6×=Ò=¸dÀEÑJÔJÑKÔKÐKØ”
×(Ò(Ñ*Ô*Ð*Ð*Ð*ð+øøøð	+ð 	+s   ™"¢AA2Á1A2N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r$   r-   r   r   r   r   r      s`   € € € € € ðð ð:ð :ð :ðIð Ið Ið0eð eð eð+ð +ð +ð +ð +r   r   c                 óB   — t          | ¦  «        }|t          | j        <   |S )N)r   r   r.   )Úcallback_functionr   s     r   Ú_define_eventr4   a   s%   € Ý'Ð(9Ñ:Ô:€NØ3AÕÐ&Ô/Ñ0ØÐr   c                  ó   — dS )z©Fires before code is executed in response to user/frontend action.

    This includes comm and widget messages and silent execution, as well as user
    code cells.
    Nr   r   r   r   Úpre_executer6   m   ó	   € ð 	€Dr   c                 ó   — dS )zÏFires before user-entered code runs.

    Parameters
    ----------
    info : :class:`~IPython.core.interactiveshell.ExecutionInfo`
        An object containing information used for the code execution.
    Nr   )Úinfos    r   Úpre_run_cellr:   v   ó	   € ð 	€Dr   c                  ó   — dS )z¨Fires after code is executed in response to user/frontend action.

    This includes comm and widget messages and silent execution, as well as user
    code cells.
    Nr   r   r   r   Úpost_executer=   �   r7   r   c                 ó   — dS )zÏFires after user-entered code runs.

    Parameters
    ----------
    result : :class:`~IPython.core.interactiveshell.ExecutionResult`
        The object which will be returned as the execution result.
    Nr   )Úresults    r   Úpost_run_cellr@   Š   r;   r   c                 ó   — dS )aK  Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`.

    This is before extensions and startup scripts are loaded, so it can only be
    set by subclassing.

    Parameters
    ----------
    ip : :class:`~IPython.core.interactiveshell.InteractiveShell`
        The newly initialised shell.
    Nr   )Úips    r   Úshell_initializedrC   •   s	   € ð 	€Dr   N)r1   Úbackcallr   Úobjectr   r   r4   r6   r:   r=   r@   rC   r   r   r   ú<module>rF      sþ   ððð ð (Ð 'Ð 'Ð 'Ð 'Ð 'ðI+ð I+ð I+ð I+ð I+�6ñ I+ô I+ð I+ðX Ð ðð ð ð ð	ð 	ñ „ð	ð ð	ð 	ñ „ð	ð ð	ð 	ñ „ð	ð ð	ð 	ñ „ð	ð ð	ð 	ñ „ð	ð 	ð 	r   