+
     i.  c                  s   ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
HtHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHt ]'       d   ^ RIHt ^ RIHt  ! R R]4      t] ! R R4      4       t  ! R R] 4      t!R# )i    )annotations)	dataclass)Enum)OptionalAnyUnionListLiteralTypeTYPE_CHECKING)EV_KEY)keyboard_layout)
MacroErrorSymbolNotAvailableInTargetError)GlobalUInputs)Macro)Variable)RawValue)Mappingc                  s    ] tR t^+tRtRtRtR# )ArgumentFlagsrequiredspread N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r       L/usr/lib/python3.14/site-packages/inputremapper/injection/macros/argument.pyr   r   +   s    H Fr   r   c                  s    ] tR t^3t$ RtR]R&   R]R&   R]R&   RtR	]R
&   ]P                  t	R]R&   Rt
R	]R&   R R ltR tRtR# )ArgumentConfigz2Definition what kind of arguments a task may take.z)Union[int, Literal[ArgumentFlags.spread]]positionstrnamezList[Optional[Type]]typesFbool	is_symbolr   defaultis_variable_namec                   V ^8  d   QhRR/#    returnr#   r   Zformat   "r   __annotate__ZArgumentConfig.__annotate__C   s     6 6T 6r   c                	<    V P                   \        P                  8H  # N)r%   r   r   self   &r   is_requiredZArgumentConfig.is_requiredC   s    ||}5555r   c                r.   )zEDoes this Argument store all remaining Variables of a Task as a list?)r   r   r   r0   r2   r   	is_spreadZArgumentConfig.is_spreadF   s    }} 4 444r   r   N)r   r   r   r   __doc____annotations__r$   r   r   r%   r&   r3   r4   r   r   r   r   r   r   3   sG    <77
IIt ))GS) #d"65r   r   c                  s    ] tR t^Kt$ RtRtR]R&   R]R&   RtR]R&   R	 R
 ltR R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R  ltR! R" ltR# R$ ltR%tR# )&ArgumentzKValidation of variables and access to their value for Tasks during runtime.NzOptional[Variable]	_variablezList[Variable]
_variableszOptional[Mapping]_mappingc               s$    V ^8  d   QhRRRRRR/# )r)   argument_configr   mappingr   r*   Noner   r+   r,   r   r-   Argument.__annotate__V   s(      '  
	r   c                	s.   VP                   f   R VP                  9  d   Q hVP                  V n        VP                  V n        VP                  V n        VP                  V n        VP                   V n         VP
                  V n        W n        . V n        R # r/   )r%   r"   r   r!   r$   r&   r:   r9   )r1   r;   r<   s   &&&r   __init__ZArgument.__init__V   s     ##+O<Q<Q0Q	
 
 (00#((	$**
(22&.. / @ @r   c                    V ^8  d   QhRRRR/# )r)   
raw_valueszList[RawValue]r*   r=   r   r+   r,   r   r-   r>   k   s     	- 	-~ 	-$ 	-r   c                s    \        V P                  4      ^ 8X  g   Q hV P                  e   Q hV P                  4       '       g   Q hV F/  pV P	                  V4      pV P                  P                  V4       K1  	  R# )z`If the macro is supposed to contain multiple variables, set them.
Should be done during parsing.N)lenr9   r8   r4   _parse_raw_valueappend)r1   rA   	raw_valuevariable   &&  r   initialize_variablesZArgument.initialize_variablesk   sj     4??#q(((~~%%%~~#I,,Y7HOO""8, $r   c               r@   )r)   rE   r   r*   r=   r   r+   r,   r   r-   r>   v   s     " "X "$ "r   c                s    \        V P                  4      ^ 8X  g   Q hV P                  e   Q hV P                  4       '       d   Q hV P	                  V4      pW n        R# )z0Set the Arguments Variable. Done during parsing.N)rB   r9   r8   r4   rC   )r1   rE   rF      && r   initialize_variableZArgument.initialize_variablev   sQ    4??#q(((~~%%%>>####((3!r   c               r'   )r)   r*   r=   r   r+   r,   r   r-   r>      s     " "D "r   c                s    \        V P                  4      ^ 8X  g   Q hV P                  e   Q hV P                  4       '       d   Q h\	        V P
                  RR7      pWn        R# )z<Set the Arguments to its default value. Done during parsing.NTvalueconst)rB   r9   r8   r4   r   r%   )r1   rF      & r   initialize_defaultZArgument.initialize_default   sQ    4??#q(((~~%%%>>####$,,d;!r   c               r'   )r)   r*   r   r   r+   r,   r   r-   r>      s      3 r   c                s2   V P                  4       '       d    Q RV P                  P                   R24       hV P                  f   Q hV P                  P	                  4       pV P                  P
                  '       g   V P                  V P                  4      pV# )z<To ask for the current value of the variable during runtime.Use .())r4   
get_valuesr   r8   	get_valuerM   _validate_dynamic_valuer1   rL   rN   r   rS   ZArgument.get_value   s{    >>##IuT__-E-E,Fb%II# ~~)))((*~~###00@Er   c               r'   )r)   r*   z	List[Any]r   r+   r,   r   r-   r>      s      I r   c                s@   V P                  4       '       g    Q RV P                  P                   R24       h. pV P                   FV  pVP                  '       g#   VP                  V P                  V4      4       K7  VP                  VP                  4       4       KX  	  V# )z>To ask for the current values of the variables during runtime.rP   rQ   )r4   rS   r   r9   rM   rD   rT   )r1   ZvaluesrF   s   &  r   rR   ZArgument.get_values   s}    ~~D5)@)@(A!DDH>>>d::8DEh0023	 ( r   c               r'   )r)   r*   r    r   r+   r,   r   r-   r>      s     ) )3 )r   c                sV    V P                   f   Q hV P                   P                  4       # )z.If the variable is not const, return its name.)r8   Zget_namer0   r2   r   get_variable_nameZArgument.get_variable_name   s%    ~~)))~~&&((r   c               r'   r(   r   r+   r,   r   r-   r>      s     = = =r   c                sr    V P                   f   Q h\        V P                   P                  4       \        4      # )z9Does the underlying Variable contain another child-macro?)r8   
isinstancerS   r   r0   r2   r   contains_macroZArgument.contains_macro   s,    ~~)))$..224e<<r   c               s     V ^8  d   QhRRRR/# )r)   rL   r   r*   r   r+   r,   r   r-   r>      s     ( (s (s (r   c                s    V P                   f   Q hV P                   P                  '       d   \        R4      hV P                   P                  V4       R# )zPTo set the value of the underlying Variable during runtime.
Fails for constants.NzCan't set value of a constant)r8   rM   Z	Exception	set_valuerU      &&r   rY   ZArgument.set_value   sB     ~~)))>>;<<  'r   c               r@   )r)   symbolr    r*   r=   r   r+   r,   r   r-   r>      s     F Fs Ft Fr   c                s"   \        V4      p\        P                  ! V4      pVf   \        RV R2R7      hV P                  eL   V P                  P
                  pVe0   \        P                  ! V\        V4      '       g   \        W4      hR# R# R# )a  Checks if the key/symbol-name is valid. Like "KEY_A" or "escape".

Using `is_symbol` on the ArgumentConfig is prefered, which causes it to
automatically do this for you. But some macros may be a bit more flexible,
and there we want to assert this ourselves only in certain cases.NzUnknown key ""Zmsg)
r    r   Zgetr   r:   Ztarget_uinputr   Zcan_default_uinput_emitr
   r   )r1   r[   ZcodeZtargetrG   r   assert_is_symbolZArgument.assert_is_symbol   s     V""6*<=!:;;==$]]00F!-*O*O+ + 6fEE+! %r   c               r@   )r)   rE   r   r*   r   r   r+   r,   r   r-   r>      s     =. =.( =.x =.r   c                s   VP                   p\        V\        4      '       d   \        VRR7      # V P                  '       d*   VP                  R4      '       d   V^R p\        VRR7      # VP                  R4      '       d   \        VR,          RR7      # V P                  '       d;   VP                  R4      '       d   V^R pV P                  V4       \        VRR7      # VR8X  g   VR8X  d   R	V P                  9   d   \        R	RR7      # VP                  R4      '       d(   \        V P                  9   d   V^R p\        VRR7      # \        V P                  9   d   R
V9   d    \        \        V4      RR7      # \        V P                  9   d    \        \        V4      RR7      # VP                  R4      '       g(   RV9   g   RV9   d   \        RV P                   2R7      h\        V P                  9   d   \        VRR7      # V P!                  V4      h  \        \        3 d   p R	p?LR	p?ii ; i  \        \        3 d   p R	p?LR	p?ii ; i)zValidate and parse.TrK   r\   FZ$:i   NNZ r=   NZ.Z(Z)z*A broken macro was passed as parameter to r]   i)rL   rW   r   r   r&   Z
startswithr$   r^   r"   r    float
ValueErrorZ	TypeErrorZintr   r!   _type_error_factory)r1   rE   rL   ZerG   r   rC   ZArgument._parse_raw_value   s    eU##%t44    $$a%u55C  %)599>>>$$a!!%(%t44RK5F?

0B$d33C  SDJJ%6 !BKE%t44DJJ3%<eEl$?? $**c%j== $$#,#, @L  $**%t44&&u--+ 	*  	* s$   )H H: H72H7:IIc               r@   )r)   rF   r   r*   r   r   r+   r,   r   r-   r>   	  s     . . .S .r   c                s   VP                   '       d   Q hVP                  4       pV P                  '       d   \        V4      pV P	                  V4       V# RV P
                  9   d   Vf   V# \        V4      V P
                  9   d   V# \        V4      V P
                  9  d!   \        V P
                  9   d   \        V4      # V P                  V4      h)znTo make sure the value of a non-const variable, asked for at runtime, is
fitting for the given ArgumentConfig.N)rM   rS   r$   r    r^   r"   typera   )r1   rF   rL   rI   r   rT   Z Argument._validate_dynamic_value	  s     >>>!!""$>>>JE!!%(L4::%-L;$**$L;djj(SDJJ-> u: &&u--r   c               r@   )r)   rL   r    r*   r#   r   r+   r,   r   r-   r>   *  s        r   c                sB     \        V4       R#   \         d     R# i ; i)z/Check if the value can be turned into a number.TF)r_   r`   rU   rZ   r   _is_numeric_stringZArgument._is_numeric_string*  s#    	%L 		s    c               r@   )r)   rL   r   r*   r   r   r+   r,   r   r-   r>   2  s     
 
 
 
r   c                	s    . pV P                    F5  pVf   VP                  R4       K  VP                  VP                  4       K7  	  \        RV P                   RV R\        V4      P                   RV R2	R7      # )Nr=   z
Expected "z" to be one of z
, but got z "r\   r]   )r"   rD   r   r   r!   rb   )r1   rL   Zformatted_typesZtype_rG   r   ra   ZArgument._type_error_factory2  sz    %'ZZE}&&v.&&u~~6	   TYYK6Gz;''(5'4
 	
r   )	r:   r8   r9   r%   r$   r&   r!   r   r"   )r   r   r   r   r5   r8   r6   r:   r?   rH   rJ   rO   rS   rR   rV   rX   rY   r^   rC   rT   rc   ra   r   r   r   r   r7   r7   K   sq    U$(I!( "&H&*	-"")
=
(F&=.~.B
 
r   r7   N)"Z
__future__r    Zdataclassesr   Zenumr   Ztypingr   r   r   r   r   r   r	   Zevdev._ecodesr
   Z%inputremapper.configs.keyboard_layoutr   Z'inputremapper.configs.validation_errorsr   r   Z&inputremapper.injection.global_uinputsr   Z$inputremapper.injection.macros.macror   Z'inputremapper.injection.macros.variabler   Z(inputremapper.injection.macros.raw_valuer   Zinputremapper.configs.mappingr   r   r   r7   r   r   r   <module>rd      sl   * # !  K K K   A A 6 <A5D  5 5 5.u
~ u
r   