
    i                     <    d Z ddlZd Z e        [ G d de      Zy)z9
Utility functions and classes for the *uinput* backend.
    Nc                       y N r       ]/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/pynput/_util/uinput.py_checkr      s    r   c                   H     e Zd ZdZ e       Z fdZd Zd Zd Z	d Z
 xZS )ListenerMixinzA mixin for *uinput* event listeners.

    Subclasses should set a value for :attr:`_EVENTS` and implement
    :meth:`_handle_message`.
    c                     t        t        | 
  |i | | j                  | j                  j                  dt        j                                     | _        | j                  r| j                  j                          y y )Ndevice_paths)superr
   __init___device_optionsgetevdevlist_devices_devsuppressgrab)selfargskwargs	__class__s      r   r   zListenerMixin.__init__,   sc    mT+T<V<LL!2!2 "" #	 ==IINN r   c                     | j                   j                         D ],  }|j                  | j                  v s| j	                  |       . y r   )r   	read_looptype_EVENTS_handle_messager   events     r   _runzListenerMixin._run4   s<    YY((* 	,EzzT\\)$$U+	,r   c                 8    | j                   j                          y r   )r   close)r   s    r   _stop_platformzListenerMixin._stop_platform9   s    		r   c                     d\  }}|D ]d  }	 t        j                  |      }|j                         }t	         fd|j                         D              }||kD  r|}|}U|j                          f |t        d      |S # t        $ r Y w xY w)zAttempts to load a readable keyboard device.

        :param paths: A list of paths.

        :return: a compatible device
        )Nr   c              3   V   K   | ]   \  }}|j                   v rt        |       " y wr   )r   len).0r!   codesr   s      r   	<genexpr>z(ListenerMixin._device.<locals>.<genexpr>M   s-      * E5DLL( E
*s   &)zno keyboard device available)r   InputDeviceOSErrorcapabilitiessumitemsr$   )r   pathsdevcountpathnext_devr.   
next_counts   `       r   r   zListenerMixin._device<   s     
U 	!D ,,T2
 $002L *$0$6$6$8* *J E!" #	!& ;899J%  s   A??	B
Bc                     t               )zHandles a single event.

        This method should call one of the registered event callbacks.

        :param event: The event.
        )NotImplementedErrorr    s     r   r   zListenerMixin._handle_message\   s     "##r   )__name__
__module____qualname____doc__tupler   r   r"   r%   r   r   __classcell__)r   s   @r   r
   r
   #   s+     gG,
@$r   r
   )r<   r   r   objectr
   r   r   r   <module>r@      s,   " 	 
@$F @$r   