
    F\h                       S r Sr/ SQrSSKrSSKrSSKr SSK	J	r
Jr  SrS	rS
rSrSrSrSr " S S\5      rS r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rS r " S S\5      r " S S \5      r " S! S"\5      r \" 5       r! " S# S$\ 5      r" " S% S&\ 5      r# " S' S(\ 5      r$ " S) S*\$5      r% " S+ S,\$5      r& " S- S.\ 5      r' " S/ S0\ 5      r( " S1 S2\ 5      r) " S3 S4\ 5      r* " S5 S6\ 5      r+ " S7 S8\ 5      r, " S9 S:\'5      r- " S; S<\5      r. " S= S>\5      r/ " S? S@\5      r0 " SA SB\05      r1 " SC SD\15      r2 " SE SF\\05      r3g! \ a    S r	\	r
C	S r GNXf = f)Ga
  Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1)ArgumentParserArgumentErrorArgumentTypeErrorBooleanOptionalActionFileTypeHelpFormatterArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterRawTextHelpFormatterMetavarTypeHelpFormatter	NamespaceActionONE_OR_MOREOPTIONALPARSER	REMAINDERSUPPRESSZERO_OR_MORE    N)gettextngettextc                     U $ N )messages    /usr/lib/python3.13/argparse.pyr   r   _   s        c                     US:X  a  U $ U$ N   r   )singularpluralns      r   r   r   c   s    6OMr   z==SUPPRESS==?*+zA......_unrecognized_argsc                   *    \ rS rSrSrS rS rS rSrg)_AttributeHolderv   a  Abstract base class that provides __repr__.

The __repr__ method returns a string in the format::
    ClassName(attr=name, attr=name, ...)
The attributes are determined either by a class-level attribute,
'_kwarg_names', or by inspecting the instance __dict__.
c                    [        U 5      R                  n/ n0 nU R                  5        H  nUR                  [	        U5      5        M     U R                  5        H8  u  pVUR                  5       (       a  UR                  U< SU< 35        M4  XcU'   M:     U(       a  UR                  S[	        U5      -  5        U< SSR                  U5      < S3$ )N=z**%s(, ))type__name__	_get_argsappendrepr_get_kwargsisidentifierjoin)self	type_namearg_strings	star_argsargnamevalues          r   __repr___AttributeHolder.__repr__   s    J''		>>#CtCy) $++-KD  """"dE#:;"'$	 .
 vY78$dii&<==r   c                 H    [        U R                  R                  5       5      $ r   )list__dict__itemsr8   s    r   r5   _AttributeHolder._get_kwargs   s    DMM'')**r   c                     / $ r   r   rE   s    r   r2   _AttributeHolder._get_args   s    	r   r   N)	r1   
__module____qualname____firstlineno____doc__r?   r5   r2   __static_attributes__r   r   r   r)   r)   v   s    >+r   r)   c                 d    U c  / $ [        U 5      [        L a  U S S  $ SS KnUR                  U 5      $ Nr   )r0   rB   copy)rD   rP   s     r   _copy_itemsrQ      s5    }	 E{dQx99Ur   c                       \ rS rSrSr   S"S jrS rS r " S S\5      r	S	 r
S
 rS rS rS#S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S  r!S!r"g)$r      zFormatter for generating usage messages and argument help strings.

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
Nc                    Uc$   SS K nUR                  5       R                  nUS-  nXl        X l        [        U[        US-
  US-  5      5      U l        X@l	        SU l
        SU l        SU l        U R                  U S 5      U l        U R                  U l        [         R"                  " S[         R$                  5      U l        [         R"                  " S5      U l        g ! [         a    Sn Nf = f)Nr      F      z\s+z\n\n\n+)shutilget_terminal_sizecolumnsImportError_prog_indent_incrementminmax_max_help_position_width_current_indent_level_action_max_length_Section_root_section_current_section_recompileASCII_whitespace_matcher_long_break_matcher)r8   progindent_incrementmax_help_positionwidth_shutils         r   __init__HelpFormatter.__init__   s     =(113;;
 
!1"%&7&)%"*6F6J&K#M "#!]]46 $ 2 2#&;;vsyy#A #&;;z#: #  s   #C C-,C-c                 l    U =R                   U R                  -  sl         U =R                  S-  sl        g r   rb   r]   rc   rE   s    r   _indentHelpFormatter._indent   s'     6 66qr   c                     U =R                   U R                  -  sl         U R                   S:  d   S5       eU =R                  S-  sl        g )Nr   zIndent decreased below 0.r   ru   rE   s    r   _dedentHelpFormatter._dedent   sA     6 66##q(E*EE(qr   c                   $    \ rS rSrSS jrS rSrg)zHelpFormatter._Section   Nc                 6    Xl         X l        X0l        / U l        g r   )	formatterparentheadingrD   )r8   r~   r   r   s       r   rr   HelpFormatter._Section.__init__   s    &N K"LDJr   c           	         U R                   b  U R                  R                  5         U R                  R                  nU" U R                   VVs/ s H
  u  p#U" U6 PM     snn5      nU R                   b  U R                  R                  5         U(       d  gU R                  [        LaK  U R                  b>  U R                  R                  n[        S5      [        U R                  S9-  nSUSU4-  nOSnU" SXtS/5      $ s  snnf )N z%(heading)s:)r   %*s%s

)r   r~   rv   _join_partsrD   ry   r   r   rb   _dict)r8   r7   funcargs	item_helpcurrent_indentheading_textr   s           r   format_help"HelpFormatter._Section.format_help   s    {{&&&(>>--DDJJGJjddDkJGHI{{&&&(  ||8+0H!%!?!? 043MM#~r<&HH w4899# Hs   D
)r~   r   rD   r   r   )r1   rI   rJ   rK   rr   r   rM   r   r   r   re   HelpFormatter._Section   s    		:r   re   c                 P    U R                   R                  R                  X45        g r   )rg   rD   r3   )r8   r   r   s      r   	_add_itemHelpFormatter._add_item   s    ##**D<8r   c                     U R                  5         U R                  X R                  U5      nU R                  UR                  / 5        X l        g r   )rv   re   rg   r   r   )r8   r   sections      r   start_sectionHelpFormatter.start_section   s;    --&;&;WEw**B/ 'r   c                 Z    U R                   R                  U l         U R                  5         g r   )rg   r   ry   rE   s    r   end_sectionHelpFormatter.end_section  s     $ 5 5 < <r   c                 Z    U[         La"  Ub  U R                  U R                  U/5        g g g r   )r   r   _format_text)r8   texts     r   add_textHelpFormatter.add_text
  s-    xD$4NN4,,tf5 %5r   c                 X    U[         La!  XX44nU R                  U R                  U5        g g r   )r   r   _format_usage)r8   usageactionsgroupsprefixr   s         r   	add_usageHelpFormatter.add_usage  s-     61DNN4--t4 !r   c                    UR                   [        La  U R                  n[        U" U5      5      U R                  -   /nU R                  U5       H0  nUR                  [        U" U5      5      U R                  -   5        M2     [        U5      n[        U R                  U5      U l        U R                  U R                  U/5        g g r   )helpr   _format_action_invocationlenrb   _iter_indented_subactionsr3   r_   rd   r   _format_action)r8   actionget_invocationinvocation_lengths	subactionaction_lengths         r   add_argumentHelpFormatter.add_argument  s    ;;h& ";;N"%nV&<"=@T@T"T!U!;;FC	"))#nY.G*H4K_K_*_` D   23M&)$*A*A*7'9D# NN4..9 'r   c                 8    U H  nU R                  U5        M     g r   )r   )r8   r   r   s      r   add_argumentsHelpFormatter.add_arguments$  s    Ff% r   c                     U R                   R                  5       nU(       a0  U R                  R                  SU5      nUR	                  S5      S-   nU$ )N

r   )rf   r   rl   substrip)r8   r   s     r   r   HelpFormatter.format_help,  sI    !!--/++//=D::d#d*Dr   c                 x    SR                  U Vs/ s H  nU(       d  M  U[        Ld  M  UPM     sn5      $ s  snf )Nr   )r7   r   )r8   part_stringsparts      r   r   HelpFormatter._join_parts3  sC    ww$0:$0D $($8 $0: ; 	; :s   777c                   ^ Uc  [        S5      nUb  U[        U R                  S9-  nGOUc  U(       d  S[        U R                  S9-  nGOUGc  S[        U R                  S9-  n/ n/ nU H8  nUR                  (       a  UR	                  U5        M'  UR	                  U5        M:     U R
                  n	U	" Xg-   U5      n
SR                  XZ4 Vs/ s H  o(       d  M  UPM     sn5      nU R                  U R                  -
  m[        U5      [        U5      -   T:  Ga  U R                  Xc5      nU R                  Xs5      nS
U4S jjn[        U5      [        U5      -   ST-  ::  ab  S[        U5      [        U5      -   S-   -  nU(       a%  U" U/U-   X5      nUR                  U" X5      5        OyU(       a  U" U/U-   X5      nOdU/nO`S[        U5      -  nX-   nU" UU5      n[        U5      S:  a0  / nUR                  U" X5      5        UR                  U" X5      5        U/U-   nSR                  U5      nU< U< S	3$ s  snf )Nzusage: rm   z%(prog)s c                   > / n/ n[        U5      nUb  [        U5      S-
  nOUS-
  nU  Hk  nUS-   [        U5      -   T:  a1  U(       a*  UR                  USR                  U5      -   5        / nUS-
  nUR                  U5        U[        U5      S-   -  nMm     U(       a#  UR                  USR                  U5      -   5        Ub  US   US  US'   U$ )Nr   r   r   )r   r3   r7   )	partsindentr   lineslineindent_lengthline_lenr   
text_widths	           r   	get_lines.HelpFormatter._format_usage.<locals>.get_lines_  s    ED$'KM)#&v;?#01#4 %#a<#d)3j@T!LL#((4.)@A#%D'4q'8HD) CIM1 !& Vchhtn%<=)#(8MN#;a Lr   g      ?r   r   r   r   )r   r   r\   option_stringsr3   _format_actions_usager7   ra   rb   r   _get_actions_usage_partsextend)r8   r   r   r   r   rm   	optionalspositionalsr   formataction_usages	opt_parts	pos_partsr   r   r   r   r   s                     @r   r   HelpFormatter._format_usage8  s0   >y\F Ddjj11E ]74::!66E ]$** 55D IK!(($$V,&&v.	 " //F!)"96BLHH$)=C)=Aa)=CDE t';';;J6{SZ'*4 !99)L	 99+N	!, v;T*dZ.?? CK#d)$;a$?@F  )4&9*<f MYy%AB" )4&9*<f M!% !3v;.F%1E%eV4E5zA~ "Yy%ABYy%AB!FUNE 		%( $U++u Ds   
IIc                 B    SR                  U R                  X5      5      $ )Nr   )r7   r   )r8   r   r   s      r   r   #HelpFormatter._format_actions_usage  s    xx55gFGGr   c                    [        5       n0 nU H  nUR                  (       d  [        SU 35      e[        S UR                   5       5      (       a  ME   UR	                  UR                  S   5      nU[        UR                  5      -   nXU UR                  :X  a"  UR                  UR                  5        XTXg4'   M  M     / nU H  n	U	R                  [        L a  S n
OU	R                  (       d?  U R                  U	5      nU R                  X5      n
X;   a  U
S   S:X  a  U
S   S:X  a  U
SS n
OvU	R                  S   nU	R                  S:X  a  U	R                  5       n
O+U R                  U	5      nU R                  X5      nU< SU< 3n
U	R                  (       d
  X;  a  S	U
-  n
UR!                  U
5        M     [        5       n[#        US
S9 H  u  pgXFU4   nXU  Vs/ s H	  oc  M  UPM     nn[        U5      nUR                  (       a  US:  a  SOSu  nnOSu  nnUUS   -   US'   US   U-   US'   [%        US S US9 H'  u  nn
UU;  d  M  U
S-   UU'   UR'                  U5        M)     US   XU-   S-
  '   [)        UU-   U5       H  nS UU'   M
     M     U Vs/ s H	  oc  M  UPM     sn$ ! [         a     GM  f = fs  snf s  snf )Nzempty group c              3   D   #    U  H  oR                   [        L v   M     g 7fr   )r   r   ).0r   s     r   	<genexpr>9HelpFormatter._get_actions_usage_parts.<locals>.<genexpr>  s     N9Mv;;(*9Ms    r   []r   r   [%s]T)reverse())r   r   z[])startz |)set_group_actions
ValueErrorallindexr   updater   r   r   #_get_default_metavar_for_positional_format_argsnargsformat_usage!_get_default_metavar_for_optionalrequiredr3   sorted	enumerateaddrange)r8   r   r   group_actionsinsertsgroupr   endr   r   r   defaultoption_stringargs_stringinserted_separators_indicesitemgroup_parts
group_sizeopencloseis                        r   r   &HelpFormatter._get_actions_usage_parts  s   E'' <w!788N9M9MNNN0e&:&:1&=> c%"6"677%)=)==!(()=)=>*/EJ' > $ F {{h& **BB6J((9 *Aw#~$r(c/#Abz !' 5 5a 8 <<1$!..0D
 #DDVLG"&"3"3F"DK&3[AD 6+F!D=D LLK P '*e# $7JE3J'E,1,<Q,<D4,<KQ[)J~~&01nd(e"e!KN2KN)"o5KO$["%5UC477#d{E!H/33A6	 D
 -8OE*$q()5:-s3a 4! 8( "';;;O  j R$ <s*   J2 K*KK	)K	2
K Kc                     SU;   a  U[        U R                  S9-  n[        U R                  U R                  -
  S5      nSU R                  -  nU R                  XU5      S-   $ )Nz%(prog)r      r   r   )r   r\   r_   ra   rb   
_fill_text)r8   r   r   r   s       r   r   HelpFormatter._format_text  s^    $DJJ//Dt';';;R@
t+++t86AAr   c                    [        U R                  S-   U R                  5      n[        U R                  U-
  S5      nX R
                  -
  S-
  nU R                  U5      nUR                  (       d  U R
                  SU4nSU-  nO<[        U5      U::  a  U R
                  SXE4nSU-  nSnOU R
                  SU4nSU-  nUnU/nUR                  (       a  UR                  R                  5       (       ag  U R                  U5      n	U	(       aN  U R                  X5      n
UR                  SWSU
S   4-  5        U
SS   H  nUR                  SUSU4-  5        M     O'UR                  S5      (       d  UR                  S5        U R                  U5       H#  nUR                  U R                  U5      5        M%     U R!                  U5      $ )	NrU   r  r   r   z	%*s%-*s  r   r   r   )r^   rd   r`   r_   ra   rb   r   r   r   r   _expand_help_split_linesr3   endswithr   r   r   )r8   r   help_position
help_widthaction_widthaction_headertupindent_firstr   	help_text
help_linesr   r   s                r   r   HelpFormatter._format_action  s   D33a7 335}4b9
$';';;a?66v> {{&&M9C%OM </&&LGC'#-ML &&M9C%OM(L  ;;6;;,,..))&1I!..yE
Y,JqM)JJK&qrNDLLmR-F!FG + ''--LL 77?ILL,,Y78 @ &&r   c                 n   UR                   (       d7  U R                  U5      nSR                  U R                  X5      " S5      5      $ UR                  S:X  a  SR                  UR                   5      $ U R                  U5      nU R                  X5      nSR                  UR                   5      S-   U-   $ )Nr   r   r   r.   )r   r   r7   _metavar_formatterr   r   r   )r8   r   r   r   s       r   r   'HelpFormatter._format_action_invocation   s    $$>>vFG88D33FDQGHH ||q yy!6!677
 @@H"//@yy!6!67#=KKr   c                    ^ UR                   b  UR                   mO<UR                  b-  SSR                  [        [        UR                  5      5      -  mOUmU4S jnU$ )N{%s},c                 >   > [        T[        5      (       a  T$ T4U -  $ r   )
isinstancetuple)
tuple_sizeresults    r   r   0HelpFormatter._metavar_formatter.<locals>.format;  s"    &%((zJ..r   )metavarchoicesr7   mapstr)r8   r   default_metavarr   r"  s       @r   r   HelpFormatter._metavar_formatter3  sO    >>%^^F^^'chhs3'?@@F$F	/
 r   c                    U R                  X5      nUR                  c  SU" S5      -  nU$ UR                  [        :X  a  SU" S5      -  nU$ UR                  [        :X  a&  U" S5      n[	        U5      S:X  a  SU-  nU$ SU-  n U$ UR                  [
        :X  a  SU" S5      -  nU$ UR                  [        :X  a  SnU$ UR                  [        :X  a  S	U" S5      -  nU$ UR                  [        :X  a  S
nU$  [        UR                  5       Vs/ s H  nSPM     nnSR                  U5      U" UR                  5      -  nU$ s  snf ! [         a    [        S5      S ef = f)Nz%sr   r   rU   z[%s [%s ...]]z[%s ...]z%s [%s ...]r&   z%s ...r   zinvalid nargs valuer   )r  r   r   r   r   r   r   r   r   r   	TypeErrorr   r7   )r8   r   r(  get_metavarr"  r$  r   formatss           r   r   HelpFormatter._format_argsB  s   --fF<<KN*F. - \\X%k!n,F* ) \\\)!!nG7|q (72"  $g-  \\[("[^3F  \\Y&F  \\V#A.F  \\X%F B).v||)<=)<A4)<= XXg&V\\)BBF	 > B !67TABs   :E
 EE
 E
 
E!c                    [        [        U5      U R                  S9n[        U5       H  nX#   [        L d  M  X#	 M     [        U5       H(  n[        X#   S5      (       d  M  X#   R                  X#'   M*     UR                  S5      b%  SR                  [        [        US   5      5      US'   U R                  U5      U-  $ )Nr   r1   r%  r.   )r   varsr\   rB   r   hasattrr1   getr7   r&  r'  _get_help_string)r8   r   paramsr=   s       r   r  HelpFormatter._expand_help^  s    d6l4LD|x'L ! LDv|Z00%|44 ! ::i , $		#c6)3D*E FF9$$V,v55r   c              #      #     UR                   nU R                  5         U" 5        S h  vN   U R                  5         g  N! [         a     g f = f7fr   )_get_subactionsrv   ry   AttributeError)r8   r   get_subactionss      r   r   'HelpFormatter._iter_indented_subactionsj  sM     	#33N LLN%'''LLN (	  		s1   AA AA A
AAAAc                     U R                   R                  SU5      R                  5       nSS KnUR	                  X5      $ )Nr   r   )rk   r   r   textwrapwrap)r8   r   rp   r<  s       r   r  HelpFormatter._split_linest  s7    ''++C6<<> 	}}T))r   c                     U R                   R                  SU5      R                  5       nSS KnUR	                  XUUS9$ )Nr   r   )initial_indentsubsequent_indent)rk   r   r   r<  fill)r8   r   rp   r   r<  s        r   r	  HelpFormatter._fill_text{  sD    ''++C6<<>}}T,2/5  7 	7r   c                     UR                   $ r   )r   r8   r   s     r   r3  HelpFormatter._get_help_string      {{r   c                 6    UR                   R                  5       $ r   )destupperrE  s     r   r   /HelpFormatter._get_default_metavar_for_optional  s    {{  ""r   c                     UR                   $ r   )rI  rE  s     r   r   1HelpFormatter._get_default_metavar_for_positional  rG  r   )rd   rb   rg   r]   rc   rl   r`   r\   rf   rk   ra   )rU      Nr   )#r1   rI   rJ   rK   rL   rr   rv   ry   objectre   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r   r  r	  r3  r   r   rM   r   r   r   r   r      s     #$#%	;F
:6 :@9(65
:"&;
V,pHT<lB.'`L&8
6*7#r   r   c                       \ rS rSrSrS rSrg)r	   i  zHelp message formatter which retains any formatting in descriptions.

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
c                 T   ^ SR                  U4S jUR                  SS9 5       5      $ )Nr   c              3   .   >#    U  H
  nTU-   v   M     g 7fr   r   )r   r   r   s     r   r   9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>  s     P1Ov}1Os   T)keepends)r7   
splitlines)r8   r   rp   r   s      `r   r	  &RawDescriptionHelpFormatter._fill_text  s#    wwP$1OPPPr   r   N)r1   rI   rJ   rK   rL   r	  rM   r   r   r   r	   r	     s    Qr   r	   c                       \ rS rSrSrS rSrg)r
   i  zHelp message formatter which retains formatting of all help text.

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
c                 "    UR                  5       $ r   )rU  )r8   r   rp   s      r   r  !RawTextHelpFormatter._split_lines  s      r   r   N)r1   rI   rJ   rK   rL   r  rM   r   r   r   r
   r
     s    !r   r
   c                       \ rS rSrSrS rSrg)r   i  zHelp message formatter which adds default values to argument help.

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
c                     UR                   nUc  SnSU;  aN  UR                  [        La;  [        [        /nUR
                  (       d  UR                  U;   a  U[        S5      -  nU$ )Nr   z
%(default)z (default: %(default)s))r   r   r   r   r   r   r   r   )r8   r   r   defaulting_nargss       r   r3  .ArgumentDefaultsHelpFormatter._get_help_string  s^    {{<Dt#~~X-$,l#; ((FLL<L,LA788Dr   r   N)r1   rI   rJ   rK   rL   r3  rM   r   r   r   r   r     s    
r   r   c                   $    \ rS rSrSrS rS rSrg)r   i  zHelp message formatter which uses the argument 'type' as the default
metavar value (instead of the argument 'dest')

Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
c                 .    UR                   R                  $ r   r0   r1   rE  s     r   r   :MetavarTypeHelpFormatter._get_default_metavar_for_optional      {{###r   c                 .    UR                   R                  $ r   r`  rE  s     r   r   <MetavarTypeHelpFormatter._get_default_metavar_for_positional  rb  r   r   N)r1   rI   rJ   rK   rL   r   r   rM   r   r   r   r   r     s    $$r   r   c                 8   U c  g U R                   (       a  SR                  U R                   5      $ U R                  S [        4;  au  U R                  n[	        U[
        5      (       d  U$ U R                  [        :X  a  [        U5      S:X  a  SU-  $ U R                  [        :X  a  SU-  $ SR                  U5      $ U R                  S [        4;  a  U R                  $ U R                  (       a,  SSR                  [        [        U R                  5      5      -  $ g )N/rU   z%s[, %s]r.   r  r  )r   r7   r$  r   r  r   r   r   r   r   rI  r%  r&  r'  )argumentr$  s     r   _get_action_namerh    s    		 	 xx//00			$!1	1""'5))N>>\)c'la.?''^^{*''99W%%	tX.	.}}			S(*:*:!;<<<r   c                   $    \ rS rSrSrS rS rSrg)r   i  zAn error from creating or using an argument (optional or positional).

The string value of this exception is the message, augmented with
information about the argument that caused it.
c                 0    [        U5      U l        X l        g r   )rh  argument_namer   )r8   rg  r   s      r   rr   ArgumentError.__init__  s    -h7r   c                 z    U R                   c  SnO[        S5      nU[        U R                  U R                   S9-  $ )Nz%(message)sz'argument %(argument_name)s: %(message)s)r   rk  )rk  r   r   r   )r8   r   s     r   __str__ArgumentError.__str__  sA    %"F@AFT\\+/+=+=? ? 	?r   )rk  r   N)r1   rI   rJ   rK   rL   rr   rn  rM   r   r   r   r   r     s    ?r   r   c                       \ rS rSrSrSrg)r   i  z@An error from trying to convert a command line string to a type.r   N)r1   rI   rJ   rK   rL   rM   r   r   r   r   r     s    Jr   r   c                   J    \ rS rSrSr         S	S jrS rS rS
S jrSr	g)r   i  a  Information about how to convert command line strings to Python objects.

Action objects are used by an ArgumentParser to represent the information
needed to parse a single argument from one or more strings from the
command line. The keyword arguments to the Action constructor are also
all attributes of Action instances.

Keyword Arguments:

    - option_strings -- A list of command-line option strings which
        should be associated with this action.

    - dest -- The name of the attribute to hold the created object(s)

    - nargs -- The number of command-line arguments that should be
        consumed. By default, one argument will be consumed and a single
        value will be produced.  Other values include:
            - N (an integer) consumes N arguments (and produces a list)
            - '?' consumes zero or one arguments
            - '*' consumes zero or more arguments (and produces a list)
            - '+' consumes one or more arguments (and produces a list)
        Note that the difference between the default and nargs=1 is that
        with the default, a single value will be produced, while with
        nargs=1, a list containing a single value will be produced.

    - const -- The value to be produced if the option is specified and the
        option uses an action that takes no values.

    - default -- The value to be produced if the option is not specified.

    - type -- A callable that accepts a single string argument, and
        returns the converted value.  The standard Python types str, int,
        float, and complex are useful examples of such callables.  If None,
        str is used.

    - choices -- A container of values that should be allowed. If not None,
        after a command-line argument has been converted to the appropriate
        type, an exception will be raised if it is not a member of this
        collection.

    - required -- True if the action must always be specified at the
        command line. This is only meaningful for optional command-line
        arguments.

    - help -- The help string describing the argument.

    - metavar -- The name to be used for the option's argument with the
        help string. If None, the 'dest' value will be used as the name.
Nc                     Xl         X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl        Xl	        Xl
        g r   r   rI  r   constr   r0   r%  r   r   r$  
deprecated)r8   r   rI  r   rt  r   r0   r%  r   r   r$  ru  s               r   rr   Action.__init__1  s<     -	

	 	$r   c                 N    / SQnU Vs/ s H  o"[        X5      4PM     sn$ s  snf )Nrs  getattrr8   namesr=   s      r   r5   Action._get_kwargsI  s+    
 9>>wt*+>>>   "c                      U R                   S   $ rO   )r   rE   s    r   r   Action.format_usageY  s    ""1%%r   c                 *    [        [        S5      5      e)Nz.__call__() not defined)NotImplementedErrorr   r8   parser	namespacevaluesr   s        r   __call__Action.__call__\  s    !!$=">??r   )r%  rt  r   ru  rI  r   r$  r   r   r   r0   	NNNNNFNNFr   )
r1   rI   rJ   rK   rL   rr   r5   r   r  rM   r   r   r   r   r     s:    0j !%0? &@r   r   c                   J   ^  \ rS rSrS\\SS\S4U 4S jjrSS jrS rSrU =r	$ )	r   ic  NFc
                 v  > / n
U HE  nU
R                  U5        UR                  S5      (       d  M,  SUSS  -   nU
R                  U5        MG     S H.  n[        5       U   [        Ld  M  SS KnUR                  USSS9  M0     U[        L a  S nU[        L a  S nU[        L a  S n[        TU ]  U
USUUUUUUU	S	9
  g )
N----no-rU   )r0   r%  r$  r   zP{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.)      )remove)
r   rI  r   r   r0   r%  r   r   r$  ru  )r3   
startswithlocals_deprecated_defaultwarnings_deprecatedsuperrr   )r8   r   rI  r   r0   r%  r   r   r$  ru  _option_stringsr   
field_namer  	__class__s                 r   rr   BooleanOptionalAction.__init__d  s     +M""=1''-- '-*; ;&&}5 , 9Jx
#+>>$$2"	 % $ 9 &&D))G))G*! 	 
	#r   c                 x    X@R                   ;   a+  [        X R                  UR                  S5      (       + 5        g g )Nr  )r   setattrrI  r  r  s        r   r  BooleanOptionalAction.__call__  s/    ///Iyym.F.Fw.O*OP 0r   c                 8    SR                  U R                  5      $ )Nz | )r7   r   rE   s    r   r   "BooleanOptionalAction.format_usage  s    zz$--..r   r   r   )
r1   rI   rJ   rK   r  rr   r  r   rM   __classcell__r  s   @r   r   r   c  s0     ),,!0#fQ/ /r   r   c                   H   ^  \ rS rSr         SU 4S jjrSS jrSrU =r$ )_StoreActioni  c                    > US:X  a  [        S5      eUb  U[        :w  a  [        S[        -  5      e[        [        U ]  UUUUUUUUU	U
US9  g )Nr   znargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate nargs must be %r to supply constrs  )r   r   r  r  rr   r8   r   rI  r   rt  r   r0   r%  r   r   r$  ru  r  s               r   rr   _StoreAction.__init__  sv     A: K L L (!2?(JKKlD*)! 	+ 	#r   c                 0    [        X R                  U5        g r   )r  rI  r  s        r   r  _StoreAction.__call__  s    	99f-r   r   r  r   r1   rI   rJ   rK   rr   r  rM   r  r  s   @r   r  r    s/    
 !#>. .r   r  c                   B   ^  \ rS rSr      SU 4S jjrSS jrSrU =r$ )_StoreConstActioni  c	                 6   > [         [        U ]  UUSUUUUUS9  g )Nr   )r   rI  r   rt  r   r   r   ru  )r  r  rr   
r8   r   rI  rt  r   r   r   r$  ru  r  s
            r   rr   _StoreConstAction.__init__  s2     	/)! 	0 	#r   c                 D    [        X R                  U R                  5        g r   )r  rI  rt  r  s        r   r  _StoreConstAction.__call__  s    	99djj1r   r   NNFNNFr   r  r  s   @r   r  r    s&    
 !#&2 2r   r  c                   4   ^  \ rS rSr    SU 4S jjrSrU =r$ )_StoreTrueActioni  c           
      4   > [         [        U ]  UUSUUUUS9  g )NT)r   rI  rt  ru  r   r   r   )r  r  rr   r8   r   rI  r   r   r   ru  r  s          r   rr   _StoreTrueAction.__init__  s/     	.)! 	/ 	r   r   )FFNFr1   rI   rJ   rK   rr   rM   r  r  s   @r   r  r    s    
 ! r   r  c                   4   ^  \ rS rSr    SU 4S jjrSrU =r$ )_StoreFalseActioni  c           
      4   > [         [        U ]  UUSUUUUS9  g )NF)r   rI  rt  r   r   r   ru  )r  r  rr   r  s          r   rr   _StoreFalseAction.__init__  s/     	/)! 	0 	#r   r   )TFNFr  r  s   @r   r  r    s    
 !# #r   r  c                   H   ^  \ rS rSr         SU 4S jjrSS jrSrU =r$ )_AppendActioni  c                    > US:X  a  [        S5      eUb  U[        :w  a  [        S[        -  5      e[        [        U ]  UUUUUUUUU	U
US9  g )Nr   znargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater  rs  )r   r   r  r  rr   r  s               r   rr   _AppendAction.__init__  sv     A: O P P (!2?(JKKmT+)! 	, 	#r   c                     [        X R                  S 5      n[        U5      nUR                  U5        [	        X R                  U5        g r   )ry  rI  rQ   r3   r  r8   r  r  r  r   rD   s         r   r  _AppendAction.__call__$  6    	99d3E"V	99e,r   r   r  r   r  r  s   @r   r  r    s/    
 !#>- -r   r  c                   B   ^  \ rS rSr      SU 4S jjrSS jrSrU =r$ )_AppendConstActioni+  c	                 8   > [         [        U ]  UUSUUUUUUS9	  g )Nr   )	r   rI  r   rt  r   r   r   r$  ru  )r  r  rr   r  s
            r   rr   _AppendConstAction.__init__-  s5     	 $0)! 	1 		#r   c                     [        X R                  S 5      n[        U5      nUR                  U R                  5        [        X R                  U5        g r   )ry  rI  rQ   r3   rt  r  r  s         r   r  _AppendConstAction.__call__A  s:    	99d3E"TZZ 	99e,r   r   r  r   r  r  s   @r   r  r  +  s&    
 !#(- -r   r  c                   >   ^  \ rS rSr    SU 4S jjrSS jrSrU =r$ )_CountActioniH  c           
      4   > [         [        U ]  UUSUUUUS9  g )Nr   )r   rI  r   r   r   r   ru  )r  r  rr   r  s          r   rr   _CountAction.__init__J  s.     	lD*)! 	+ 	#r   c                 l    [        X R                  S 5      nUc  Sn[        X R                  US-   5        g )Nr   r   )ry  rI  r  )r8   r  r  r  r   counts         r   r  _CountAction.__call__Z  s.    	99d3=E	99eai0r   r   )NFNFr   r  r  s   @r   r  r  H  s     
 !# 1 1r   r  c                   >   ^  \ rS rSr\\SS4U 4S jjrSS jrSrU =r$ )_HelpActionia  NFc           	      2   > [         [        U ]  UUUSUUS9  g )Nr   )r   rI  r   r   r   ru  )r  r  rr   )r8   r   rI  r   r   ru  r  s         r   rr   _HelpAction.__init__c  s+     	k4))! 	* 	#r   c                 D    UR                  5         UR                  5         g r   )
print_helpexitr  s        r   r  _HelpAction.__call__q  s    r   r   r   	r1   rI   rJ   rK   r   rr   r  rM   r  r  s   @r   r  r  a  s      !!# r   r  c                   @   ^  \ rS rSrS\\SS4U 4S jjrSS jrSrU =r$ )_VersionActioniv  NFc                 X   > Uc  [        S5      n[        [        U ]  UUUSUS9  X l        g )Nz&show program's version number and exitr   )r   rI  r   r   r   )r   r  r  rr   version)r8   r   r  rI  r   r   ru  r  s          r   rr   _VersionAction.__init__x  s?     <=>Dnd,) 	- 	 r   c                     U R                   nUc  UR                   nUR                  5       nUR                  U5        UR                  UR	                  5       [
        R                  5        UR                  5         g r   )r  _get_formatterr   _print_messager   _sysstdoutr  )r8   r  r  r  r   r  r~   s          r   r  _VersionAction.__call__  s[    ,,?nnG))+	7#i335t{{Cr   )r  r   r  r  s   @r   r  r  v  s#     !!" r   r  c                   h   ^  \ rS rSr " S S\5      r\SSS4U 4S jjrSS.S jrS	 r	SS
 jr
SrU =r$ )_SubParsersActioni  c                   (   ^  \ rS rSrU 4S jrSrU =r$ )z&_SubParsersAction._ChoicesPseudoActioni  c                    > U=pEU(       a  USSR                  U5      -  -  n[        [        R                  U 5      nUR	                  / XSUS9  g )Nz (%s)r.   )r   rI  r   r$  )r7   r  r  _ChoicesPseudoActionrr   )r8   r=   aliasesr   r$  rI  supr  s          r   rr   /_SubParsersAction._ChoicesPseudoAction.__init__  sQ    !!G7TYYw%777)>>ECLL!(  *r   r   r  r  s   @r   r  &_SubParsersAction._ChoicesPseudoAction  s    	* 	*r   r  FNc           
         > X l         X0l        0 U l        / U l        [	        5       U l        [        [        U ]#  UU[        U R                  UUUS9  g )N)r   rI  r   r%  r   r   r$  )
_prog_prefix_parser_class_name_parser_map_choices_actionsr   r  r  r  rr   r   )	r8   r   rm   parser_classrI  r   r   r$  r  s	           r   rr   _SubParsersAction.__init__  s[     !) " "5/))) 	0 	r   )ru  c                   UR                  S5      c  U R                  < SU< 3US'   UR                  SS5      nXR                  ;   a  [	        U [        S5      U-  5      eU H*  nXPR                  ;   d  M  [	        U [        S5      U-  5      e   SU;   a>  UR                  S5      nU R                  XU5      nU R                  R                  U5        U R                  " S0 UD6nXR                  U'   U H  nXR                  U'   M     U(       a6  U R                  R                  U5        U R                  R                  U5        U$ )Nrm   r   r  r   zconflicting subparser: %szconflicting subparser alias: %sr   )r2  r  popr  r   r   r  r  r3   r  r  r   r   )	r8   r=   ru  kwargsr  aliasr   choice_actionr  s	            r   
add_parser_SubParsersAction.add_parser  s;   ::f%(,(9(94@F6N**Y+(((a(C&Dt&KLLE---#!=>FH H  V::f%D 55dTJM!!((7 ##-f-&,d# E+1!!%(    &##G,r   c                     U R                   $ r   )r  rE   s    r   r7  !_SubParsersAction._get_subactions  s    $$$r   c                    US   nUSS  nU R                   [        La  [        X R                   U5         U R                  U   nXPR                  ;   a  UR                  [        S5      SU0-  5        UR                  US 5      u  p[        U
5      R                  5        H  u  p[        X+U5        M     U(       aF  [        U[        5      (       d  [        U[        / 5        [        U[        5      R!                  U5        g g ! [         a8    USR                  U R                  5      S.n[        S5      U-  n	[        X	5      ef = f)Nr   r   r.   )parser_namer%  z5unknown parser %(parser_name)r (choices: %(choices)s)z'command '%(parser_name)s' is deprecatedr  )rI  r   r  r  KeyErrorr7   r   r   r  _warningparse_known_argsr0  rD   r1  _UNRECOGNIZED_ARGS_ATTRry  r   )r8   r  r  r  r   r  r:   	subparserr   msgsubnamespacekeyr>   s                r   r  _SubParsersAction.__call__  s5   QiQRj 99H$Iyy+6	+--k:I ***OOAGH*K89 : %.$>$>{D$Q!|,224JCIE* 5 9&=>>	#:B?I67>>{K +  	+#.#yy)>)>?ADKLtSC**		+s   D AE)r  r  r  r  r  r   )r1   rI   rJ   rK   r   r  r   rr   r  r7  r  rM   r  r  s   @r   r  r    s>    *v * 0 .3  D%#L #Lr   r  c                       \ rS rSrSS jrSrg)_ExtendActioni  Nc                     [        X R                  S 5      n[        U5      nUR                  U5        [	        X R                  U5        g r   )ry  rI  rQ   r   r  r  s         r   r  _ExtendAction.__call__  r  r   r   r   )r1   rI   rJ   rK   r  rM   r   r   r   r
  r
    s    -r   r
  c                   .    \ rS rSrSrSS jrS rS rSrg)	r   i  a  Factory for creating file object types

Instances of FileType are typically passed as type= arguments to the
ArgumentParser add_argument() method.

Keyword Arguments:
    - mode -- A string indicating how the file is to be opened. Accepts the
        same values as the builtin open() function.
    - bufsize -- The file's desired buffer size. Accepts the same values as
        the builtin open() function.
    - encoding -- The file's encoding. Accepts the same values as the
        builtin open() function.
    - errors -- A string indicating how encoding and decoding errors are to
        be handled. Accepts the same value as the builtin open() function.
Nc                 4    Xl         X l        X0l        X@l        g r   )_mode_bufsize	_encoding_errors)r8   modebufsizeencodingerrorss        r   rr   FileType.__init__  s    
!r   c                 ^  ^  US:X  a  ST R                   ;   a:  ST R                   ;   a  [        R                  R                  $ [        R                  $ [	        U 4S jS 5       5      (       a:  ST R                   ;   a  [        R
                  R                  $ [        R
                  $ [        S5      T R                   -  n[        U5      e [        UT R                   T R                  T R                  T R                  5      $ ! [         a!  nXS.n[        S5      n[        XT-  5      eS nAff = f)	N-rbc              3   @   >#    U  H  oTR                   ;   v   M     g 7fr   )r  )r   cr8   s     r   r   $FileType.__call__.<locals>.<genexpr>(  s     4e$**_es   waxzargument "-" with mode %r)filenameerrorz$can't open '%(filename)s': %(error)s)r  r  stdinbufferanyr  r   r   r  r  r  r  OSErrorr   )r8   stringr  er   r   s   `     r   r  FileType.__call__#  s    S=djj ,/4::,=tzz((M4::M4e444-0DJJ->t{{))ODKKO34tzzA o%	4

DMM4>>& & 	4 &3D>?G#GN33	4s   
6D 
D,D''D,c           
      f   U R                   U R                  4nSU R                  4SU R                  4/nSR	                  U Vs/ s H  o3S:w  d  M
  [        U5      PM     snU VVs/ s H  u  pCUc  M
  U< SU< 3PM     snn-   5      n[        U 5      R                  < SU< S3$ s  snf s  snnf )Nr  r  r.   r   r,   r-   r/   )r  r  r  r  r7   r4   r0   r1   )r8   r   r  r<   kwargs_strs         r   r?   FileType.__repr__7  s    zz4==(t~~.4<<0HI994E4C"9id3i4EAG 2gb!$ 2S1 22 3  :..99 F2s   	B(B('	B-4B-)r  r  r  r  )r  r   NN)	r1   rI   rJ   rK   rL   rr   r  r?   rM   r   r   r   r   r     s     4(:r   r   c                   *    \ rS rSrSrS rS rS rSrg)r   iC  zSimple object for storing attributes.

Implements equality by attribute names and values, and provides a simple
string representation.
c                 2    U H  n[        XX   5        M     g r   )r  )r8   r  r=   s      r   rr   Namespace.__init__J  s    DD- r   c                 f    [        U[        5      (       d  [        $ [        U 5      [        U5      :H  $ r   )r  r   NotImplementedr0  )r8   others     r   __eq__Namespace.__eq__N  s(    %++!!DzT%[((r   c                     XR                   ;   $ r   )rC   )r8   r  s     r   __contains__Namespace.__contains__S  s    mm##r   r   N)	r1   rI   rJ   rK   rL   rr   r3  r6  rM   r   r   r   r   r   C  s    .)
$r   r   c                      ^  \ rS rSrU 4S jrS rSS jrS rS rS r	S r
S	 rS
 rS rS rS rS rSS jrS rS rS rS rSrU =r$ )_ActionsContaineriW  c                 :  > [         [        U ]  5         Xl        X0l        X l        X@l        0 U l        U R                  SS [        5        U R                  SS[        5        U R                  SS[        5        U R                  SS[        5        U R                  SS[        5        U R                  SS[        5        U R                  SS[        5        U R                  SS[        5        U R                  SS	[         5        U R                  SS
["        5        U R                  SS[$        5        U R                  SS[&        5        U R)                  5         / U l        0 U l        / U l        / U l        0 U l        [4        R6                  " S5      U l        / U l        g )Nr   storestore_const
store_truestore_falser3   append_constr  r   r  parsersr   z^-\d+$|^-\d*\.\d+$)r  r9  rr   descriptionargument_defaultprefix_charsconflict_handler_registriesregisterr  r  r  r  r  r  r  r  r  r  r
  _get_handler_actions_option_string_actions_action_groups_mutually_exclusive_groups	_defaultsrh   ri   _negative_number_matcher_has_negative_number_optionals)r8   rA  rC  rB  rD  r  s        r   rr   _ActionsContainer.__init__Y  sT   
 	/1& 0( 0  	hl3h6h/@Ah.>?h/@Ah-8h0BCh6h4h	>:h	+<=h-8 	 &(# !*,'  ),4I(J% /1+r   c                 D    U R                   R                  U0 5      nX4U'   g r   )rE  
setdefault)r8   registry_namer>   rO  registrys        r   rF  _ActionsContainer.register  s!    ##..}bA r   c                 >    U R                   U   R                  X#5      $ r   )rE  r2  )r8   rR  r>   r   s       r   _registry_get_ActionsContainer._registry_get  s    .225BBr   c                     U R                   R                  U5        U R                   H(  nUR                  U;   d  M  XR                     Ul        M*     g r   )rL  r   rH  rI  r   )r8   r  r   s      r   set_defaults_ActionsContainer.set_defaults  s>    f% mmF{{f$!'!4 $r   c                     U R                    H0  nUR                  U:X  d  M  UR                  c  M$  UR                  s  $    U R                  R	                  US 5      $ r   )rH  rI  r   rL  r2  )r8   rI  r   s      r   get_default_ActionsContainer.get_default  sH    mmF{{d"v~~'A~~% $ ~~!!$--r   c                 P   U R                   nU(       a  [        U5      S:X  a7  US   S   U;  a+  U(       a  SU;   a  [        S5      eU R                  " U0 UD6nOU R                  " U0 UD6nSU;  aC  US   nX@R
                  ;   a  U R
                  U   US'   OU R                  b  U R                  US'   U R                  U5      n[        U5      (       d  [        SU< S35      eU" S0 UD6nU R                  S	UR                  UR                  5      n[        U5      (       d  [        U< S
35      eU[        L a  [        U< S35      e[        U S5      (       a!   U R                  5       R                  US5        U R!                  U5      $ ! [         a    [        S5      ef = f)zk
add_argument(dest, ..., name=value, ...)
add_argument(option_string, option_string, ..., name=value, ...)
r   r   rI  z+dest supplied twice for positional argumentr   Nzunknown action ""r0   z is not callablez: is a FileType class object, instance of it must be passedr  z,length of metavar tuple does not match nargsr   )rC  r   r   _get_positional_kwargs_get_optional_kwargsrL  rB  _pop_action_classcallablerV  r0   r   r1  r  r   r+  _add_action)r8   r   r  charsrI  action_classr   	type_funcs           r   r   _ActionsContainer.add_argument  s    !!s4yA~$q'!*E*A&( !NOO00$A&AF ..??F F"&>D~~%$(NN4$8y!&&2$($9$9y! --f5%%lDEE'' &&vv{{FKKH		""Y@AA 2;> ? ? 4)**Q##%2264@ ''  Q !OPPQs    F F%c                 Z    [        U /UQ70 UD6nU R                  R                  U5        U$ r   )_ArgumentGrouprJ  r3   )r8   r   r  r   s       r   add_argument_group$_ActionsContainer.add_argument_group  s/    t5d5f5""5)r   c                 T    [        U 40 UD6nU R                  R                  U5        U$ r   )_MutuallyExclusiveGrouprK  r3   )r8   r  r   s      r   add_mutually_exclusive_group._ActionsContainer.add_mutually_exclusive_group  s*    '77''..u5r   c                 r   U R                  U5        U R                  R                  U5        Xl        UR                   H  nXR
                  U'   M     UR                   HS  nU R                  R                  U5      (       d  M%  U R                  (       a  M8  U R                  R                  S5        MU     U$ )NT)	_check_conflictrH  r3   	containerr   rI  rM  matchrN  )r8   r   r   s      r   rd  _ActionsContainer._add_action  s    V$ 	V$ $22M9?''6 3 $22M,,22=AA:::77>>tD 3 r   c                 :    U R                   R                  U5        g r   )rH  r  rE  s     r   _remove_action _ActionsContainer._remove_action   s    V$r   c                    0 nU R                    HC  nUR                  U;   a"  [        S5      n[        XCR                  -  5      eX2UR                  '   ME     0 nUR                    Hq  nUR                  U;  a;  U R	                  UR                  UR
                  UR                  S9X#R                  '   UR                   H  nX#R                     XV'   M     Ms     UR                   H]  nUR                  UL a  U nOX#R                  R                     nUR                  UR                  S9nUR                   H  nXU'   M	     M_     UR                   H#  nUR                  X`5      R                  U5        M%     g )Nz.cannot merge actions - two groups are named %r)titlerA  rD  )r   )rJ  rz  r   r   rk  rA  rD  r   rK  
_containerro  r   rH  r2  rd  )	r8   rs  title_group_mapr   r  	group_mapr   contmutex_groups	            r   _add_container_actions(_ActionsContainer._add_container_actions  sb   ((E{{o- HI !455+0EKK( ) 	--E {{/1/3/F/F++ % 1 1%*%;%; 0G 0=,  ..$3KK$@	! / ." 99E9,&'7'7'='=>;; < )K  ..$/&! / :  ((FMM&'33F; )r   c                     SU;   a  [        S5      n[        U5      eUR                  S5      nU[        [        [
        [        S4;  a  SUS'   [        X!/ S9$ )Nr   z1'required' is an invalid argument for positionalsr   r   TrI  r   )r   r+  r2  r   r   r   r   r   )r8   rI  r  r  r   s        r   r`  (_ActionsContainer._get_positional_kwargs1  s[    GHCC.  

7#<HaHH!%F: Fb99r   c                    / n/ nU H  nUS   U R                   ;  a'  UU R                   S.n[        S5      n[        Xa-  5      eUR                  U5        [	        U5      S:  d  M_  US   U R                   ;   d  Mt  UR                  U5        M     UR                  SS 5      nUc_  U(       a  US   nOUS   nUR                  U R                   5      nU(       d  [        S5      n[        UW-  5      eUR                  SS5      n[        X'US	9$ )
Nr   )optionrC  zNinvalid option string %(option)r: must start with a character %(prefix_chars)rr   rI  z%dest= is required for options like %rr  r   r  )	rC  r   r   r3   r   r  lstripreplacer   )	r8   r   r  r   long_option_stringsr   r  rI  dest_option_strings	            r   ra  &_ActionsContainer._get_optional_kwargs@  s    !M #t'8'88"/(,(9(9; G H ,, !!-0=!A%-*:d>O>O*O#**=9 " zz&$'<"%8%;"%3A%6"%,,T->->?D?@ }!455<<S)D FnEEr   c                 J    UR                  SU5      nU R                  SX35      $ )Nr   )r  rV  )r8   r  r   r   s       r   rb  #_ActionsContainer._pop_action_classb  s%    Hg.!!(F;;r   c                     SU R                   -  n [        X5      $ ! [         a#    [        S5      n[	        X R                   -  5      ef = f)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rD  ry  r8  r   r   )r8   handler_func_namer  s      r   rG  _ActionsContainer._get_handlerf  sQ    1D4I4II	:433 	:;<CS#8#8899	:s	   
 -A	c                     / nUR                    H5  nX0R                  ;   d  M  U R                  U   nUR                  X445        M7     U(       a  U R                  5       nU" X5        g g r   )r   rI  r3   rG  )r8   r   confl_optionalsr   confl_optionalrD  s         r   rr  !_ActionsContainer._check_conflicto  sg     #22M ; ;;!%!<!<]!K&&'FG 3 #002V5 r   c                     [        SS[        U5      5      nSR                  U VVs/ s H  u  pAUPM	     snn5      n[        WX5-  5      es  snnf )Nzconflicting option string: %szconflicting option strings: %sr.   )r   r   r7   r   )r8   r   conflicting_actionsr   r   conflict_strings         r   _handle_conflict_error(_ActionsContainer._handle_conflict_error}  sb    :;235 ))(;%=(; *? &3(;%= > FG$=>>%=s   A
c                     U Hj  u  p1UR                   R                  U5        U R                  R                  US 5        UR                   (       a  MO  UR                  R                  U5        Ml     g r   )r   r  rI  r  rs  rw  )r8   r   r  r   s       r   _handle_conflict_resolve*_ActionsContainer._handle_conflict_resolve  s_     &9!M !!((7''++M4@ (((  //7 &9r   )rJ  rH  rL  rN  rK  rM  rI  rE  rB  rD  rA  rC  r   )r1   rI   rJ   rK   rr   rF  rV  rY  r\  r   rk  ro  rd  rw  r  r`  ra  rb  rG  rr  r  r  rM   r  r  s   @r   r9  r9  W  sh    01l!C5.1(f

*%,<\: FD<:6?8 8r   r9  c                   P   ^  \ rS rSrSU 4S jjrU 4S jrU 4S jrU 4S jrSrU =r	$ )rj  i  c                   > UR                   nU" SUR                  5        U" SUR                  5        U" SUR                  5        [        [
        U ]  nU" SSU0UD6  X l        / U l        UR                  U l	        UR                  U l
        UR                  U l        UR                  U l        UR                  U l        UR                  U l        g )NrD  rC  rB  rA  r   )rQ  rD  rC  rB  r  rj  rr   rz  r   rE  rH  rI  rL  rN  rK  )r8   rs  rz  rA  r  r   
super_initr  s          r   rr   _ArgumentGroup.__init__  s    ""!9#=#=>~y556!9#=#=>>49
5{5f5 
  %00!**&/&F&F#",,44 	+*3*N*N'r   c                 d   > [         [        U ]  U5      nU R                  R	                  U5        U$ r   )r  rj  rd  r   r3   r8   r   r  s     r   rd  _ArgumentGroup._add_action  s-    ~t8@""6*r   c                 b   > [         [        U ]  U5        U R                  R	                  U5        g r   )r  rj  rw  r   r  r  s     r   rw  _ArgumentGroup._remove_action  s&    nd26:""6*r   c                 V   > SS K nUR                  S[        SS9  [        TU ]  " U0 UD6$ )Nr   z&Nesting argument groups is deprecated.rU   category
stacklevel)r  warnDeprecationWarningr  rk  r8   r   r  r  r  s       r   rk  !_ArgumentGroup.add_argument_group  s7    4' 	 	

 w)4:6::r   )rH  rL  r   rN  rK  rI  rE  rz  NN)
r1   rI   rJ   rK   rr   rd  rw  rk  rM   r  r  s   @r   rj  rj    s    O,
+; ;r   rj  c                   D   ^  \ rS rSrSU 4S jjrS rS rU 4S jrSrU =r	$ )rn  i  c                 D   > [         [        U ]  U5        X l        Xl        g r   )r  rn  rr   r   r{  )r8   rs  r   r  s      r   rr    _MutuallyExclusiveGroup.__init__  s    %t5i@ #r   c                     UR                   (       a  [        S5      n[        U5      eU R                  R	                  U5      nU R
                  R                  U5        U$ )Nz-mutually exclusive arguments must be optional)r   r   r   r{  rd  r   r3   )r8   r   r  s      r   rd  #_MutuallyExclusiveGroup._add_action  sK    ??CDCS/!,,V4""6*r   c                 p    U R                   R                  U5        U R                  R                  U5        g r   )r{  rw  r   r  rE  s     r   rw  &_MutuallyExclusiveGroup._remove_action  s(    &&v.""6*r   c                 V   > SS K nUR                  S[        SS9  [        TU ]  " U0 UD6$ )Nr   z0Nesting mutually exclusive groups is deprecated.rU   r  )r  r  r  r  ro  r  s       r   ro  4_MutuallyExclusiveGroup.add_mutually_exclusive_group  s7    >' 	 	

 w3TDVDDr   )r{  r   )F)
r1   rI   rJ   rK   rr   rd  rw  ro  rM   r  r  s   @r   rn  rn    s    $
+E Er   rn  c                     ^  \ rS rSrSrSSSS/ \SSSSSSS4U 4S jjrS rS	 rS
 r	S r
S rS'S jrS'S jrS rS rS rS rS rS rS rS rS rS'S jrS'S jrS rS rS rS rS rS rS(S  jrS(S! jr S(S" jr!S)S# jr"S$ r#S% r$S&r%U =r&$ )*r   i  a  Object for parsing command line strings into Python objects.

Keyword Arguments:
    - prog -- The name of the program (default:
        ``os.path.basename(sys.argv[0])``)
    - usage -- A usage message (default: auto-generated from arguments)
    - description -- A description of what the program does
    - epilog -- Text following the argument descriptions
    - parents -- Parsers whose arguments should be copied into this one
    - formatter_class -- HelpFormatter class for printing help messages
    - prefix_chars -- Characters that prefix optional arguments
    - fromfile_prefix_chars -- Characters that prefix files containing
        additional arguments
    - argument_default -- The default value for all arguments
    - conflict_handler -- String indicating how to handle conflicts
    - add_help -- Add a -h/-help option
    - allow_abbrev -- Allow long options to be abbreviated unambiguously
    - exit_on_error -- Determines whether or not ArgumentParser exits with
        error info when an error occurs
Nr  r!  Tc           	        > [         [        U ]
  nU" UUU	U
S9  Uc0  [        R                  R                  [        R                  S   5      nXl        X l	        X@l
        X`l        Xl        Xl        Xl        Xl        U R                   nU" [#        S5      5      U l        U" [#        S5      5      U l        S U l        S nU R+                  SS U5        SU;   a  SOUS   nU R                  (       a)  U R-                  US-   US	-  S
-   S
[.        [#        S5      S9  U H[  n[1        U[        5      (       d  [3        S5      eU R5                  U5        UR6                  nU R6                  R9                  U5        M]     g )N)rA  rC  rB  rD  r   zpositional argumentsoptionsc                     U $ r   r   )r&  s    r   identity)ArgumentParser.__init__.<locals>.identity  s    Mr   r0   r  hrU   r   zshow this help message and exit)r   r   r   z(parents must be a list of ArgumentParser)r  r   rr   _ospathbasenamer  argvrm   r   epilogformatter_classfromfile_prefix_charsadd_helpallow_abbrevexit_on_errorrk  r   _positionals
_optionals_subparsersrF  r   r   r  r+  r  rL  r   )r8   rm   r   rA  r  parentsr  rC  r  rB  rD  r  r  r  	superinit	add_groupr  default_prefixr   defaultsr  s                       r   rr   ArgumentParser.__init__  s^    .$8	k+#3#3	5 <88$$TYYq\2D	
.%:" (*++	%a(>&?@#AiL1	fdH- !$| 3a==s"N1$4V$;x89  ; Ffn55 JKK''/''HNN!!(+ r   c                 N    / SQnU Vs/ s H  o"[        X5      4PM     sn$ s  snf )N)rm   r   rA  r  rD  r  rx  rz  s      r   r5   ArgumentParser._get_kwargs4  s+    
 9>>wt*+>>>r}  c                    U R                   b  [        S [        S5      5      eUR                  S[	        U 5      5        SU;   d  SU;   aD  UR                  S[        S5      5      nUR                  SS 5      nU R                  X#5      U l         OU R                  U l         UR                  S5      cj  U R                  5       nU R                  5       nU R                  nUR                  U R                  XVS5        UR                  5       R                  5       US'   U R!                  US5      nU" S
S	/ 0UD6nU R                   R#                  U5        U$ )Nz(cannot have multiple subparser argumentsr  rz  rA  subcommandsrm   r   r@  r   r   )r  r   r   rQ  r0   r  rk  r  r2  r  _get_positional_actionsrK  r   r   r   r   rb  rd  )	r8   r  rz  rA  r~   r   r   parsers_classr   s	            r   add_subparsersArgumentParser.add_subparsersC  s6   'a(R&STT 	.$t*5f 7JJw-(89E **]D9K#66uJD#00D ::f%++-I668K44F

KD&224::<F6N ..vyA;b;F;$$V, r   c                     UR                   (       a  U R                  R                  U5        U$ U R                  R                  U5        U$ r   )r   r  rd  r  rE  s     r   rd  ArgumentParser._add_actionb  s?      OO''/  ))&1r   c                 l    U R                    Vs/ s H  nUR                  (       d  M  UPM     sn$ s  snf r   rH  r   rE  s     r   _get_optional_actions$ArgumentParser._get_optional_actionsi  s4    "mm*+F(( +* 	* *   11c                 l    U R                    Vs/ s H  nUR                  (       a  M  UPM     sn$ s  snf r   r  rE  s     r   r  &ArgumentParser._get_positional_actionsn  s4    "mm.+F,, +. 	. .r  c                     U R                  X5      u  pU(       aM  [        S5      SR                  U5      -  nU R                  (       a  U R	                  U5        U$ [        S U5      eU$ Nzunrecognized arguments: %sr   )r  r   r7   r  r!  r   r8   r   r  r  r  s        r   
parse_argsArgumentParser.parse_argsw  s^    **4;
01CHHTNBC!!

3  $D#..r   c                 "    U R                  XSS9$ )NF
intermixed)_parse_known_args2)r8   r   r  s      r   r  ArgumentParser.parse_known_args  s    &&t5&IIr   c                 4   Uc  [         R                  SS  nO[        U5      nUc
  [        5       nU R                   Hi  nUR
                  [        Ld  M  [        X$R
                  5      (       a  M4  UR                  [        Ld  MI  [        X$R
                  UR                  5        Mk     U R                   H.  n[        X%5      (       a  M  [        X%U R                  U   5        M0     U R                  (       a   U R                  XU5      u  p!OU R                  XU5      u  p![        U[         5      (       a/  UR#                  [%        U[         5      5        ['        U[         5        X!4$ ! [         a$  nU R                  [        U5      5         S nANpS nAff = fr   )r  r  rB   r   rH  rI  r   r1  r   r  rL  r  _parse_known_argsr   r!  r'  r  r   ry  delattr)r8   r   r  r  r   rI  errs          r   r  !ArgumentParser._parse_known_args2  s=   <99QR=D :D !I mmF{{(*y++66~~X5	;;G	 $ NND9++	)=> #
 %"&"8"8*"U	4 #44TjQOI9566KK	+BCDI67 ! %

3s8$$%s   9E) )
F3FFc           	      
  ^ ^^^^^^ ^!^"^#^$^%^& T R                   b  T R                  T5      m0 mT R                   Hi  nUR                  n[	        UR                  5       HA  u  pgTR                  U/ 5      nUR                  US U 5        UR                  XVS-   S  5        MC     Mk     0 m!/ n	[        T5      n
[	        U
5       Hg  u  pkUS:X  a-  U	R                  S5        U
 H  nU	R                  S5        M     M8  T R                  U5      nUc  SnOUT!U'   SnU	R                  U5        Mi     SR                  U	5      m[        5       m#[        5       m$[        5       m&SUUU#U$U 4S jjm%UUUU U!U U%U&4S jnT R                  5       m"UUU"U U%U&4S	 jn/ m/ m S
nT!(       a  [        T!5      nOSnUU::  a  UnUU::  a  UT!;   a  OUS-  nUU::  a  M  U(       d  UU:w  a  U" U5      nUU:  a  UnMA  UnUT!;  a,  TUU nTR                  U5        T R                  TUU 5        UnU" U5      nUU::  a  M  U(       d  U" U5      nTR                  TUS  5        OTR                  TUS  5        T R                  TUS  5        SR                  T 5      m [        T 5      [        T5      :X  d   e[        TT 5       VVs/ s H  u  nnUS:w  d  M  UPM     snnmT R!                  SS5      mU" S
5      n[	        T 5       H!  u  nnU(       d    OUS:w  d  M  US-  nS TU'   M#     T Vs/ s H
  nUc  M  UPM     snm/ nT R"                   H  nUT#;  d  M  UR$                  (       a  UR                  ['        U5      5        M8  UR(                  c  MG  [+        UR(                  [,        5      (       d  Mh  [/        TUR0                  5      (       d  M  UR(                  [3        TUR0                  5      L d  M  [5        TUR0                  T R7                  UUR(                  5      5        M     U(       a'  [9        S [;        S5      SR                  U5      -  5      eT R                   H  nUR$                  (       d  M  UR                   H  nUT$;   d  M    M0     UR                   Vs/ s H#  nUR<                  [>        Ld  M  ['        U5      PM%     nn[;        S5      n[9        S USR                  U5      -  5      e   TT4$ s  snnf s  snf s  snf )Nr   r  r  AOr   c                 J  > T	R                  U 5        TR                  X5      nU R                  (       d  U(       aT  T
R                  U 5        TR                  U / 5       H-  nUT
;   d  M  [	        S5      n[        U5      n[        XU-  5      e   U[        La  U " TTX25        g g )Nznot allowed with argument %s)r   _get_valuesr   r2  r   rh  r   r   )r   argument_stringsr   argument_valuesconflict_actionr  action_nameaction_conflictsr  seen_actionsseen_non_default_actionsr8   s          r   take_action5ArgumentParser._parse_known_args.<locals>.take_action  s    V$"..vHO $$(8(,,V4'7';';FB'GO&*BB >?&6&G+F+4EFF	 (H h.tYG /r   c                   > TU    n[        U5      S:  aL  SR                  U VVVVs/ s H  u  p#pEUPM
     snnnn5      nTU    US.n[        S5      n[        S X-  5      eUS   u  p#pETR                  n	/ n
 Uc*  TR                  TU    5        TR                  S5        U S-   $ UGb  U	" US5      nTR                  nUS:X  a  US   U;  a  US:w  a  U(       d	  US   U;   a  [        S	5      n[        X(U-  5      eU
R                  U/ U45        US   nXS   -   nTR                  nX>;   a(  X   nUSS  nU(       d  S =pEOUS   S
:X  a  S
nUSS  nOSnOTR                  X-   5        TR                  S5        U S-   nOoUS:X  a  U S-   nU/nU
R                  X'U45        OM[        S	5      n[        X(U-  5      eU S-   nTUS  nU	" UU5      nUU-   nTUU nU
R                  X'U45        OGMv  U
(       d   eU
 HV  u  p'nUR                  (       a6  UT;  a0  TR                  [        S5      SU0-  5        TR                  U5        T" X'U5        MX     U$ s  snnnnf )Nr   r.   )r  matchesz4ambiguous option: %(option)s could match %(matches)sr   r  r  r   zignored explicit argument %rr,   z!option '%(option)s' is deprecatedr  )r   r7   r   r   _match_argumentr3   rC  rI  ru  r  r   )start_indexoption_tuplesr   r   sepexplicit_argr  r   r  match_argumentaction_tuples	arg_countre  charoptionals_mapstopr   selected_patternsr:   arg_strings_patternextrasextras_patternoption_string_indicesr8   r  warneds                     r   consume_optional:ArgumentParser._parse_known_args.<locals>.consume_optional  s    2+>M=!A%))DQ%SDQ@s &3DQ%S T"-k":wONO#D#*557DQ7G4F3 "11NM >MM+k":;"))#.&?*  + .vs ;I
 !--E!Q)!,E9(B.,q/U":"#$B"CC"/l8J"KK%,,fb--HI,Q/(,A(>(,(C(C(9%2%AF+7+;L#/59 9l!-aC!7&)/;AB/?&("MM$*=>*11#6#.?D! #a*Q ,~%,,fM-JK
   >?+F,4FGG (!OE(;EF(C% .v7H II 9,D&uT2D!((&)FGI P ! =/<+m$$f)DMM!$G"H#+]";#< =JJ}-F-8 0= Kw%Ss   Ic                 v  > T
R                   nTU S  nU" T	U5      n[        T	U5       H  u  pETX U-    nUR                  [        :X  a&  TU    S:X  a  US   S:X  d   eUR	                  S5        O>UR                  [
        :w  a*  TR                  SU X-   5      S:  a  UR	                  S5        X-  n U(       ae  UR                  (       aT  UR                  T;  aD  T
R                  [        S5      SUR                  0-  5        TR                  UR                  5        T" XF5        M     T	[        U5      S  T	S S & U $ )Nr  r   r  z*argument '%(argument_name)s' is deprecatedrk  )_match_arguments_partialzipr   r   r  r   findru  rI  r  r   r   r   )r  match_partialselected_pattern
arg_countsr   r	  r   r:   r  r   r8   r  r  s          r   consume_positionals=ArgumentParser._parse_known_args.<locals>.consume_positionalsV  s8    99M2;<@&{4DEJ &)j%A!";i0GH<<6)*;73>#Aw$.D)\\Y.+00k1<1HJMNOD)(F--&++V2KMM!$P"Q#2FKK"@#A BJJv{{+F)! &B( )Z)9:KNr   r   r   z(the following arguments are required: %sr.   z#one of the arguments %s is requiredr   r   ) r  _read_args_from_filesrK  r   r   rQ  r   iterr3   _parse_optionalr7   r   r  r_   r   r  r  rH  r   rh  r   r  r'  r1  rI  ry  r  
_get_valuer   r   r   r   )'r8   r:   r  r  r  r   r  mutex_action	conflictsarg_string_pattern_partsarg_strings_iter
arg_stringr  patternr  r  r  max_option_string_indexnext_option_string_indexpositionals_end_indexstrings
stop_indexr   r  required_actionsr   r   r{  r  r  r  r  r  r  r   r  r  r  r  s'   ```                          @@@@@@@@@@r   r   ArgumentParser._parse_known_args  s   %%144[AK ::K'66M#,[-G-G#H,77bI	  r!23  1uv!67 $I ; !##% ,&'78MA T!(//4"2J,33C8 #3 !% 4 4Z @ (!G/<)!,!G(//8# 9( !gg&>? u#&5 	H 	H(a	 a	J 224	 	B  &)*?&@#&(#44 (3$*.EE+/DD(A-( +.EE +1I"I(;K(H% );6"7K"7K "77%k2JKg&%%&9+F^&_`6 +;7K9 44< ,[9J MM+jk23MM+kl34!!"5kl"CDWW^4N~&#f+555),V^)DQ)DAS1)DQK"0"8"8b"A,Q/J!.11!8!OJ $F1I 2 "(9A1a9F mmF\)??$++,<V,DE 2"6>>377	6;;77')V[[*II	6;; $ GI $  a(R&Syy!12'3 4 4 44E~~~#22F!99 3 ,1+?+?=+? &8 ; 6-f5+?  = ABC'cCHHUO.CDD 5 &  g R :D=s$   5S4S4S:)S:S?4S?c                 H   / nU H  nU(       a  US   U R                   ;  a  UR                  U5        M0   [        USS  [        R                  " 5       [        R
                  " 5       S9 n/ nUR                  5       R                  5        H,  nU R                  U5       H  nUR                  U5        M     M.     U R                  U5      nUR                  U5        S S S 5        M     U$ ! , (       d  f       M  = f! [         a  n[        S [        U5      5      eS nAff = f)Nr   r   )r  r  )r  r3   r  r  getfilesystemencodinggetfilesystemencodeerrorsreadrU  convert_arg_line_to_argsr  r   r%  r   r'  )r8   r:   new_arg_stringsr&  	args_filearg_liner<   r  s           r   r  $ArgumentParser._read_args_from_files  s   %J Ad6P6P!P&&z28jn'+'A'A'C%)%C%C%EGJS&((1(8(C(C(EH'+'D'DX'N + 2 23 7 (O )F '+&@&@&M'..{;G G &, G G  8'c#h778s6   4C=*A3C+C=+
C:	5C=:C==
D!DD!c                     U/$ r   r   )r8   r6  s     r   r3  'ArgumentParser.convert_arg_line_to_args  s
    zr   c                 z   U R                  U5      n[        R                  " X25      nUcx  S [        S5      [        [        S5      [
        [        S5      0nUR                  UR                  5      nUc$  [        SSUR                  5      UR                  -  n[        X5      e[        UR                  S5      5      $ )Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsr   )_get_nargs_patternrh   rt  r   r   r   r2  r   r   r   r   r   )r8   r   r  nargs_patternrt  nargs_errorsr  s          r   r  ArgumentParser._match_argument  s    //7		-= =a/0!;<Q?@L
 ""6<<0C{56%||-/5||<  ,, 5;;q>""r   c           	          [        [        U5      SS5       H  nUS U nSR                  U Vs/ s H  nU R                  U5      PM     sn5      n[        R
                  " Xb5      nUc  MT  UR                  5        Vs/ s H  n[        U5      PM     n	nUR                  5       [        U5      :  a=  X'R                  5          S:X  a'  U	(       a   U	S   (       d  U	S	 U	(       a  U	S   (       d  M  U	s  $    / $ s  snf s  snf )Nr   r   r   r  )r   r   r7   r;  rh   rt  r   r   )
r8   r   r  r  actions_slicer   r'  rt  r&  r"  s
             r   r  'ArgumentParser._match_arguments_partial	  s     s7|Q+A#BQKMgg-:<-:6  $66v>-:< =GIIg;E 49LLNCN&#f+NCIIK#&9"::+IIK8C? "2J ! , 	< Ds   C6
=C;c                    U(       d  g US   U R                   ;  a  g XR                  ;   a  U R                  U   nX!S S 4/$ [        U5      S:X  a  g UR                  S5      u  p4nU(       a#  X0R                  ;   a  U R                  U   nX#XE4/$ U R	                  U5      nU(       a  U$ U R
                  R                  U5      (       a  U R                  (       d  g SU;   a  g S US S 4/$ )Nr   r   r,   r   )rC  rI  r   	partition_get_option_tuplesrM  rt  rN  )r8   r&  r   r   r  r  r  s          r   r   ArgumentParser._parse_optional"	  s    !} 1 11 44400<Ft455 z?a ,6+?+?+D(L=$?$??00?FC>?? //
;  
 ((..z::66 * z4.//r   c                    / nU R                   nUS   U;   a  US   U;   a  U R                  (       am  UR                  S5      u  pEnU(       d  S =pVU R                   H?  nUR	                  U5      (       d  M  U R                  U   nXqXV4nUR                  U5        MA     U$ US   U;   a  US   U;  a  UR                  S5      u  pEnU(       d  S =pVUS S n	USS  n
U R                   H~  nX:X  a'  U R                  U   nXqSU
4nUR                  U5        M/  U R                  (       d  MB  UR	                  U5      (       d  MZ  U R                  U   nXqXV4nUR                  U5        M     U$ [        S [        S5      U-  5      e)Nr   r   r,   rU   r   zunexpected option string: %s)rC  r  rC  rI  r  r3   r   r   )r8   r   r"  re  option_prefixr  r  r   r  short_option_prefixshort_explicit_args              r   rD  !ArgumentParser._get_option_tuplesP	  s    !!u$q)9U)B  3@3J3J33O0L)--C%)%@%@M$//>>!%!<!<]!K$SFc*	 &A> - 1&=+;5+H/</F/Fs/K,M%))"/"3!.qr!2!%!<!< 7!88GF 5GGCMM#&&&&=+C+CM+R+R!88GF BCMM#& "=   a(F&G-&WXXr   c                    UR                   nUR                  nUc  U(       a  SnU$ SnU$ U[        :X  a  U(       a  SnU$ SnU$ U[        :X  a  U(       a  SnU$ SnU$ U[        :X  a  U(       a  SnU$ SnU$ U[
        :X  a  U(       a  S	nU$ S
nU$ U[        :X  a  U(       a  SnU$ SnU$ U[        :X  a  U(       a  SnU$ SnU$ U(       a  SU-  OSU-  nU$ )Nz([A])z(-*A-*)z(A?)z(-*A?-*)z(A*)z	(-*[A-]*)z(A+)z
(-*A[A-]*)z([AO]*)z(.*)z(A[AO]*)z(-*A[-AO]*)r   z(-*)z
([AO]{%d})z((?:-*A){%d}-*))r   r   r   r   r   r   r   r   )r8   r   r   r  r<  s        r   r;  !ArgumentParser._get_nargs_pattern|	  sL    && ='-GM> ? 4=M> 9 h&,FM6 7 3=M6 1 l"&,FM. / 3>M. ) k!&,FM& ' 3?M& ! i)/IM  6<M  f_*0JM  7DM  h$*DM  17M  5;L50@QTY@YM r   c                     U R                  X5      u  pU(       aM  [        S5      SR                  U5      -  nU R                  (       a  U R	                  U5        U$ [        S U5      eU$ r  )parse_known_intermixed_argsr   r7   r  r!  r   r  s        r   parse_intermixed_args$ArgumentParser.parse_intermixed_args	  s^    55dF
01CHHTNBC!!

3  $D#..r   c                     U R                  5       nU Vs/ s H!  nUR                  [        [        4;   d  M  UPM#     nnU(       a  [	        SUS   R                  -  5      eU R                  XSS9$ s  snf )Nz3parse_intermixed_args: positional arg with nargs=%sr   Tr  )r  r   r   r   r+  r  )r8   r   r  r   r   as         r   rN  *ArgumentParser.parse_known_intermixed_args	  s     224"- 5+ 33 + 5 --.qTZZ8 9 9 &&t4&HH5s
   A1A1c                 2   U(       d  UR                   [        :X  al  UR                  (       a  UR                  nOUR                  n[        U[        5      (       a+  U[        La"  U R                  X5      nU R                  X5        U$ U(       dV  UR                   [        :X  aB  UR                  (       d1  UR                  b  UR                  nU R                  X5        U$ Un U$ [        U5      S:X  a>  UR                   S [        4;   a(  Uu  nU R                  X5      nU R                  X5        U$ UR                   [        :X  a"  U Vs/ s H  oPR                  X5      PM     nnU$ UR                   [        :X  a6  U Vs/ s H  oPR                  X5      PM     nnU R                  XS   5        U$ UR                   [        :X  a  [        nU$ U Vs/ s H  oPR                  X5      PM     nnU H  nU R                  X5        M     U$ s  snf s  snf s  snf )Nr   r   )r   r   r   rt  r   r  r'  r   r!  _check_valuer   r   r   r   )r8   r   r:   r>   r&  vs         r   r  ArgumentParser._get_values	  s   v||x7$$%%%%x*?6!!&0P I &,,,">''~~)!!&0@ 9 $8 3 "v||h7G'G%KJOOF7Ef,, ' \\Y&9DEA__V/EE$  \\V#9DEA__V/EEfAh/  \\X%E  :EEA__V/EE!!&,  % F F Fs   
H
 HHc                    U R                  SUR                  UR                  5      n[        U5      (       d  [        S5      n[	        XU-  5      e U" U5      nU$ ! [
         a  n[        U5      n[	        X5      eS nAf[        [        4 aH    [        UR                  S[        UR                  5      5      nXrS.n[        S5      n[	        XU-  5      ef = f)Nr0   z%r is not callabler1   )r0   r>   z!invalid %(type)s value: %(value)r)rV  r0   rc  r   r   r   r'  r+  r   ry  r4   )	r8   r   r&  rg  r  r"  r  r=   r   s	            r   r!  ArgumentParser._get_value	  s    &&vv{{FKKH		""()Ci88	4z*F  ! 	-c(C,, :& 	46;;
D4EFD 6D78Cd
33		4s   A 
C&A<<ACc                 
   UR                   nUbt  [        U[        5      (       a  [        U5      nX#;  aN  [        U5      SR	                  [        [        UR                   5      5      S.n[        S5      n[        XU-  5      eg g )Nr.   )r>   r%  z3invalid choice: %(value)r (choose from %(choices)s))r%  r  r'  r  r7   r&  r   r   )r8   r   r>   r%  r   r  s         r   rU  ArgumentParser._check_value
  sw    ..'3''w-#!$U#'99Sfnn-E#FHMN#F$J77	 $ r   c                     U R                  5       nUR                  U R                  U R                  U R                  5        UR                  5       $ r   )r  r   r   rH  rK  r   )r8   r~   s     r   r   ArgumentParser.format_usage&
  sB    '')	DJJ ;;	=$$&&r   c                    U R                  5       nUR                  U R                  U R                  U R                  5        UR                  U R                  5        U R                   Hd  nUR                  UR                  5        UR                  UR                  5        UR                  UR                  5        UR                  5         Mf     UR                  U R                  5        UR                  5       $ r   )r  r   r   rH  rK  r   rA  rJ  r   rz  r   r   r   r  r   )r8   r~   action_groups      r   r   ArgumentParser.format_help,
  s    '')	 	DJJ ;;	= 	4++, !//L##L$6$67|778##L$?$?@!!#	 0 	4;;' $$&&r   c                 4    U R                  U R                  S9$ )Nr   )r  rm   rE   s    r   r  ArgumentParser._get_formatterC
  s    ###33r   c                 j    Uc  [         R                  nU R                  U R                  5       U5        g r   )r  r  r  r   r8   files     r   print_usageArgumentParser.print_usageJ
  s)    <;;DD--/6r   c                 j    Uc  [         R                  nU R                  U R                  5       U5        g r   )r  r  r  r   rd  s     r   r  ArgumentParser.print_helpO
  s)    <;;DD,,.5r   c                     U(       a,  U=(       d    [         R                  n UR                  U5        g g ! [        [        4 a     g f = fr   )r  stderrwriter8  r%  )r8   r   re  s      r   r  ArgumentParser._print_messageT
  sB    &4;;D

7#  #G, s   5 AAc                 ~    U(       a   U R                  U[        R                  5        [        R                  " U5        g r   )r  r  rk  r  )r8   statusr   s      r   r  ArgumentParser.exit`
  s%    5		&r   c                     U R                  [        R                  5        U R                  US.nU R	                  S[        S5      U-  5        g)zerror(message: string)

Prints a usage message incorporating the message to stderr and
exits.

If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
rm   r   rU   z%(prog)s: error: %(message)s
N)rf  r  rk  rm   r  r   r8   r   r   s      r   r!  ArgumentParser.errore
  s=     	%		g6		!Q784?@r   c                 z    U R                   US.nU R                  [        S5      U-  [        R                  5        g )Nrr  z%(prog)s: warning: %(message)s
)rm   r  r   r  rk  rs  s      r   r  ArgumentParser._warningr
  s/    		g6A@ADH$++Vr   )r  r  r  r  r  r  r  r  r  rm   r   r  r   )r   N)'r1   rI   rJ   rK   rL   r   rr   r5   r  rd  r  r  r  r  r  r  r  r3  r  r  r   rD  r;  rO  rN  r  r!  rU  r   r   r  rf  r  r  r  r!  r  rM   r  r  s   @r   r   r     s    , !!.!'+"&")"#;,B	?>*
.J$Lq!f	6#,",0\*X(\I,1f2
8 ''.47
6

AW Wr   r   )4rL   __version____all__osr  rerh   sysr  r   r   r   r[   r   r   r   r   r   r   r  rO  r)   rQ   r   r	   r
   r   r   rh  	Exceptionr   r   r   r  r   r  r  r  r  r  r  r  r  r  r  r
  r   r   r9  rj  rn  r   r   r   r   <module>r}     s  ;z ,   . 		. v >	"cF cLQ- Q!6 !M *$} $&.?I ?(		 	_@ _@F h 9/F 9/x".6 ".J2 22( &#) #&%-F %-P- -:16 12& *V :lL lL\-M -1:v 1:n$  $({8 {8|	(;& (;VEn E:WW%'8 WW3  	A	s   E$ $E76E7