
    |h                     f   d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
 ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ dd	l	mZ dd
l	mZ ddl	mZ ddlmZ d#dZd Zd Z G d de      Z G d de      Zd Zd$dZd Zd%dZd Z d&dZ!d Z"	 	 d'dZ#d Z$d Z%d Z&d Z'd  Z(d! Z)d" Z*y)(a  Python Fire is a library for creating CLIs from absolutely any Python object.

You can call Fire on any Python object:
functions, classes, modules, objects, dictionaries, lists, tuples, etc.
They all work!

Python Fire turns any Python object into a command line interface.
Simply call the Fire function as your main method to create a CLI.

When using Fire to build a CLI, your main method includes a call to Fire. Eg:

def main(argv):
  fire.Fire(Component)

A Fire CLI command is run by consuming the arguments in the command in order to
access a member of current component, call the current component (if it's a
function), or instantiate the current component (if it's a class). The target
component begins as Component, and at each operation the component becomes the
result of the preceding operation.

For example "command fn arg1 arg2" might access the "fn" property of the initial
target component, and then call that function with arguments 'arg1' and 'arg2'.
Additional examples are available in the examples directory.

Fire Flags, common to all Fire CLIs, must go after a separating "--". For
example, to get help for a command you might run: `command -- --help`.

The available flags for all Fire CLIs are:
  -v --verbose: Include private members in help and usage information.
  -h --help: Provide help and usage information for the command.
  -i --interactive: Drop into a Python REPL after running the command.
  --completion: Write the Bash completion script for the tool to stdout.
  --completion fish: Write the Fish completion script for the tool to stdout.
  --separator SEPARATOR: Use SEPARATOR in place of the default separator, '-'.
  --trace: Get the Fire Trace for the command.
    N)
completion)
decorators)
formatting)helptext)inspectutils)interact)parser)trace)value_types)
console_ioc                    |xs0 t         j                  j                  t        j                  d         }t        |t              rt        j                  |      }n:t        |t        t        f      r|}n!|t        j                  dd }nt        d      t        j                  |      \  }}t        j                         }|j                  |      \  }}i }	|j                   s| Vt#        j$                         d   }
|
d   }|j&                  }|j(                  }|	j+                  |       |	j+                  |       t-        | |||	|      }|j/                         rt1        |       t3        d|      |j4                  r}|j6                  rqd| dg}|j9                         }t;        j<                  |||j>                        }|jA                  |       tC        |t        jD                  	       t3        d|      |j4                  r-d| g}tC        |t        jD                  	       t3        d|      |j6                  r\|j9                         }t;        j<                  |||j>                        }|g}tC        |t        jD                  	       t3        d|      tG        ||j>                  |
       |j9                         }|S )a  This function, Fire, is the main entrypoint for Python Fire.

  Executes a command either from the `command` argument or from sys.argv by
  recursively traversing the target object `component`'s members consuming
  arguments, evaluating functions, and instantiating classes as it goes.

  When building a CLI with Fire, your main method should call this function.

  Args:
    component: The initial target component.
    command: Optional. If supplied, this is the command executed. If not
        supplied, then the command is taken from sys.argv instead. This can be
        a string or a list of strings; a list of strings is preferred.
    name: Optional. The name of the command as entered at the command line.
        Used in interactive mode and for generating the completion script.
    serialize: Optional. If supplied, all objects are serialized to text via
        the provided callable.
  Returns:
    The result of executing the Fire command. Execution begins with the initial
    target component. The component is updated by using the command arguments
    to either access a member of the current component, call the current
    component (if it's a function), or instantiate the current component (if
    it's a class). When all arguments are consumed and there's no function left
    to call or class left to instantiate, the resulting current component is
    the final result.
  Raises:
    ValueError: If the command argument is supplied, but not a string or a
        sequence of arguments.
    FireExit: When Fire encounters a FireError, Fire will raise a FireExit with
        code 2. When used with the help or trace flags, Fire will raise a
        FireExit with code 0 if successful.
  r   N   zAThe command argument must be a string or a sequence of arguments.   zFire trace:

r
   verboseout)r   	serialize)$ospathbasenamesysargv
isinstancestrshlexsplitlisttuple
ValueErrorr	   SeparateFlagArgsCreateParserparse_known_argsinteractiveinspectstack	f_globalsf_localsupdate_FireHasError_DisplayErrorFireExit
show_trace	show_help	GetResultr   HelpTextr   appendDisplaystderr_PrintResult)	componentcommandnamer   args	flag_args	argparserparsed_flag_argsunused_argscontextcallercaller_framecaller_globalscaller_localscomponent_traceoutputresult	help_texts                     H/var/www/html/test/engine/venv/lib/python3.12/site-packages/fire/core.pyFirerI   I   sm   B 
	.!!#((1+.$ ;;wD'D%=)D88AB<D
 " # # ++D1/$	!!#)"+"<"<Y"GK'!!Y%6]]_QF!9L!++N ))MNN>"NN=!)T+;WdK//"
1o
&&O$=$=o.b12F&&(F!!o/F/FHI
MM)F

#
1o
&&o./0FF

#
1o
&&&&(F!!o/F/FHI[FF

#
1o
&& 66)M$$&&	-    c                 Z    dj                  |       dz   }t        j                  ||       y )Nr   r   )joinr   More)linesr   texts      rH   r4   r4      s#    	5	D	 $//$C rJ   c                 2    t        j                  | ||      S )z9Returns the text of the completion script for a Fire CLI.shell)r   Script)r9   r7   rR   s      rH   CompletionScriptrT      s    			4%	88rJ   c                       e Zd ZdZy)	FireErrorzException used by Fire when a Fire command cannot be executed.

  These exceptions are not raised by the Fire function, but rather are caught
  and added to the FireTrace.
  N)__name__
__module____qualname____doc__ rJ   rH   rV   rV      s    rJ   rV   c                   "     e Zd ZdZ fdZ xZS )r.   ak  An exception raised by Fire to the client in the case of a FireError.

  The trace of the Fire program is available on the `trace` property.

  This exception inherits from SystemExit, so clients may explicitly catch it
  with `except SystemExit` or `except FireExit`. If not caught, this exception
  will cause the client program to exit without a stacktrace.
  c                 2    t         |   |       || _        y)zConstructs a FireExit exception.

    Args:
      code: (int) Exit code for the Fire CLI.
      component_trace: (FireTrace) The trace for the Fire command.
    N)super__init__r
   )selfcoderD   	__class__s      rH   r_   zFireExit.__init__   s     
GT DJrJ   )rW   rX   rY   rZ   r_   __classcell__)rb   s   @rH   r.   r.      s    ! !rJ   r.   c                    d}|r|d   }|dv r| j                         }t        j                  |      st        j                  |      r*t	        j
                  |      }t        ||      \  }}}||v }n"t        t        j                  |            }||v}|rLd| _	        | j                          d}	t        dt        j                  |	       dt        j                         |S )	aY  Determines if the user is trying to access help without '--' separator.

  For example, mycmd.py --help instead of mycmd.py -- --help.

  Args:
    component_trace: (FireTrace) The trace for the Fire command.
    remaining_args: List of remaining args that haven't been consumed yet.
  Returns:
    True if help is requested, False otherwise.
  Fr   z-hz--helpT
 -- --help$INFO: Showing help with the command .
file)r1   r&   isclass	isroutiner   GetFullArgSpec_ParseKeywordArgsdict
getmembersr0   
GetCommandprintr   quoter   r5   )
rD   remaining_argsr0   targetr7   fn_spec_remaining_kwargsmembersr8   s
             rH   _IsHelpShortcutrz      s     )AF!!!++-i		#w'8'8'C--i8!2>7!KQ..	w)))45')	 $O ++-.j9G	0W1E0Fc
Jzz	rJ   c                    | j                         }|rt        |      st        d|       ||      }t        j                  |      rt        t        |             yt        |t        t        t        t        j                  f      r|D ]  }t        t        |              yt        j                  |      rt         t        |t"              r+t        j$                  |      rt        t'        ||             yt        |t(              rt        t        |             yt        |t        j*                        r|t        |       yyt-        j.                  || |      }|g}t1        |t2        j4                         y)zEPrints the result of the Fire call to stdout in a human readable way.z3The argument `serialize` must be empty or callable:Nr   r   )r1   callablerV   r   HasCustomStrrr   r   r   r   set	frozensettypesGeneratorType_OneLineResultr&   isgeneratorfunctionNotImplementedErrorro   IsSimpleGroup_DictAsStringr    VALUE_TYPESr   r2   r4   r   stdout)rD   r   r   rF   irG   rE   s          rH   r6   r6      s2    $$&& I
?L LvFf% 
#f+
sIu/B/BCD N1""6*
&$K$=$=f$E	-
()&% 	.
 !&+112Fm  !!ow8I[FF

#rJ   c                    | j                         }g }d}dD ]   }|| j                  d   j                  v sd}" |r| j                          d}t	        dt        j                  |       dt        j                         t        j                  || | j                  	      }|j                  |       t        |t        j                  
       yt	        t        j                  d      | j                  d   j!                         z   t        j                         t        j"                  || | j                  	      }t	        |t        j                         y)z.Prints the Fire trace and the error to stdout.Fre   Trf   rg   rh   ri   r   r   zERROR: N)r1   elementsr:   rq   rr   r   rs   r   r5   r   r2   r   r3   r4   r   Error
ErrorAsStr	UsageText)rD   rF   rE   r0   	help_flagr8   rG   
error_texts           rH   r-   r-     s%   $$&&&)# iO,,R0555i  ++-.j9G	0W1E0Fc
Jzz!!&*9*A*ACI
MM)F

#	*

9
%$$R(3356zz ##F/,;,C,CEJ	*3::&rJ   c                    t        j                  |       }| j                         D ci c]"  \  }}t        j                  | ||||      r||$ }}}|syt        d |j                         D              }d|dz    d}g }| j                         D ]P  \  }}t        j                  | ||||      s!|j                  | dt        |            }	|j                  |	       R d	j                  |      S c c}}w )
zReturns a dict as a string.

  Args:
    result: The dict to convert to a string
    verbose: Whether to include 'hidden' members, those keys starting with _.
  Returns:
    A string representing the dict
  )class_attrsr   z{}c              3   D   K   | ]  }t        t        |              y wN)lenr   ).0keys     rH   	<genexpr>z _DictAsString.<locals>.<genexpr>H  s     CcCCMCs    z{key:r   z
s} {value}:)r   valuer   )r   GetClassAttrsDictitemsr   MemberVisiblemaxkeysformatr   r3   rL   )
rF   r   r   r   r   result_visiblelongest_keyformat_stringrN   lines
             rH   r   r   1  s    ..v6+#)<<>S%		!	!&#u.97
L 
5j.  
C^-@-@-BCC+;?+=9-
%LLN jc5U(/1!!Qi~e7L!Mdll4	
 
5	%s   'C5c                 |   t        | t              rt        |       j                  dd      S t        j                  |       rd| j
                   dS t        j                  |       rd| j
                   dS 	 t        j                  | d      S # t        t        f$ r t        |       j                  dd      cY S w xY w)z2Returns result serialized to a single line string.r    z
<function >z<module F)ensure_ascii)r   r   replacer&   
isfunctionrW   ismodulejsondumps	TypeErrorr!   )rF   s    rH   r   r   T  s     v;tS)) (**ffoo&a((*::f511
Z	  *v;tS))*s   7B *B;:B;c                 	   |j                   }|j                  }|j                  }|j                  }|j                  }	|j
                  }
| |} | }t        j                  |||||	|
      }d}|}	 | }|}|s
|	s|s|
s|nt        ||      rg }ng }d}||v r |j                  |      }||dz   d }|d| }d}||vsJ d}g }t        j                  |       xs t        j                  |       }t        |       xr | }t        | t        t        f      }t        | t               xs t#        j$                  |       }|sC|rAt        j                  |       }	 t'        | |||rdnd| j(                        \  } }d}|r||u r| }|s=|r;|r9|d	   }	 t/        |      }| |   } d}|r|dd }d}d}|j5                  | |g||       |s|r|r|d	   } t#        j$                  |       r| j7                         }!n| }!| |!v r|!|    } d}nX| j9                  dd      |!v r|!| j9                  dd         } d}n,|!j;                         D ]  \  }"}#| t=        |"      k(  s|#} d} n |r |dd }d}d}|j5                  | | | g||       nt+        d|       }|j-                  ||f       |sG|rE	 |d	   } t?        | |      \  } }$}d}t#        j@                  |       \  }}|j5                  | | |$||       |s|r	 t'        | ||d      \  } }d}|s|r|d	   \  }}|jC                  ||       |S |rV|r
||gz   |z   }nJt        j                  |      st        j                  |      r|}|jE                          n| |ur|g|z   }n|}| |u r||k(  rn|r|jC                  t+        d|      |       |S |,|t1        d      tG        |||      }%|jI                  |%       |rS|jK                         }&|||&|<   ||&d<   | |&d<   ||&d<   |||&d<   tM        jN                  |&|       |jQ                          |S # t*        $ r}|j-                  ||f       Y d}~d}~ww xY w# t0        t2        f$ r# t+        d
|      }|j-                  ||f       Y w xY w# t*        $ r}|j-                  ||f       Y d}~d}~ww xY w# t*        $ r}|j-                  ||f       Y d}~d}~ww xY w)a  Execute a Fire command on a target component using the args supplied.

  Arguments that come after a final isolated '--' are treated as Flags, eg for
  interactive mode or completion script generation.

  Other arguments are consumed by the execution of the Fire command, eg in the
  traversal of the members of the component, or in calling a function or
  instantiating a class found during the traversal.

  The steps performed by this method are:

  1. Parse any Flag args (the args after the final --)

  2. Start with component as the current component.
  2a. If the current component is a class, instantiate it using args from args.
  2b. If the component is a routine, call it using args from args.
  2c. If the component is a sequence, index into it using an arg from
      args.
  2d. If possible, access a member from the component using an arg from args.
  2e. If the component is a callable object, call it using args from args.
  2f. Repeat 2a-2e until no args remain.
  Note: Only the first applicable rule from 2a-2e is applied in each iteration.
  After each iteration of step 2a-2e, the current component is updated to be the
  result of the applied rule.

  3a. Embed into ipython REPL if interactive mode is selected.
  3b. Generate a completion script if that flag is provided.

  In step 2, arguments will only ever be consumed up to a separator; a single
  step will never consume arguments from both sides of a separator.
  The separator defaults to a hyphen (-), and can be overwritten with the
  --separator Fire argument.

  Args:
    component: The target component for Fire.
    args: A list of args to consume in Firing on the component, usually from
        the command line.
    parsed_flag_args: The values of the flag args (e.g. --verbose, --separator)
        that are part of every Fire CLI.
    context: A dict with the local and global variables available at the call
        to Fire.
    name: Optional. The name of the command. Used in interactive mode and in
        the tab completion script.
  Returns:
    FireTrace of components starting with component, tracing Fire's execution
        path as it consumes args.
  Raises:
    ValueError: If there are arguments that cannot be consumed.
    ValueError: If --completion is specified but no name available.
  N)initial_componentr9   	separatorr   r0   r/   TFr   classroutine)	treatmentru   r   z-Unable to index into component with argument:-rw   zCannot find key:r|   )r   zCould not consume arguments:z2Cannot make completion script without command namerQ   r7   rF   r
   r`   ))r   r%   r   r   helpr
   	FireTracerz   indexr&   rk   rl   r|   r   r   r    ro   r   IsNamedTuple_CallAndUpdateTracerW   rV   r3   intr!   
IndexErrorAddAccessedProperty_asdictr   r   r   
_GetMemberGetFileAndLineAddErrorAddSeparatorrT   AddCompletionScriptcopyr   EmbedAddInteractiveMode)'r7   r:   r=   r?   r9   r   r%   r   show_completionr0   r/   r   rD   instancert   last_componentinitial_args
saved_argsused_separatorseparator_indexhandledcandidate_errorsis_callableis_callable_objectis_sequenceis_mapis_classerrorargr   filenamelinenoru   component_dictr   r   consumed_argsscript	variabless'                                          rH   r+   r+   i  s   f $$' ,,+(()$///##)%%* IOO)	zC/ (.N!LyK:"1"= 7nJNN"&,,Y7o!/A"5"67j%&67nnN***G//),L0A0A)0LK!),@[Yu6K	4(PL,E,Ei,PF{ +h	7$7!)gy%%%'!	>  
^'88{~1c7Ce$	 
'+++useXv	7 v.a f 
	"	"9	-"**,"	>	!"6*	>>#s#~5"6>>#s#;<	   "	JCs3xIG	 
'+++vx6	; ,f5 56~7"3=~4'0	=.'66yA&++v}h	@ )7$7 	%"!	>
  ',Q/e\ul3	'9+5
BOON+  0#$$&N*#z1 $N"~'E 	B 0.A  |KLLd$5_MF''/I)io.Ik#Ih(Ig"iNN9g&&&(	a  7 5667 *% 7;SB 567~  7 5667  7 5667s[   #P! Q AR  $R* !	Q*QQ.Q=<Q= 	R'	R""R'*	S3SSc                     t        |       }|d   }||j                  dd      g}|D ]  }||v st        | |      |g|dd fc S  t        d|      )at  Returns a subcomponent of component by consuming an arg from args.

  Given a starting component and args, this function gets a member from that
  component, consuming one arg in the process.

  Args:
    component: The component from which to get a member.
    args: Args from which to consume in the search for the next component.
  Returns:
    component: The component that was found by consuming an arg.
    consumed_args: The args that were consumed by getting this member.
    remaining_args: The remaining args that haven't been consumed yet.
  Raises:
    FireError: If we cannot consume an argument to get a member.
  r   r   rw   r   NzCould not consume arg:)dirr   getattrrV   )r7   r:   ry   r   	arg_namesarg_names         rH   r   r   n  ss      	N'Q#		kk#s)
  ;h7Y)C5$qr(::; 	*C00rJ   c           	         |s| }t        j                  |       \  }}t        j                  |       }|dk(  r| j                  n| }t        ||      }	 |	|      \  \  }
}}}}t        j                  |      r,t        j                         }|j                   ||
i |      } n ||
i |} |dk(  rt        j                  }n&|dk(  rt        j                  }nt        j                  }|j                  | ||||||       | |fS )a  Call the component by consuming args from args, and update the FireTrace.

  The component could be a class, a routine, or a callable object. This function
  calls the component and adds the appropriate action to component_trace.

  Args:
    component: The component to call
    args: Args for calling the component
    component_trace: FireTrace object that contains action trace
    treatment: Type of treatment used. Indicating whether we treat the component
        as a class, a routine, or a callable.
    target: Target in FireTrace element, default is None. If the value is None,
        the component itself will be used as target.
  Returns:
    component: The object that is the result of the callable call.
    remaining_args: The remaining args that haven't been consumed yet.
  r|   r   r   )action)r   r   r   GetMetadata__call___MakeParseFnIsCoroutineFunctionasyncioget_event_looprun_until_completer
   INSTANTIATED_CLASSCALLED_ROUTINECALLED_CALLABLEAddCalledComponent)r7   r:   rD   r   ru   r   r   metadatafnparsevarargskwargsr   rt   capacityloopr   s                    rH   r   r     s   & 
F!00;(F##I.(&*4y)"
r8
$%?DT{<7F]NH %%b)!!#D''G(>v(>?IG&v&I'%%FI!!F""F$$&( %  
N	""rJ   c                     t        j                  |       t        j                        t        j                        z
  t        j                        t        j                        z
  fd}|S )a  Creates a parse function for fn.

  Args:
    fn: The function or class to create the parse function for.
    metadata: Additional metadata about the component the parse function is for.
  Returns:
    A parse function for fn. The parse function accepts a list of arguments
    and returns (varargs, kwargs), remaining_args. The original function fn
    can then be called with fn(*varargs, **kwargs). The remaining_args are
    the leftover args from the arguments to the parse function.
  c                 0   t        |       \  }}}t        j                  j                  ||      \  }}}}j                  sj
                  rd}t        |      t        j                        z
  }j
                  |rt        d|      t              t        |      z
  }|rt        d|      j                  |g }}ng }t        |      D ]  \  }	}
t        |
dd      ||	<    ||z   }||z  }| dt        |       t        |      z
   }||f|||fS )zAParses the list of `args` into (varargs, kwargs), remaining_args.TNzUnexpected kwargs present:zMissing required flags:)rn   
_ParseArgsr:   defaultsr   varkwr~   
kwonlyargsrV   	enumerate_ParseValuer   )r:   r   rx   rt   parsed_argsr   extra_kwmissing_kwonlyr   r   r   r   rv   r   num_required_argsrequired_kwonlys               rH   _ParseFnz_MakeParseFn.<locals>._ParseFn  s>   /@w/O,Fn 5?g&&(965"1K '--h6{S!3!344H}}2H==)CK7N/@@ " .~gg!'* @u"5$h?gen@ G#G&&N9#d)c.&99:MVm^XEErJ   )r   rm   r   r:   r   r~   r   kwonlydefaults)r   r   r  rv   r  r  s    ` @@@rH   r   r     sd     ''+' ',,'#g.>.>*??**+c'2H2H.II/"FH 
/rJ   c                    |j                  t        j                        }d}g }t        |       D ]  \  }	}
|j	                  |
d      }| t        ||	|
|      }|j                  |       :|r3|r1|j	                  d      }t        ||	|
|      }|j                  |       o|	|k  rt        d|
      d}|	|z
  }|j                  ||           |j                         D ]  \  }}t        |d||      ||<    ||||fS )a  Parses the positional and named arguments from the available supplied args.

  Modifies kwargs, removing args as they are used.

  Args:
    fn_args: A list of argument names that the target function accepts,
        including positional and named arguments, but not the varargs or kwargs
        names.
    fn_defaults: A list of the default values in the function argspec.
    num_required_args: The number of required arguments from the function's
        argspec. This is the number of arguments without a default value.
    kwargs: Dict with named command line arguments and their values.
    remaining_args: The remaining command line arguments, which may still be
        used as positional arguments.
    metadata: Metadata about the function, typically from Fire decorators.
  Returns:
    parsed_args: A list of values to be used as positional arguments for calling
        the target function.
    kwargs: The input dict kwargs modified with the used kwargs removed.
    remaining_args: A list of the supplied args that have not been used yet.
    capacity: Whether the call could have taken args in place of defaults.
  Raises:
    FireError: If additional positional arguments are expected, but none are
        available.
  FNr   z9The function received no value for the required argument:T)	getr   ACCEPTS_POSITIONAL_ARGSr   popr   r3   rV   r   )fn_argsfn_defaultsr  r   rt   r   accepts_positional_argsr   r   r   r   r   default_indexr   s                 rH   r   r     s'   6 %LL)K)KL( +g& 7jeSJJsD!E%X6e	3""1%E5#x85!$$GN 	N
  11;}56'7* LLN :jc5eT39F3K: 
fnh	66rJ   c                    i }g }g }|j                   }|j                  |j                  z   }| s|||fS d}t        |       D ]  \  }}	|rd}t	        |	      rwd|	v }
|	j                  d      }|
r|j                  dd      \  }}n|}d}|j                  dd      }|
 xr$ |dz   t        |       k(  xs t	        | |dz            }d}||v s|r|j                  d      r|d	d |v s|r|}nYt        |      dk(  rK|D cg c]  }|d
   |k(  s| }}t        |      dk(  r|d
   }nt        |      dkD  rt        d|	 d|       |sd}nI|
rd}nD|r%d}||v rd}n9|j                  d      r|d	d }d}n d}n|dz   t        |       k  sJ | |dz      }d}|
 xr | }|r|||<   a|j                  |	       |sv|j                  | |dz             |j                  |	        |||fS c c}w )a  Parses the supplied arguments for keyword arguments.

  Given a list of arguments, finds occurrences of --name value, and uses 'name'
  as the keyword and 'value' as the value. Constructs and returns a dictionary
  of these keyword arguments, and returns a list of the remaining arguments.

  Only if fn_keywords is None, this only finds argument names used by the
  function, specified through fn_args.

  This returns the values of the args as strings. They are later processed by
  _ParseArgs, which converts them to the appropriate type.

  Args:
    args: A list of arguments.
    fn_spec: The inspectutils.FullArgSpec describing the given callable.
  Returns:
    kwargs: A dictionary mapping keywords to values.
    remaining_kwargs: A list of the unused kwargs from the original args.
    remaining_args: A list of the unused arguments from the original args.
  Raises:
    FireError: If a single-character flag is passed that could refer to multiple
        possible args.
  F=r   r   Nrw    nor   r   zThe argument 'zD' is ambiguous as it could refer to any of the following arguments: TTrueFalse)r   r:   r   r   _IsFlaglstripr   r   r   
startswithrV   r3   )r:   rv   r   rx   rt   fn_keywordsr
  skip_argumentr   argumentcontains_equalsstripped_argumentr   r   is_bool_syntaxkeywordr   matching_fn_argsgot_arguments                      rH   rn   rn   0  sz   0 &.+LL7---'	#^33-"4 P&oeXmx xo"//#.	&,,S!4
UKKS!c++ Mc$i/K74	?3K  g
.!5#ab'W:Ls8q=+2DCc!fmCDD A%$Q''!"Q&xj )::J9KM   g%%ABK'%% qy3t9$$$UQY
 *)@..@m	w)

!
!$uqy/
2H%aP&d 
!>	11] Es   ;G(	G(c                 2    t        |       xs t        |       S )a  Determines if the argument is a flag argument.

  If it starts with a hyphen and isn't a negative number, it's a flag.

  Args:
    argument: A command line argument that may or may not be a flag.
  Returns:
    A boolean indicating whether the argument is a flag.
  )_IsSingleCharFlag_IsMultiCharFlagr  s    rH   r  r    s     
8	$	B(8(BBrJ   c                 ^    t        j                  d|       xs t        j                  d|       S )z=Determines if the argument is a single char flag (e.g. '-a').z^-[a-zA-Z]$z^-[a-zA-Z]=)rematchr#  s    rH   r!  r!    s#    	-	*	Obhh}h.OOrJ   c                 T    | j                  d      xs t        j                  d|       S )zADetermines if the argument is a multi char flag (e.g. '--alpha').z--z
^-[a-zA-Z])r  r%  r&  r#  s    rH   r"  r"    s#    			T	"	Fbhh|X&FFrJ   c                     t         j                  }|j                  t        j                        }|r<|d   }|d   }|d   }|d|cxk  rt        |      k  r	n n||   }n||v r||   }n||} ||       S )a  Parses value, a string, into the appropriate type.

  The function used to parse value is determined by the remaining arguments.

  Args:
    value: The string value to be parsed, typically a command line argument.
    index: The index of the value in the function's argspec.
    arg: The name of the argument the value is being parsed for.
    metadata: Metadata about the function, typically from Fire decorators.
  Returns:
    value, parsed into the appropriate type for calling a function.
  default
positionalnamedr   )r	   DefaultParseValuer  r   FIRE_PARSE_FNSr   )	r   r   r   r   parse_fn	parse_fnsr)  r*  r+  s	            rH   r   r     s     %%( ll:445)	"G<(JgEQ%9#j/9E"h	sh		h	%rJ   )NNNN)FN)Fr   )r   N)+rZ   r   r&   r   r   r%  r   r   r   firer   r   r   r   r   r   r	   r
   r   fire.consoler   rI   r4   rT   	ExceptionrV   
SystemExitr.   rz   r6   r-   r   r   r+   r   r   r   r   rn   r  r!  r"  r   r[   rJ   rH   <module>r4     s   #J    	 	  
           #[|!
9
	 !z !*B$$N'6 F**BJ1< EL#,#^7t87vu2p
CP
G
rJ   