§
    îóÉjW  ã                   óÂ   — d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z
 d„ Zd„ Z ej        dd	¬
¦  «        dd„¦   «         Z ej        dd¬
¦  «        dd„¦   «         Zdd„ZdS )z|
========================
Widget testing utilities
========================

See also :mod:`matplotlib.tests.test_widgets`.
é    )Úmock)Ú_api)Ú
MouseEventÚKeyEventNc                  óÆ   — t          j        dd¦  «        \  } }|                     ddgddg¦  «         |                     d¦  «         | j                             ¦   «          |S )z"Create a plot and return its Axes.é   r   éÈ   g      ð?)ÚpltÚsubplotsÚplotÚ
set_aspectÚcanvasÚdraw)ÚfigÚaxs     ú/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/matplotlib/testing/widgets.pyÚget_axr      s\   € åŒl˜1˜aÑ Ô �G€CˆØ‡G‚GˆQ�ˆH�q˜#�hÑÔÐØ‡M‚M�#ÑÔÐØ„J‡O‚OÑÔÐØ€Ió    c                  ó   — d S ©N© )ÚargsÚkwargss     r   Únoopr      s   € Ø€Dr   z3.11zMouseEvent or KeyEvent)Úalternativer   c                 óD  — t          j        ¦   «         }||_        | j                             ||f||fg¦  «        d         \  |_        |_        ||c|_        |_        | |_	        |  
                    d¬¦  «        j        |_        ||_        ||_        d|_        d|_        |S )a  
    Create a mock event that can stand in for `.Event` and its subclasses.

    This event is intended to be used in tests where it can be passed into
    event handling functions.

    Parameters
    ----------
    ax : `~matplotlib.axes.Axes`
        The Axes the event will be in.
    xdata : float
        x coord of mouse in data coords.
    ydata : float
        y coord of mouse in data coords.
    button : None or `MouseButton` or {'up', 'down'}
        The mouse button pressed in this event (see also `.MouseEvent`).
    key : None or str
        The key pressed when the mouse event triggered (see also `.KeyEvent`).
    step : int
        Number of scroll steps (positive for 'up', negative for 'down').

    Returns
    -------
    event
        A `.Event`\-like Mock instance.
    r   T)ÚrootNÚCustom)r   ÚMockÚbuttonÚ	transDataÚ	transformÚxÚyÚxdataÚydataÚinaxesÚ
get_figurer   ÚkeyÚstepÚguiEventÚname)r   r    r%   r&   r)   r*   Úevents          r   Ú
mock_eventr.      s£   € õ8 ŒI‰KŒK€EØ€E„LØ”|×-Ò-°°u¨~Ø05°u¨~ð/?ñ @ô @Ø@AôCÑ€E„GˆUŒWà$ eÐ€E„K�”Ø€E„LØ—=’= d�=Ñ+Ô+Ô2€E„LØ€E„IØ€E„JØ€E„NØ€E„JØ€Lr   zcallbacks.process(event)c                 ón   — t          | j        |||||¦  «        }t          | |¦  «        } ||¦  «         dS )aT  
    Trigger an event on the given tool.

    Parameters
    ----------
    tool : matplotlib.widgets.AxesWidget
    etype : str
        The event to trigger.
    xdata : float
        x coord of mouse in data coords.
    ydata : float
        y coord of mouse in data coords.
    button : None or `MouseButton` or {'up', 'down'}
        The mouse button pressed in this event (see also `.MouseEvent`).
    key : None or str
        The key pressed when the mouse event triggered (see also `.KeyEvent`).
    step : int
        Number of scroll steps (positive for 'up', negative for 'down').
    N)r.   r   Úgetattr)	ÚtoolÚetyper    r%   r&   r)   r*   r-   Úfuncs	            r   Údo_eventr4   G   s=   € õ* �t”w ¨¨u°c¸4Ñ@Ô@€EÝ�4˜ÑÔ€DØ€Dˆ�K„K€K€K€Kr   c                 óº  — | j         }|�)t          j        d|||¦  «                             ¦   «          t	          j        d||d¦  «                             ¦   «          t	          j        d||d¦  «                             ¦   «          t	          j        d||d¦  «                             ¦   «          |�+t          j        d|||¦  «                             ¦   «          dS dS )a}  
    Helper to simulate a mouse drag operation.

    Parameters
    ----------
    tool : `~matplotlib.widgets.Widget`
    start : [float, float]
        Starting point in data coordinates.
    end : [float, float]
        End point in data coordinates.
    key : None or str
         An optional key that is pressed during the whole operation
         (see also `.KeyEvent`).
    NÚkey_press_eventÚbutton_press_eventr   Úmotion_notify_eventÚbutton_release_eventÚkey_release_event)r   r   Ú_from_ax_coordsÚ_processr   )r1   ÚstartÚendr)   r   s        r   Úclick_and_dragr?   a   sÖ   € ð 
Œ€BØ
€ÝÔ Ð!2°B¸¸sÑCÔC×LÒLÑNÔNÐNåÔÐ3°R¸ÀÑBÔB×KÒKÑMÔMÐMÝÔÐ4°b¸#¸qÑAÔA×JÒJÑLÔLÐLÝÔÐ5°r¸3ÀÑBÔB×KÒKÑMÔMÐMØ
€ÝÔ Ð!4°b¸#¸sÑCÔC×LÒLÑNÔNÐNÐNÐNð €r   )r   r   r   Nr   r   )Ú__doc__Úunittestr   Ú
matplotlibr   Úmatplotlib.backend_basesr   r   Úmatplotlib.pyplotÚpyplotr
   r   r   Ú
deprecatedr.   r4   r?   r   r   r   ú<module>rG      s	  ððð ð Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø Ð Ð Ð Ð Ð ðð ð ð	ð 	ð 	ð €„�Ð%=Ð>Ñ>Ô>ð&ð &ð &ñ ?Ô>ð&ðR €„�Ð%?Ð@Ñ@Ô@ðð ð ñ AÔ@ðð2Oð Oð Oð Oð Oð Or   