+
    i9  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHt ^RIH	t	 ^RI
HtHtHtHtHtHt RR R lltR R ltR	 R
 ltRR ltRR ltR tRtR# )i    N)UnionList)ecodes)
InputEventevent_factoryKeyEventRelEventAbsEventSynEventc                s    V ^8  d   QhR\         \        \        \        P                  3,          R\
        \        ,          /# )   input_device_dirreturn)r    strbytesosPathLiker   format   "1/usr/lib64/python3.14/site-packages/evdev/util.py__annotate__r      s1     ( (5eR[[)@#A (UYZ]U^ (    c                s~    \         P                   ! RP                  V 4      4      p\        \        \        V4      4      # )z8List readable character devices in ``input_device_dir``.z	{}/event*)globr   listZfilter	is_device)r
   Zfns   & r   list_devicesr      s0     ))K&&'78
9Cy#&''r   c                sp    V ^8  d   QhR\         \        \        \        P                  3,          R\
        /# )r	   fnr   )r    r   r   r   r   Zboolr   r   r   r   r      s*      %UBKK/0 T r   c                sj   \         P                  P                  V 4      '       g   R# \         P                  ! V 4      \        P                  ,          p\        P
                  ! V4      '       g   R# \         P                  ! V \         P                  \         P                  ,          4      '       g   R# R# )z<Check if ``fn`` is a readable and writable character device.FT)	r   ZpathZexistsstatZST_MODEZS_ISCHRZaccessZR_OKZW_OK)r   Zmr   r   r   r      sd     77>>"
DLL!A<<??99R277*++r   c          	      sp    V ^8  d   QhR\         R\        \         \        \        \        \
        3,          /# )r	   eventr   )r   r    r   r   r   r   r   r   r   r   r   #   s+      j U:x8U]+]%^ r   c                sj    V P                   \        9   d   \        V P                   ,          ! V 4      # V # )z
Categorize an event according to its type.

The :data:`event_factory <evdev.events.event_factory>` dictionary
maps event types to sub-classes of :class:`InputEvent
<evdev.events.InputEvent>`. If the event cannot be categorized, it
is returned unmodified.)Ztyper   )r   s   &r   
categorizer   #   s)     zz]"UZZ(//r   c              #  s,  "   V P                  4        F{  w  r#\        P                  V,          pV\        P                  8X  d   \        P                  pM&\        \        VP                  R4      R,          4      p\        WSV4      pWB3V3x  K}  	  R# 5i)aj  
Resolve event codes and types to their verbose names.

:param typecodemap: mapping of event types to lists of event codes.
:param unknown: symbol to which unknown types or codes will be resolved.

Example
-------
>>> resolve_ecodes_dict({ 1: [272, 273, 274] })
{ ('EV_KEY', 1): [('BTN_MOUSE',  272),
                  ('BTN_RIGHT',  273),
                  ('BTN_MIDDLE', 274)] }

If ``typecodemap`` contains absolute axis info (instances of
:class:`AbsInfo <evdev.device.AbsInfo>` ) the result would look
like:

>>> resolve_ecodes_dict({ 3: [(0, AbsInfo(...))] })
{ ('EV_ABS', 3L): [(('ABS_X', 0L), AbsInfo(...))] }
Z_Ni)itemsr   ZEVZEV_KEYZkeysZgetattrZsplitresolve_ecodes)ZtypecodemapunknownZetypecodesZ	type_name
ecode_dictZresolveds   &&     r   resolve_ecodes_dictr$   2   su     , $))+IIe$	 FMM!J )=b)ABJ!*W= (** ,s   BBc                s   . pV F  p\        V\        4      '       dE   V^ ,          V 9   d#   W^ ,          ,          V^ ,          3V^,          3pM(W$^ ,          3V^,          3pMW@9   d   W,          V3pMW$3pVP                  V4       K  	  V# )z
Resolve event codes and types to their verbose names.

Example
-------
>>> resolve_ecodes(ecodes.BTN, [272, 273, 274])
[(['BTN_LEFT', 'BTN_MOUSE'], 272), ('BTN_RIGHT', 273), ('BTN_MIDDLE', 274)]
)
isinstanceZtupleappend)r#   Z
ecode_listr!   ZresZecodeZls   &&&   r   r    r    U   s     CeU##Qx:% q*E!H5uQx@Qx(%(3 "&.$

1   Jr   c                s   \         P                  ! V 4      p \        P                  ! \        4      p\
        P                  P                  4        Fs  w  r#VP                  4        FZ  w  rE\        V\        4      '       d   V3MTpV F4  pV P                  V4      '       g   K  W,          P                  V4        KX  	  K\  	  Ku  	  \        V4      # )a  
Find ecodes matching a regex and return a mapping of event type to event codes.

regex can be a pattern string or a compiled regular expression object.

Example
-------
>>> find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)')
{1: [411], 3: [10]}
>>> res = find_ecodes_by_regex(r'(ABS|KEY)_BR(AKE|EAK)')
>>> resolve_ecodes_dict(res)
{
    ('EV_KEY', 1): [('KEY_BREAK', 411)],
    ('EV_ABS', 3): [('ABS_BRAKE', 10)]
}
)reZcompilecollectionsZdefaultdictr   r   Zbytyper   r%   r   Zmatchr&   Zdict)ZregexZresultZ	type_coder"   ZcodeZnamesZnames   &      r   find_ecodes_by_regexr)   r   s    $ JJuE$$T*F"MM//1	 ;;=KD *5# 6 6UHEE;;t$$%,,T2  ) 2 <r   )z
/dev/input)Z?)r   r   r   r    r$   r)   )r(   r   r   r'   r   Ztypingr    r   Z r   Zeventsr   r   r   r   r   r   r   r   r   r$   r    r)   Z__all__) r   r   <module>r*      sH      	 	    U U(  +F:@ wr   