
    h                     j    d Z ddlmZmZ ddlZdZdZdZd Zd Z	d	 Z
d
eeef   fdZd
eeef   fdZy)zThese decorators provide function metadata to Python Fire.

SetParseFn and SetParseFns allow you to set the functions Fire uses for parsing
command line arguments to client code.
    )AnyDictNFIRE_METADATAFIRE_PARSE_FNSACCEPTS_POSITIONAL_ARGSc                       fd}|S )al  Sets the fn for Fire to use to parse args when calling the decorated fn.

  Args:
    fn: The function to be used for parsing arguments.
    *arguments: The arguments for which to use the parse fn. If none are listed,
      then this will set the default parse function.
  Returns:
    The decorated function, which now has metadata telling Fire how to perform.
  c                 n    t        |       }s|d<   nD ]
  }|d   |<    t        | t        |       | S )Ndefaultnamed)GetParseFns_SetMetadatar   )func	parse_fnsargument	argumentsfns      I/var/www/html/engine/venv/lib/python3.12/site-packages/fire/decorators.py
_DecoratorzSetParseFn.<locals>._Decorator'   sI    D!Ii	 *(')	'8$*~y1K     )r   r   r   s   `` r   
SetParseFnr      s     
r   c                        fd}|S )a  Set the fns for Fire to use to parse args when calling the decorated fn.

  Returns a decorator, which when applied to a function adds metadata to the
  function telling Fire how to turn string command line arguments into proper
  Python arguments with which to call the function.

  A parse function should accept a single string argument and return a value to
  be used in its place when calling the decorated function.

  Args:
    *positional: The functions to be used for parsing positional arguments.
    **named: The functions to be used for parsing named arguments.
  Returns:
    The decorated function, which now has metadata telling Fire how to perform.
  c                 r    t        |       }|d<   |d   j                         t        | t        |       | S )N
positionalr   )r   updater   r   )r   r   r   r   s     r   r   zSetParseFns.<locals>._DecoratorD   s:    BI(Ilge$^Y/Ir   r   )r   r   r   s   `` r   SetParseFnsr   4   s      
r   c                 F    t        |       }|||<   t        | t        |       y )N)GetMetadatasetattrr   )r   	attributevaluemetadatas       r   r   r   N   s!    _((9	"mX&r   returnc                     t         t        j                  |       i}	 t        | t        |      }t         |v r|S |S #  |cY S xY w)zGets metadata attached to the function `fn` as an attribute.

  Args:
    fn: The function from which to retrieve the function metadata.
  Returns:
    A dictionary mapping property strings to their value.
  )r   inspect	isroutinegetattrr   )r   r
   r"   s      r   r   r   T   sL     w004'r='2H(*onNs   : : A c                 P    t        |       }d g i d}|j                  t        |      S )N)r
   r   r   )r   getr   )r   r"   r
   s      r   r   r   k   s(    _(B<'	ng	..r   )__doc__typingr   r   r%   r   r   r   r   r   r   strr   r   r   r   r   <module>r-      sY     !3 .4'tCH~ ./tCH~ /r   