NfdZdZgdZddlZddlZddlZddl Z ddl m Z m Z n#e $r dZ dZ YnwxYwdZd Zd Zd Zd Zd ZdZGddeZdZGddeZGddeZGddeZGddeZGddeZdZGddeZGdd eZ Gd!d"eZ!Gd#d$e!Z"Gd%d&e!Z#Gd'd(e!Z$Gd)d*e$Z%Gd+d,e$Z&Gd-d.e!Z'Gd/d0e!Z(Gd1d2e!Z)Gd3d4e!Z*Gd5d6e!Z+Gd7d8e!Z,Gd9d:e'Z-Gd;deZ/Gd?d@eZ0GdAdBe0Z1GdCdDe1Z2GdEdFee0Z3dS)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.) z1.1)ArgumentParser ArgumentErrorArgumentTypeErrorBooleanOptionalActionFileType HelpFormatterArgumentDefaultsHelpFormatterRawDescriptionHelpFormatterRawTextHelpFormatterMetavarTypeHelpFormatter NamespaceAction ONE_OR_MOREOPTIONALPARSER REMAINDERSUPPRESS ZERO_OR_MOREN)gettextngettextc|SN)messages /usr/lib/python3.11/argparse.py_rasc|dkr|S|SNr)singularpluralns rrrcs 66OMrz ==SUPPRESS==?*+zA......_unrecognized_argsc$eZdZdZdZdZdZdS)_AttributeHolderaAbstract 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__. ct|j}g}i}|D]$}|t |%|D]9\}}|r||d|4|||<:|r%|dt |z|dd|dS)N=z**%s(, ))type__name__ _get_argsappendrepr _get_kwargs isidentifierjoin)self type_name arg_strings star_argsargnamevalues r__repr__z_AttributeHolder.__repr__sJJ'   >>## * *C   tCyy ) ) ) )++-- ( (KD%  "" (""dddEE#:;;;;"' $  9   vY7 8 8 8$99dii &<&<&<&<==rcNt|jSr)list__dict__itemsr8s rr5z_AttributeHolder._get_kwargssDM''))***rcgSrrrDs rr2z_AttributeHolder._get_argss rN)r1 __module__ __qualname____doc__r?r5r2rrrr*r*vsK > > >+++rr*c||gSt|tur |ddSddl}||SNr)r0rAcopy)rCrKs r _copy_itemsrLsG }  E{{dQQQxKKK 99U  rceZdZdZ d!dZdZdZGdd eZd Z d Z d Z d Z d"dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd ZdS)#rzFormatter 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|6 ddl}|j}|dz}n#t$rd}YnwxYw||_||_t |t|dz |dz|_||_ d|_ d|_ d|_ | |d|_|j|_t!jdt j|_t!jd|_dS)NrrNFz\s+z\n\n\n+)shutilget_terminal_sizecolumns ImportError_prog_indent_incrementminmax_max_help_position_width_current_indent_level_action_max_length_Section _root_section_current_section_recompileASCII_whitespace_matcher_long_break_matcher)r8progindent_incrementmax_help_positionwidth_shutils r__init__zHelpFormatter.__init__s  = ((((1133;      !1"%&7&)%"*6F6J&K&K#M#M   "#!]]466 $ 2#&;vsy#A#A #&;z#:#:   s "' 66cP|xj|jz c_|xjdz c_dSrr]rXr^rDs r_indentzHelpFormatter._indents-  66 q rcz|xj|jzc_|jdks Jd|xjdzc_dS)NrzIndent decreased below 0.r rorDs r_dedentzHelpFormatter._dedentsJ  66#q(((*E((( q rceZdZddZdZdS)HelpFormatter._SectionNc>||_||_||_g|_dSr) formatterparentheadingrC)r8rvrwrxs rrmzHelpFormatter._Section.__init__s"&DN DK"DLDJJJrcV|j|j|jj}|d|jD}|j|j|sdS|jtur!|j|jj}d|d|jfz}nd}|d||dgS)Ncg|] \}}|| Srr).0funcargss r z6HelpFormatter._Section.format_help..s"GGGjdDddDkGGGrz%*s%s:  ) rwrvrp _join_partsrCrrrxrr])r8r7 item_helpcurrent_indentrxs r format_helpz"HelpFormatter._Section.format_helps{&&&(((>-DGGDJGGGHHI{&&&((( r|8++ 0H!%!?$DL'II4w 4899 9rr)r1rFrGrmrrrrr`rts7      : : : : :rr`cH|jj||fdSr)rbrCr3)r8r|r}s r _add_itemzHelpFormatter._add_items& #**D$<88888rc||||j|}||jg||_dSr)rpr`rbrr)r8rxsections r start_sectionzHelpFormatter.start_sectionsL --d&;WEE w*B/// 'rcP|jj|_|dSr)rbrwrrrDs r end_sectionzHelpFormatter.end_sections! $ 5 < rc\|tur | ||j|gdSdSdSr)rr _format_text)r8texts radd_textzHelpFormatter.add_texts? x  D$4 NN4,tf 5 5 5 5 5 $4$4rc^|tur#||||f}||j|dSdSr)rr _format_usage)r8usageactionsgroupsprefixr}s r add_usagezHelpFormatter.add_usage s@  '661D NN4-t 4 4 4 4 4 ! rc||jtur|j}||g}||D] }|||!t t t|}||jz}t |j ||_ | |j |gdSdSr) helpr_format_action_invocation_iter_indented_subactionsr3rZmaplenr]r_r_format_action)r8actionget_invocation invocations subactioninvocation_length action_lengths r add_argumentzHelpFormatter.add_arguments ;h & &";N)>&112K!;;FCC > > "">>)#<#<====!$C[$9$9 : : -0DDM&)$*A*7'9'9D # NN4. 9 9 9 9 9 ' &rc:|D]}||dSr)r)r8rrs r add_argumentszHelpFormatter.add_arguments"s2 & &F   f % % % % & &rc|j}|r3|jd|}|ddz}|S)N r)rarrgsubstrip)r8rs rrzHelpFormatter.format_help)sQ!--//  ++//==D::d##d*D rc@dd|DS)Nrc(g|]}|r |tu |Sr)r)r{parts rr~z-HelpFormatter._join_parts..1s5::: :$($8$8$8$8$8r)r7)r8 part_stringss rrzHelpFormatter._join_parts0s4ww::$0:::;; ;rcv|td}||t|jz}n||sdt|jz}ng|ddt|jz}g}g}|D]4}|jr||||5|j} | ||z|} dd|| fD}|j|jz t|t|zkrd} | ||} | ||} tj | | }tj | | }d|| ksJd|| ksJd fd }t|t|zdzkrpdt|t|zd zz}|r1||g|z||}| |||n|r||g|z||}n|g}n|dt|z}||z}|||}t|d kr@g}| |||| ||||g|z}d |}||d S) Nzusage: rhz%(prog)s cg|]}||Srr)r{ss rr~z/HelpFormatter._format_usage..QsCCCACaCCCrz%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cg}g}|t|dz }nt|dz }|D]}|dzt|zkrA|r?||d|zg}t|dz }|||t|dzz }|r+||d|z| |dt|d|d<|S)Nr rr)rr3r7)partsindentrlineslineline_lenr text_widths r get_linesz.HelpFormatter._format_usage..get_linesesED)#&v;;?#&v;;? %22#a<#d))3j@@T@!LL#((4..)@AAA#%D'*6{{QH D))) CIIM1> Vchhtnn%<===)#(8CKKLL#9a Lrg?r rrr) rdictrWoption_stringsr3_format_actions_usager7r\r]rrcfindallextend)r8rrrrrh optionals positionalsrformat action_usage part_regexp opt_usage pos_usage opt_parts pos_partsrrrrrs @rrzHelpFormatter._format_usage5sE >y\\F  Ddj1111EE]7]4:!6!6!66EE]$* 5 5 55DIK! / /(/$$V,,,,&&v..../F!6)k"96BBLHHCC$ )=CCCDDEt';;J6{{SZZ'*44 #F9f55 "F;77 K Y?? K Y?? xx **i7777xx **i7777!!!!!!*v;;T*dZ.??? CKK#d))$;a$?@F ' ) 4&9*.sDDD$43C3C3C3Crz[\[(]z[\])]z(%s) z\1 (%s)z *rz \(([^|]*)\))set_group_actions ValueErrorindexraddrequiredrange enumeraterrr3getpopr#_get_default_metavar_for_positional _format_argsnargs format_usage!_get_default_metavar_for_optionalsortedr7rcrr)r8rr group_actionsinsertsgroupstartendrirdefaultr option_string args_stringropencloses rrz#HelpFormatter._format_actions_usagesI  ) )E' 9 !7!7!7888 ) e&:1&=>>c%"677759%)==="'"622%))&1111 >/ G++#ENNNd2NNNN-0GEN'>>#CLLLC/LLLL+.GCLL G++#ENNNd2NNNN-0GEN'>>#CLLLC/LLLL+.GCL"519c22))%( 5    :"7++- #- #IAv{h&& T""";;q>>S((KKNNNN[[Q''3..KKA&&&*! #BB6JJ((99]**Aw#~~$r(c//#AbDz T""""!' 5a 8 <1$$!..00DD #DDVLLG"&"3"3FG"D"DK&3mm[[AD)6+F+F!D=D T""""... & &A!!*E!A#JJxxDD%DDDEEwx$t44wx%'55wDDD%%0#t<<w~ud33zz|| s D&& D43D4cd|vr|t|jz}t|j|jz d}d|jz}||||dzS)Nz%(prog)r rr)rrWrZr\r] _fill_text)r8rrrs rrzHelpFormatter._format_textse   $DJ////Dt';;R@@ t++tZ886AArc~t|jdz|j}t|j|z d}||jz dz }||}|js|jd|f}d|z}n7t||kr|jd||f}d|z}d}n|jd|f}d|z}|}|g}|jr|j rw| |} | r_| | |} | d|d| dfz| ddD]} | d|d| fzn*| ds| d||D]*} | || +||S) NrNrrz%*s%s z %*s%-*s rr r)rYr_r[rZr\r]rrrr _expand_help _split_linesr3endswithrrr) r8r help_position help_width action_width action_headertup indent_firstr help_text help_linesrrs rrzHelpFormatter._format_actionsD3a7 355 }4b99 $t';;a? 66v>> { )&M9C%OMM  < / /&L-GC'#-MLL&M9C%OM(L ; 6;,,.. ))&11I H!..y*EE  Y,JqM)JJKKK&qrrNHHDLLmR-F!FGGGG''--  LL   77?? 9 9I LL,,Y77 8 8 8 8&&&rc|js8||}|||d\}|Sg}|jdkr||jnO||}|||}|jD]}||d|d|S)Nr rrr.) rr_metavar_formatterrrrrr3r7)r8rrmetavarrrrs rrz'HelpFormatter._format_action_invocation6s$ $>>vFFG?t..vw??BBHGNE|q   V23333 @@HH"//@@ %+%:IIMLLMMM;;!GHHHH99U## #rc|j|jn3|j*d|jD}dd|zn|fd}|S)Nc,g|]}t|Srstr)r{choices rr~z4HelpFormatter._metavar_formatter..RsDDD63v;;DDDrz{%s},c>ttrSf|zSr) isinstancetuple) tuple_sizeresults rrz0HelpFormatter._metavar_formatter..formatWs'&%(( / zJ..r)rchoicesr7)r8rdefault_metavar choice_strsrr s @rrz HelpFormatter._metavar_formatterNsn > %^FF ^ 'DDV^DDDKchh{333FF$F / / / / /  rc|||}|jd|dz}n"|jtkrd|dz}n|jtkr*|d}t |dkrd|z}nd|z}n|jt krd|dz}n|jt krd}n|jtkrd |dz}nw|jtkrd }nd d t|jD}n#t$rtd dwxYwd |||jz}|S)N%sr rrNz [%s [%s ...]]z[%s ...]z %s [%s ...]r'z%s ...rcg|]}dS)rr)r{rs rr~z.HelpFormatter._format_args..ts===A4===rzinvalid nargs valuer) rrrrrrrrrr TypeErrorrr7)r8rr  get_metavarr rformatss rrzHelpFormatter._format_args^s}--foFF < KKNN*FF \X % %kk!nn,FF \\ ) )!k!nnG7||q  (72#g- \[ ( ("[[^^3FF \Y & &FF \V # # A.FF \X % %FF B==v|)<)<=== B B B !677TA BXXg&&V\)B)BBF s -D D'ctt||j}t|D]}||tur||=t|D](}t ||dr||j||<)|d*dd|dD}||d<| ||zS)Nrr1r r.c,g|]}t|Srr)r{cs rr~z.HelpFormatter._expand_help..s$G$G$GSVV$G$G$Gr) rvarsrWrArhasattrr1rr7_get_help_string)r8rparamsr= choices_strs rrzHelpFormatter._expand_helpzsd6ll444LL ! !Dd|x''4LLL 5 5Dvd|Z00 5%d|4t ::i ,))$G$GVI5F$G$G$GHHK +F9 $$V,,v55rc#K |j}||Ed{V|dS#t$rYdSwxYwr)_get_subactionsrprrAttributeError)r8rget_subactionss rrz'HelpFormatter._iter_indented_subactionssw #3N LLNNN%~'' ' ' ' ' ' ' ' LLNNNNN     DD sA AAc|jd|}ddl}|||S)Nrr)rfrrtextwrapwrap)r8rrkr"s rrzHelpFormatter._split_linessE'++C66<<>> }}T5)))rc|jd|}ddl}|||||S)Nrr)initial_indentsubsequent_indent)rfrrr"fill)r8rrkrr"s rrzHelpFormatter._fill_textsT'++C66<<>>}}T5,2/577 7rc|jSr)rr8rs rrzHelpFormatter._get_help_string {rc4|jSr)destupperr)s rrz/HelpFormatter._get_default_metavar_for_optionals{  """rc|jSr)r,r)s rrz1HelpFormatter._get_default_metavar_for_positionalr*r)rNrONr) r1rFrGrHrmrprrobjectr`rrrrrrrrrrrrrrrrrrrrrrrrrrrrs#$#% ;;;;D :::::6:::>999 ((( 6665555 :::$&&&;;; ^,^,^,@hhhTBBB.'.'.'`$$$0 8 6 6 6***777###rrceZdZdZdZdS)r 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. cndfd|dDS)Nrc3"K|] }|zV dSrr)r{rrs r z9RawDescriptionHelpFormatter._fill_text..s'PPv}PPPPPPrT)keepends)r7 splitlines)r8rrkrs `rrz&RawDescriptionHelpFormatter._fill_texts8wwPPPP$1O1OPPPPPPrN)r1rFrGrHrrrrr r s2 QQQQQrr ceZdZdZdZdS)r 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*|Sr)r5)r8rrks rrz!RawTextHelpFormatter._split_liness   rN)r1rFrGrHrrrrr r s- !!!!!rr ceZdZdZdZdS)rzHelp 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|j}|d}d|vr1|jtur#ttg}|js |j|vr|dz }|S)a6 Add the default value to the option help message. ArgumentDefaultsHelpFormatter and BooleanOptionalAction when it isn't already present. This code will do that, detecting cornercases to prevent duplicates or cases where it wouldn't make sense to the end user. Nrz %(default)z (default: %(default)s))rrrrrrr)r8rrdefaulting_nargss rrz.ArgumentDefaultsHelpFormatter._get_help_strings`{ <D t # #~X--$,l#; (6FLrN)r1rFrGrHrrrrrr r s<$$$$$$$$rr c|dS|jrd|jS|jdtfvr|jS|jdtfvr|jS|jr dd|jzdzSdS)N/{r})rr7rrr,r )arguments r_get_action_namerEst  xx/000  $!1 1 1 tX. . .}  SXXh.///#55trceZdZdZdZdZdS)rzAn 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<t||_||_dSr)rE argument_namer)r8rDrs rrmzArgumentError.__init__s-h77 rcp|jd}ntd}|t|j|jzS)Nz %(message)sz'argument %(argument_name)s: %(message)s)rrH)rHrrr)r8rs r__str__zArgumentError.__str__ sH   %"FF@AAFT\+/+=???? ?rN)r1rFrGrHrmrJrrrrrs< ?????rrceZdZdZdS)rz@An error from trying to convert a command line string to a type.N)r1rFrGrHrrrrrsJJDrrc>eZdZdZ ddZdZdZd dZdS) r 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. NFc ||_||_||_||_||_||_||_||_| |_| |_ dSr rr,rconstrr0r rrr) r8rr,rrOrr0r rrrs rrmzAction.__init__NsO-          rc(gd}fd|DS)NrNc4g|]}|t|fSrgetattrr{r=r8s rr~z&Action._get_kwargs..q(>>>wtT**+>>>rrr8namess` rr5zAction._get_kwargsds0    ?>>>>>>>rc|jdSrJrrDs rrzAction.format_usagess"1%%rc:ttd)Nz.__call__() not defined)NotImplementedErrorrr8parser namespacevaluesrs r__call__zAction.__call__vs!!$=">">???rNNNNNFNNr)r1rFrGrHrmr5rr`rrrr r s00j, ? ? ?&&&@@@@@@rr c:eZdZ dfd ZddZdZxZS)rNFc g} |D]N} | | | dr"d| ddz} | | Ot| |d|||||| dS)N----no-rNr) rr,rrr0r rrr)r3 startswithsuperrm) r8rr,rr0r rrr_option_stringsr __class__s rrmzBooleanOptionalAction.__init__{s+ 6 6M  " "= 1 1 1''-- 6 '-*; ; &&}555 *      rcp||jvr,t||j|d dSdS)Nre)rsetattrr,rfr\s rr`zBooleanOptionalAction.__call__sC D/ / / Itym.F.Fw.O.O*O P P P P P 0 /rc6d|jS)Nz | )r7rrDs rrz"BooleanOptionalAction.format_usageszz$-...r)NNNFNNr)r1rFrGrmr`r __classcell__ris@rrrzsx<QQQQ///////rrc8eZdZ dfd ZddZxZS) _StoreActionNFc |dkrtd|"|tkrtdtztt|||||||||| |  dS)Nrznargs 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 constrN)rrrgrprm r8rr,rrOrr0r rrrris rrmz_StoreAction.__init__s A::KLL L  (!2!2?(JKK K lD!!**) +     rc2t||j|dSr)rkr,r\s rr`z_StoreAction.__call__s 49f-----rrarr1rFrGrmr`rmrns@rrprpsk :........rrpc2eZdZ dfd ZddZxZS)_StoreConstActionNFc ftt|||d||||dS)Nr)rr,rrOrrr)rgrwrm r8rr,rOrrrrris rrmz_StoreConstAction.__init__sL &&//) 0     rc<t||j|jdSr)rkr,rOr\s rr`z_StoreConstAction.__call__s 49dj11111rNNFNNrrurns@rrwrwsb "22222222rrwc&eZdZ dfd ZxZS)_StoreTrueActionFNcdtt|||d|||dS)NTrr,rOrrr)rgr}rmr8rr,rrrris rrmz_StoreTrueAction.__init__sI %%..) /     r)FFNr1rFrGrmrmrns@rr}r}sH           rr}c&eZdZ dfd ZxZS)_StoreFalseActionTFNcdtt|||d|||dS)NFr)rgrrmrs rrmz_StoreFalseAction.__init__sI &&//) 0     r)TFNrrns@rrrsH           rrc8eZdZ dfd ZddZxZS) _AppendActionNFc |dkrtd|"|tkrtdtztt|||||||||| |  dS)Nrznargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriaterrrN)rrrgrrmrss rrmz_AppendAction.__init__s A::OPP P  (!2!2?(JKK K mT""++) ,     rct||jd}t|}||t ||j|dSr)rSr,rLr3rkr8r]r^r_rrCs rr`z_AppendAction.__call__N 49d33E"" V 49e,,,,,rrarrurns@rrrsk :--------rrc2eZdZ dfd ZddZxZS)_AppendConstActionNFc htt|||d|||||dS)Nr)rr,rrOrrrr)rgrrmrys rrmz_AppendConstAction.__init__%sO  $''00) 1     rct||jd}t|}||jt ||j|dSr)rSr,rLr3rOrkrs rr`z_AppendConstAction.__call__7sP 49d33E"" TZ    49e,,,,,rr{rrurns@rrr#sb $--------rrc.eZdZ dfd ZddZxZS) _CountActionNFcdtt|||d|||dS)Nr)rr,rrrr)rgrrmrs rrmz_CountAction.__init__@sH lD!!**) +     rclt||jd}|d}t||j|dzdSNrr )rSr,rk)r8r]r^r_rcounts rr`z_CountAction.__call__Ns= 49d33 =E 49eai00000r)NFNrrurns@rrr>s\       11111111rrc.eZdZeedffd ZddZxZS) _HelpActionNcbtt||||d|dSNr)rr,rrr)rgrrm)r8rr,rrris rrmz_HelpAction.__init__WsE k4  ))) *     rcV||dSr) print_helpexitr\s rr`z_HelpAction.__call__cs% rrr1rFrGrrmr`rmrns@rrrUs\!      rrc0eZdZdeedffd ZddZxZS)_VersionActionNz&show program's version number and exitcptt||||d|||_dSr)rgrrmversion)r8rrr,rrris rrmz_VersionAction.__init__jsH nd##,,) -     rc|j}||j}|}||||t j|dSr)r_get_formatterr_print_messager_sysstdoutr)r8r]r^r_rrrvs rr`z_VersionAction.__call__xso, ?nG))++ 7###i3355t{CCC rrrrns@rrrhs_!>      rrcXeZdZGddeZedddffd ZdZdZd dZ xZ S) _SubParsersActionceZdZfdZxZS)&_SubParsersAction._ChoicesPseudoActionc|x}}|r|dd|zz }ttj|}|g|||dS)Nrr.)rr,rr)r7rgr_ChoicesPseudoActionrm)r8r=aliasesrrr,supris rrmz/_SubParsersAction._ChoicesPseudoAction.__init__sq! !Gd 87TYYw%7%777)>EEC LLD!(  * * * * *rrrns@rrrs8 * * * * * * * * *rrFNc ||_||_i|_g|_t t |||t|j|||dS)N)rr,rr rrr) _prog_prefix _parser_class_name_parser_map_choices_actionsrgrrmr) r8rrh parser_classr,rrrris rrmz_SubParsersAction.__init__so!) " " &&//)) 0     rc |d|jd||d<|dd}||jvr t |t d|z|D]+}||jvr t |t d|z,d|vrF|d}||||}|j||j di|}||j|<|D] }||j|< |S)Nrhrrrzconflicting subparser: %szconflicting subparser alias: %sr) rrrrrrrrr3r)r8r=kwargsraliasr choice_actionr]s r add_parserz_SubParsersAction.add_parsersQ ::f   %(,(9(9(944@F6N**Y++ 4( ( (a(C&D&Dt&KLL L H HE---#!=>>FHHH. V  ::f%%D 55dGTJJM  ! ( ( 7 7 7$#--f--&,d# 2 2E+1D !% ( ( rc|jSr)rrDs rrz!_SubParsersAction._get_subactionss $$rct|d}|dd}|jturt||j| |j|}nM#t$r@|d|jd}t d|z}t||wxYw||d\} }t|  D]\} } t|| | |rRt| tgt|t|dSdS)Nrr r.) parser_namer z5unknown parser %(parser_name)r (choices: %(choices)s))r,rrkrKeyErrorr7rrparse_known_argsrrC setdefault_UNRECOGNIZED_ARGS_ATTRrSr) r8r]r^r_rrr:r}msg subnamespacekeyr>s rr`z_SubParsersAction.__call__s_Qi QRRj  9H $ $ Ity+ 6 6 6 +*;7FF + + +#.#yy)>??AADKLLtSCc** *  +%+$;$;K$N$N! k|,,2244 + +JC IsE * * * *  L OO & &'> C C C I6 7 7 > >{ K K K K K L Ls AA Br) r1rFrGr rrrmrrr`rmrns@rrrs*****v***.<%%%LLLLLLLLrrceZdZddZdS) _ExtendActionNct||jd}t|}||t ||j|dSr)rSr,rLrrkrs rr`z_ExtendAction.__call__rrr)r1rFrGr`rrrrrs(------rrc&eZdZdZddZdZdZdS) raFactory 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. rrNc>||_||_||_||_dSr)_mode_bufsize _encoding_errors)r8modebufsizeencodingerrorss rrmzFileType.__init__s"  ! rc|dkrdjvr&djvrtjjn tjSt fddDr&djvrtjjn tjSt djz}t| t|jj j j S#t$r+}||d}t d}t||zd}~wwxYw) N-rbc3*K|] }|jvVdSr)r)r{rr8s rr3z$FileType.__call__.. s)44Q$*_444444rwaxzargument "-" with mode %r)filenameerrorz$can't open '%(filename)s': %(error)s)rrstdinbufferanyrrrrrrrOSErrorr)r8stringrer}rs` rr`zFileType.__call__s S==dj  ,/4:,=,=tz((4:M4444e44444 &-0DJ->->t{))DKO344tzA oo% 4 DM4> && & 4 4 4 &33D>??G#GdN33 3 4s&C C;&C66C;c|j|jf}d|jfd|jfg}dd|Dd|Dz}t |jd|dS)Nrrr.c8g|]}|dkt|S)r)r4)r{r<s rr~z%FileType.__repr__..s#EEEC3"99d3ii999rc&g|]\}}||d|S)Nr,r)r{kwr<s rr~z%FileType.__repr__.. s3222gb#!$*,SS1!0rr-r/)rrrrr7r0r1)r8r}rargs_strs rr?zFileType.__repr__sz4=(t~.4<0HI99EE4EEE22222233 ::...99r)rrNN)r1rFrGrHrmr`r?rrrrrsP  444(:::::rrc$eZdZdZdZdZdZdS)r zSimple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. c >|D]}t||||dSr)rk)r8rr=s rrmzNamespace.__init__/s4 . .D D$t - - - - . .rczt|tstSt|t|kSr)rr NotImplementedr)r8others r__eq__zNamespace.__eq__3s1%++ "! !DzzT%[[((rc||jvSr)rB)r8rs r __contains__zNamespace.__contains__8sdm##rN)r1rFrGrHrmrrrrrr r (sK ...))) $$$$$rr ceZdZfdZdZddZdZdZdZdZ d Z d Z d Z d Z d ZdZddZdZdZdZdZxZS)_ActionsContainerctt|||_||_||_||_i|_|ddt|ddt|ddt|ddt|ddt|ddt|ddt|ddt|dd t |dd t"|dd t$|dd t&|g|_i|_g|_g|_i|_t5jd |_g|_dS)Nrstore store_const store_true store_falser3 append_constrrrparsersrz^-\d+$|^-\d*\.\d+$)rgrrm descriptionargument_default prefix_charsconflict_handler _registriesregisterrprwr}rrrrrrrr _get_handler_actions_option_string_actions_action_groups_mutually_exclusive_groups _defaultsrcrd_negative_number_matcher_has_negative_number_optionals)r8rrrrris rrmz_ActionsContainer.__init__>s &&//111& 0( 0 hl333 h666 h /@AAA h .>??? h /@AAA h-888 h0BCCC h666 h 444 h >::: h +<=== h-888  &(#!*,'), 4I(J(J%/1+++rcF|j|i}|||<dSr)rr)r8 registry_namer>r/registrys rrz_ActionsContainer.registerss'#..}bAA rNcD|j|||Sr)rr)r8rr>rs r _registry_getz_ActionsContainer._registry_getws  .225'BBBrc |j||jD]}|j|vr||j|_dSr)rupdaterr,r)r8rrs r set_defaultsz_ActionsContainer.set_defaults}sQ f%%%m 5 5F{f$$!' !4 5 5rc|jD]}|j|kr|j |jcS|j|dSr)rr,rrr)r8r,rs r get_defaultz_ActionsContainer.get_defaultsNm & &F{d""v~'A~%%%~!!$---rc8|j}|r#t|dkr3|dd|vr#|rd|vrtd|j|i|}n |j|i|}d|vr3|d}||jvr|j||d<n|j |j|d<||}t|std|d|di|}| d |j |j }t|st|d |turt|d t|d rG | |dn#t$rtd wxYw||S)z add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...) r rr,z+dest supplied twice for positional argumentrNzunknown action ""r0z is not callablez: is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargsr)rrr_get_positional_kwargs_get_optional_kwargsrr_pop_action_classcallablerr0rrrrr _add_action)r8r}rcharsr, action_classr type_funcs rrz_ActionsContainer.add_arguments! @s4yyA~~$q'!*E*A*A P&(( !NOOO0T0$A&AAFF/T.???F F " "&>Dt~%%$(N4$8y!!&2$($9y!--f55  %% F*lllDEE E''''&&vv{FKHH  "" BYYY@AA A  2;))>?? ? 4) * * Q Q##%%2264@@@@ Q Q Q !OPPP Q'''s (E**FcZt|g|Ri|}|j||Sr)_ArgumentGrouprr3)r8r}rrs radd_argument_groupz$_ActionsContainer.add_argument_groups;t5d555f55 ""5))) rc Tt|fi|}|j||Sr)_MutuallyExclusiveGrouprr3)r8rrs radd_mutually_exclusive_groupz._ActionsContainer.add_mutually_exclusive_groups3'7777 '..u555 rc$|||j|||_|jD] }||j|< |jD]=}|j|r!|js|jd>|S)NT) _check_conflictrr3 containerrrrmatchr)r8rrs rrz_ActionsContainer._add_actions V$$$ V$$$$2 @ @M9?D ' 6 6$2 E EM,22=AA E:E7>>tDDD rc:|j|dSr)rremover)s r_remove_actionz _ActionsContainer._remove_actions V$$$$$rci}|jD];}|j|vr&td}t||jz|||j< > >!%F:  ::g  , . .9F3J3J!%F: Fb9999rc@g}g}|D]}|d|jvr+||jd}td}t||z||t |dkr$|d|jvr|||dd}|f|r |d}n|d}||j}|s!td}t||z|dd}t||| S) Nr)optionrzNinvalid option string %(option)r: must start with a character %(prefix_chars)rr r,z%dest= is required for options like %rrrr*) rrrr3rrlstripreplacer) r8r}rrlong_option_stringsrrr,dest_option_strings rrz&_ActionsContainer._get_optional_kwargssa ! : :M #t'888"/(,(9;;GHH t,,,  ! !- 0 0 0=!!A%%-*:d>O*O*O#**=999zz&$'' <" 7%8%;""%3A%6"%,,T->??D 6?@@ }!4555<<S))DFnEEEErc\|d|}|d||S)Nr)rr)r8rrrs rrz#_ActionsContainer._pop_action_class?s-Hg..!!(FF;;;rcd|jz} t||S#t$r'td}t ||jzwxYw)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rrSrrr)r8handler_func_namers rrz_ActionsContainer._get_handlerCse1D4II :4!233 3 : : :;<.^s,%=%=%=)>&3%=%=%=r)rrr7r)r8rconflicting_actionsrconflict_strings r_handle_conflict_errorz(_ActionsContainer._handle_conflict_errorZsk:;23355))%=%=(;%=%=%=>>FGo$=>>>rc|D][\}}|j||j|d|js|j|\dSr)rr!rrrr")r8rr9rs r_handle_conflict_resolvez*_ActionsContainer._handle_conflict_resolvecsy&9 8 8 !M6  ! ( ( 7 7 7  ' + +M4 @ @ @( 8 //777 8 8rr)r1rFrGrmrrr r rrrrr"r(rrrrrr;r=rmrns@rrr<sL0101010101j!!!CCCC 555...1(1(1(f  *%%%&<&<&eZdZdfd ZfdZfdZfdZxZS)rNc p|j}|d|j|d|j|d|jt t |j}|dd|i|||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ |j|_dS)Nrrrrr)rrrrrgrrmr$rrrrrrr)r8rr$rrr super_initris rrmz_ArgumentGroup.__init__ts"!9#=>>>~y5666!9#=>>>>4009  55{5f555  %0!* &/&F#",  4 +*3*N'''rctt||}|j||Sr)rgrrrr3r8rris rrz_ArgumentGroup._add_actions<~t,,88@@ ""6*** rctt|||j|dSr)rgrr"rr!rBs rr"z_ArgumentGroup._remove_actions> nd##226::: ""6*****rcntjdtdtj|i|S)Nz&Nesting argument groups is deprecated.rNcategory stacklevel)warningswarnDeprecationWarningrgrr8r}rris rrz!_ArgumentGroup.add_argument_groupsC 4'    *uww)4:6:::rNN)r1rFrGrmrr"rrmrns@rrrrsOOOOOO, +++++;;;;;;;;;rrc6eZdZdfd ZdZdZfdZxZS)rFcttt||||_||_dSr)rgrrmr _container)r8rrris rrmz _MutuallyExclusiveGroup.__init__s4 %t,,55i@@@  #rc|jrtd}t||j|}|j||S)Nz-mutually exclusive arguments must be optional)rrrrOrrr3)r8rrs rrz#_MutuallyExclusiveGroup._add_actionsW ? "CDDCS// !,,V44 ""6*** rcn|j||j|dSr)rOr"rr!r)s rr"z&_MutuallyExclusiveGroup._remove_actions5 &&v... ""6*****rcntjdtdtj|i|S)Nz0Nesting mutually exclusive groups is deprecated.rNrE)rHrIrJrgrrKs rrz4_MutuallyExclusiveGroup.add_mutually_exclusive_groupsC >'    4uww3TDVDDDr)F)r1rFrGrmrr"rrmrns@rrrs}$$$$$$ +++EEEEEEEEErrc eZdZdZddddgedddddddf fd ZdZdZd Zd Z d Z d$d Z d$d Z dZ dZdZdZdZdZdZdZd$dZd$dZdZdZdZdZdZdZd%dZd%dZd%d Zd&d"Z d#Z!xZ"S)'raKObject 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 NrrTc tt|j}|||| | |/tjt jd}||_||_ ||_ ||_ ||_ | |_ | |_| |_|j}|t#d|_|t#d|_d|_d}|dd|d|vrdn|d}|j r5||dz|d zd zd t.t#d  |D]I}|| |j}|j|:#t6$rYFwxYwdS) N)rrrrrzpositional argumentsoptionsc|Srr)rs ridentityz)ArgumentParser.__init__..identitysMrr0rhrNrzshow this help message and exit)rrr)rgrrm_ospathbasenamerargvrhrepilogformatter_classfromfile_prefix_charsadd_help allow_abbrev exit_on_errorrr _positionals _optionals _subparsersrrrr(rrr)r8rhrrr]parentsr^rr_rrr`rarb superinit add_grouprWdefault_prefixrwdefaultsris rrmzArgumentParser.__init__s.$//8  k+#3#3 5 5 5 5 <8$$TYq\22D   .%:"  (*+ %Ia(>&?&?@@#)AiLL11    fdH---!$| 3 3a = ;   s"N1$4V$;x899  ; ; ;  0 0F  ' ' / / / 0!+%%h////"      0 0sE<< F F c(gd}fd|DS)N)rhrrr^rr`c4g|]}|t|fSrrRrTs rr~z.ArgumentParser._get_kwargs..rUrrrVs` rr5zArgumentParser._get_kwargss0   ?>>>>>>>rc |j"|td|dt |d|vsd|vrbt|dd}t|dd}||||_n |j|_|du| }| }|j }| |j ||d||d<||d}|d d gi|}|j||S) Nz(cannot have multiple subparser argumentsrr$r subcommandsrhrrrr)rerrrr0rrrcrr_get_positional_actionsrrrrrrr) r8rr$rrvrr parsers_classrs radd_subparserszArgumentParser.add_subparserss   ' JJqCDD E E E .$t**555 f    7 7fjj-8899EFJJ}d;;<.Es0***(****rrrDs r_get_optional_actionsz$ArgumentParser._get_optional_actionsDs%**"m*** *rc$d|jDS)Nc g|] }|j | SrrYrus rr~z:ArgumentParser._get_positional_actions..Js0...,....rrvrDs rroz&ArgumentParser._get_positional_actionsIs%.."m... .rc|||\}}|r:td}||d|z|SNzunrecognized arguments: %sr)rrrr7r8r}r^r\rs r parse_argszArgumentParser.parse_argsQsW**4;; d  -011C JJsSXXd^^+ , , , rc|tjdd}nt|}|t}|jD]N}|jt ur>t||js)|jt urt||j|jO|j D].}t||st|||j |/|j rT | ||\}}nR#t$r,}|t|Yd}~n!d}~wwxYw| ||\}}t|t r=|t%|t t'|t ||fSr)rr\rAr rr,rrrrkrrb_parse_known_argsrrrrrrSdelattr)r8r}r^rr,errs rrzArgumentParser.parse_known_argsXs <9QRR=DD::D  ! Im H HF{(**y&+66H~X55 6;GGGN ? ?D9d++ ? 4)=>>>   F %"&"8"8y"I"I 44  % % % 3s88$$$$$$$$ %#44T9EEOIt 95 6 6 8 KK +BCC D D D I6 7 7 7$s C%% D/"DDc n !jijD]v}|j}t |jD]X\}}|g}||d||||dzdYwig}t} t | D]q\}} | dkr0|d| D]} |d; | } | d} n| |<d} || rd |ttdfd !!fd} !fd }gd rt}nd } |krmt fd D} |kr| }| kr| ;| vr! |}|| |  |km| }|dg}jD]}|vr|jr#|t#|0|jzt'|jt(r`t+|jrK|jt/|jur/t1|j||j|r8t7d d |zjD]d}|jr[|jD]}|vrnL d|jD}t7d}|d |zefS)Nr rdrAOrch | ||}||jurc ||gD]7}| vr1t d}t |}t |||z8|tur| ||dSdS)Nznot allowed with argument %s)r _get_valuesrrrrErr) rargument_stringsrargument_valuesconflict_actionr action_nameaction_conflictsr^ seen_actionsseen_non_default_actionsr8s r take_actionz5ArgumentParser._parse_known_args..take_actions   V $ $ $"..v7GHHO fn44(,,V444'7';';FB'G'GGGO&*BBB >??&6&G&G +FC+4EFFFCh..tYGGGGG/.rc|}|\}}}j}g} | ||dzS|||d}j}|dkr|d|vru|dkro||g|f|d} | |dz}|ddpd} j} || vr | |}| }nt d} t || |z|dkr!|dz} |g}||||fngt d} t || |z|dz}|d}|||}||z} || }||||fnJ|sJ|D]\}}}|||| S)NTr rrrzignored explicit argument %r)_match_argumentr3rrrr) start_index option_tuplerr explicit_argmatch_argument action_tuples arg_countrcharnew_explicit_arg optionals_maprstopr}rselected_patternsr:arg_strings_patternextrasoption_string_indicesr8rs rconsume_optionalz:ArgumentParser._parse_known_args..consume_optionals31=L2> /FM<"1NM9 >MM+k":;;;&?* + .vs ; ;I !-E!Q)!,E99(B..%,,fb--HIII,Q/(,|A(> +7+;+Ct((,(C (M99%2=%AF+;LL"#$B"C"CC"/l8J"K"KK#a*Q ,~%,,fdM-JKKK  >??+FC,4FGGG (!OE(;EFF(C% .v7H I II 9,D&uTz2D!((&$ )FGGGs9 z! /< 9 9+m FD-8888Krc j}|d}| |}t |D]#\}}|||z}||z } ||$ t|d dd<|Sr)_match_arguments_partialzipr) r match_partialselected_pattern arg_countsrrr}r:rrr8rs rconsume_positionalsz=ArgumentParser._parse_known_args..consume_positionalss 9M2;<<@ &{4DEEJ&)j%A%A * *! "; i0G#GHy(  FD)))))Z)9)9:KN rrrc g|] }|k| Srr)r{rrs rr~z4ArgumentParser._parse_known_args..0s.,),),)K'''''rz(the following arguments are required: %sr.cHg|]}|jtut| Sr)rrrErus rr~z4ArgumentParser._parse_known_args..os7===!' & 8 ; ;.f55 ; ; ;rz#one of the arguments %s is requiredrr)r__read_args_from_filesrrrrriterr3_parse_optionalr7rrorZrYrrrErrrrr,rSrk _get_valuerr)"r8r:r^r'rr mutex_action conflictsarg_string_pattern_partsarg_strings_iter arg_stringrpatternrrmax_option_string_indexnext_option_string_indexpositionals_end_indexstrings stop_indexrequired_actionsrrrWrrrrrrrrrrs"``` @@@@@@@@@rrz ArgumentParser._parse_known_args~sU  % 144[AAK: 8 8K'6M#,[-G#H#H 8 8<,77 bII   rr!2333  q1uvv!67777 8!##%  ,,&'788 9 9MAzT!!(//444"299J,33C88889 $33J?? '!GG/;)!,!G(//8888!gg&>??uu #&55  H H H H H H H H H H*J J J J J J J J J J \2244          (  )&)*?&@&@ # #&( #444(+,),),),)2,),),)(*(* $666(;(;K(H(H%);66"7K"7K"777%k2J&JK g&&&6 +*;77K5444:)(55   k*++.///m I IF\))? I$++,3773 6;773')V[*I*III 6; $ G GIII  4 JJqCDDyy!1223 4 4 44 6 6E~ 6#2 6 6F!999: ==+0+?===EABBCJJsSXXe__4555&  rc<g}|D]}|r|d|jvr||* t|dd5}g}|D]/}||D]}||0||}||dddn #1swxYwY#t$r-}| t|Yd}~d}~wwxYw|Sr) r_r3rreadr5convert_arg_line_to_argsrrrrr)r8r:new_arg_stringsr args_filearg_liner<rs rrz$ArgumentParser._read_args_from_filesxs% ) )J )Ad6P!P!P&&z2222 )jn--<&( (1(8(8(C(C(E(E88H'+'D'DX'N'N88 + 2 23 7 7 7 78&*&@&@&M&M '..{;;; <<<<<<<<<<<<<<<)))JJs3xx(((((((()s<C"BC C"C C"C C"" D,"DDc|gSrr)r8rs rrz'ArgumentParser.convert_arg_line_to_argss zrc||}tj||}|dtdttdt tdi}||j}|tdd|j|jz}t||t| dS)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsr ) _get_nargs_patternrcrrrrrrrrrr)r8rr nargs_patternr nargs_errorsrs rrzArgumentParser._match_arguments//77  -)<== =a/00!;<<Q?@@L ""6<00C{56%|--/5|< ,, ,5;;q>>"""rc8g}tt|ddD]w}|d|}dfd|D}tj||}|3|d|Dnx|S)Nrrrc:g|]}|Sr)r)r{rr8s rr~z;ArgumentParser._match_arguments_partial..s7<<<#) $66v>><<.sHHHvs6{{HHHr)rrr7rcrrr)r8rrr r actions_slicerrs` rrz'ArgumentParser._match_arguments_partialss7||Q++  A#BQBKMgg<<<<-:<<<==GIg':;;E  HHHHHIII!  rcr|sdS|d|jvrdS||jvr|j|}||dfSt|dkrdSd|vr4|dd\}}||jvr|j|}|||fS||}t|dkrLdd|D}||d}t d}|||znt|dkr|\} | S|j |r |j sdSd|vrdSd|dfS) Nrr r,r.cg|]\}}}| Srr)r{rrrs rr~z2ArgumentParser._parse_optional..s4!J!J!J7FM<"/!J!J!Jr)r,matchesz4ambiguous option: %(option)s could match %(matches)sr) rrrsplit_get_option_tuplesr7rrrrr) r8rrrr option_tuplesrUr}rrs rrzArgumentParser._parse_optionals 4!} 1114 4 4 40}||r'|j|}|||f}||?n|d|vr|d|vr|}d}|dd}|dd} |jD]l}||kr(|j|}||| f}||0||r'|j|}|||f}||mn%|td|z|S)Nrr r,rNzunexpected option string: %s)rrarrrfr3rr) r8rr r option_prefixrrrshort_option_prefixshort_explicit_args rrz!ArgumentParser._get_option_tupless!  u $ $q)9U)B)B +-''2?2E2Ec12M2M/M<<$1M#'L%)%@++M$// >>+!%!<]!K$m\A c*** 1  & &=+;5+H+H)ML"/"3 !.qrr!2 !%!< ' '  $777!8GF -1CCCMM#&&&&"--m<<'!8GF -=CMM#&&& ' JJq788=H I I I rcb|j}|d}no|tkrd}na|tkrd}nS|tkrd}nE|tkrd}n7|t krd}n)|t krd}ndd d |zz}|jr,| d d }| d d }|S) Nz(-*A-*)z(-*A?-*)z (-*[A-]*)z (-*A[A-]*)z([-AO]*)z (-*A[-AO]*)z(-*-*)z(-*%s-*)z-*rrr) rrrrrrrr7rr.)r8rrrs rrz!ArgumentParser._get_nargs_pattern! s  =%MMh  &MMl " "'MMk ! !(MMi  &MMf__)MMh  $MM'3;)?)??M   ;)11$;;M)11#r::Mrc|||\}}|r:td}||d|z|Sr{)parse_known_intermixed_argsrrr7r|s rparse_intermixed_argsz$ArgumentParser.parse_intermixed_argsR sW55dIFF d  -011C JJsSXXd^^+ , , , rc | d D}|rtd|djz fd|jDrtd |j} |j!|dd|_ D]2}|j|_t|_|j|_ t|_3| ||\}} D]a}t||j rJt||j gkr1ddlm}|d|j d |t!||j b D]}|j|_|j |_n"# D]}|j|_|j |_wxYw|} |D]}|j|_d |_|jD]} | j| _d | _| ||\}} |D]}|j|_|jD]} | j| _n,#|D]}|j|_|jD]} | j| _wxYw ||_n #||_wxYw|| fS) Nc<g|]}|jttfv|Sr)rrrrus rr~z>ArgumentParser.parse_known_intermixed_args..g s3 5 5 5  333333rz3parse_intermixed_args: positional arg with nargs=%src:g|]}|jD] }|v|jSr)rr,)r{rrrs rr~z>ArgumentParser.parse_known_intermixed_args..m sI I I IE. I I&K2G2G K2G2G2G2Grz;parse_intermixed_args: positional in mutuallyExclusiveGroup)rIzDo not expect z in F)rorrrrr save_nargsrr save_defaultrrr,rSrHrIrrwr save_required) r8r}r^a save_usagerremaining_argsrIrrrrs @rrz*ArgumentParser.parse_known_intermixed_argsY sD2244  5 5+ 5 5 5  9--.qTZ899 9 I I I IT%D I I I 7677 7. $J 9:%!%!2!2!4!4QRR!8DJ)..F(. F%#+FL*0.F'%-FNN,0,A,A$BK-M-M) >)88F 6;778 ' 6; ? ? C C111111iiPQQQ 6;777 8*99F#)#4FL%+%8FNN9k99F#)#4FL%+%8FNN92244I 9(,,F+1?F(&+FOO!<++E*/.E'%*ENN$($9$9.:C%E%E! 6(;;F&,&:FOO!<99E%*%8ENN9(;;F&,&:FOO!<99E%*%8ENN99$DJJDJ # # # #&  s>$I,CE%I%FIAH*(I)H;;I Icjttfvr' |dn#t$rYnwxYw|sijt krYjrj}nj}t|tr, |} |n3|s?jtkr/js(jj}n|} |nt|dkrAjdt fvr1|\} |} |njtkrfd|D}n~jtkr,fd|D} |dnBjtkrt}n*fd|D}|D]} ||S)Nrdr c<g|]}|Srrr{vrr8s rr~z.ArgumentParser._get_values.. 'EEEAT__VQ//EEErc<g|]}|Srrrs rr~z.ArgumentParser._get_values.. rrrc<g|]}|Srrrs rr~z.ArgumentParser._get_values.. rr)rrrr!rrrrOrrrr _check_valuerrr)r8rr:r>rrs`` rrzArgumentParser._get_values sA < 2 2 2 ""4((((    * -v|x77$ ' %%% 166!!&%000 -&,,">">'#?~)#   fe , , , ,   " "v|h7G'G'G%KJOOFJ77E   fe , , , ,\Y & &EEEEEEEEEE\V # #EEEEEEEEE   feAh / / / /\X % %EEFEEEEEEEE - -!!&!,,,, s / <<c4|d|j|j}t|s"td}t |||z ||}n#t $rL}t |jdt|j}t|}t ||d}~wttf$rPt |jdt|j}||d}td}t |||zwxYw|S)Nr0z%r is not callabler1)r0r>z!invalid %(type)s value: %(value)r) rr0rrrrrSr4rrr) r8rrrrr rr=r}s rrzArgumentParser._get_value s*&&vv{FKHH  "" 9())Ci88 8 4Yz**FF! - - -6; D4E4EFFDc((C,, ,:& 4 4 46; D4E4EFFD :66D788Cd 33 3  4 s A D*AB11A$Dc|j[||jvrT|dtt|jd}t d}t |||zdSdS)Nr.)r>r z3invalid choice: %(value)r (choose from %(choices)s))r r7rr4rr)r8rr>r}rs rrzArgumentParser._check_value sr > %%v~*E*E"#yyT6>)B)BCCEEDIJJCd 33 3 & %*E*Erc|}||j|j|j|Sr)rrrrrr)r8rvs rrzArgumentParser.format_usage sK'')) DJ  ; = = =$$&&&rc|}||j|j|j||j|jD]d}||j ||j| |j | e||j |Sr)rrrrrrrrrr$rrrr]r)r8rv action_groups rrzArgumentParser.format_help s''))  DJ  ; = = = 4+,,,!/ $ $L  # #L$6 7 7 7   |7 8 8 8  # #L$? @ @ @  ! ! # # # # 4;'''$$&&&rc8||jS)Nr)r^rhrDs rrzArgumentParser._get_formatter s###333rcr| tj}|||dSr)rrrrr8files r print_usagezArgumentParser.print_usage& s6 <;D D--//66666rcr| tj}|||dSr)rrrrrs rrzArgumentParser.print_help+ s6 <;D D,,..55555rcT|r%| tj}||dSdSr)rstderrwrite)r8rrs rrzArgumentParser._print_message0 s8  |{ JJw       rrcr|r ||tjtj|dSr)rrrr)r8statusrs rrzArgumentParser.exit9 s8  6    5 5 5 &rc|tj|j|d}|dt d|zdS)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. )rhrrNz%(prog)s: error: %(message)s N)rrrrhrr)r8rr}s rrzArgumentParser.error> sQ %%% g66 !Q7884?@@@@@rrLr)rN)#r1rFrGrHrrmr5rqrrwror}rrrrrrrrrrrrrrrrrrrrrrrmrns@rrrsR,!!.!'+"&")"#=0=0=0=0=0=0D ? ? ?>*** ...$$$$Lx!x!x!t2###, 8&8&8&t+++Z+++bH!H!H!H!Z666p4444''' '''.444 7777 6666      A A A A A A Arr)4rH __version____all__osrYrercsysrrHrrrrVrrrrrrrr/r*rLrr r rr rE Exceptionrrr rrprwr}rrrrrrrrrr rrrrrrrrs;;z    , .........      . v>   "@@@@@F@@@FQQQQQ-QQQ!!!!!6!!!M: $ $ $ $ $} $ $ $&   ?????I???(        \@\@\@\@\@ \@\@\@~$/$/$/$/$/F$/$/$/N . . . . .6 . . .F22222222.(")"#-#-#-#-#-F#-#-#-L--------6111116111.&&V4bLbLbLbLbLbLbLbLH-----M---1:1:1:1:1:v1:1:1:n$$$$$ $$$(s8s8s8s8s8s8s8s8l ';';';';';&';';';TEEEEEnEEE8QAQAQAQAQA%'8QAQAQAQAQAs # 11