fddZdZgdZddlZddlZddlZddl Z ddl m Z m Z dZ dZdZd Zd Zd Zd ZGd deZdZGddeZGddeZGddeZGddeZGddeZdZGddeZGddeZGdd 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-d.e Z'Gd/d0e Z(Gd1d2e Z)Gd3d4e Z*Gd5d6e Z+Gd7d8e&Z,Gd9d:eZ-Gd;deZ/Gd?d@e/Z0GdAdBe0Z1GdCdDee/Z2dS)Ea 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)gettextngettextz ==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 //opt/alt/python311/lib64/python3.11/argparse.py__repr__z_AttributeHolder.__repr__vsJJ'   >>## * *C   tCyy ) ) ) )++-- ( (KD%  "" (""dddEE#:;;;;"' $  9   vY7 8 8 8$99dii &<&<&<&<==cNt|jSN)list__dict__itemsr+s r2r(z_AttributeHolder._get_kwargssDM''))***r4cgSr6r:s r2r%z_AttributeHolder._get_argss r4N)r$ __module__ __qualname____doc__r3r(r%r<r4r2rrmsK > > >+++r4rc||gSt|tur |ddSddl}||SNr)r#r7copy)r9rBs r2 _copy_itemsrCsG }  E{{dQQQxKKK 99U  r4ceZdZdZ 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|"ddl}|j}|dz}||_||_t |t |dz |dz|_||_d|_ d|_ d|_ | |d|_ |j |_tjdtj|_tjd|_dS)NrrEz\s+z\n\n\n+)shutilget_terminal_sizecolumns_prog_indent_incrementminmax_max_help_position_width_current_indent_level_action_max_length_Section _root_section_current_section_recompileASCII_whitespace_matcher_long_break_matcher)r+progindent_incrementmax_help_positionwidthrIs r2__init__zHelpFormatter.__init__s = MMM,,..6E QJE !1"%&7&)%"*6F6J&K&K#M#M   "#!]]466 $ 2#&;vsy#A#A #&;z#:#:   r4cP|xj|jz c_|xjdz c_dSNrRrMrSr:s r2_indentzHelpFormatter._indents-  66 q r4cz|xj|jzc_|jdks Jd|xjdzc_dS)NrzIndent decreased below 0.rdrer:s r2_dedentzHelpFormatter._dedentsJ  66#q(((*E((( q r4ceZdZddZdZdS)HelpFormatter._SectionNc>||_||_||_g|_dSr6) formatterparentheadingr9)r+rlrmrns r2razHelpFormatter._Section.__init__s"&DN DK"DLDJJJr4c|j|j|jj}|d|jD}|j|j|sdS|jturA|j:|jj}tdt|jz}d|d|fz}nd}|d||dgS)Ncg|] \}}|| Sr<r<).0funcargss r2 z6HelpFormatter._Section.format_help..s"GGGjdDddDkGGGr4z %(heading)s:)rn%*s%s  ) rmrlrf _join_partsr9rhrnrrR_dict)r+r* item_helpcurrent_indent heading_textrns r2 format_helpz"HelpFormatter._Section.format_helps{&&&(((>-DGGDJGGGHHI{&&&((( r|8++ 0H!%!? 004 3M3M3MM #~r<&HH4w 4899 9r4r6)r$r=r>rar~r<r4r2rUrjs7      : : : : :r4rUcH|jj||fdSr6)rWr9r&)r+rrrss r2 _add_itemzHelpFormatter._add_items& #**D$<88888r4c||||j|}||jg||_dSr6)rfrUrWrr~)r+rnsections r2 start_sectionzHelpFormatter.start_sectionsL --d&;WEE w*B/// 'r4cP|jj|_|dSr6)rWrmrhr:s r2 end_sectionzHelpFormatter.end_sections! $ 5 < r4c\|tur | ||j|gdSdSdSr6)rr _format_text)r+texts r2add_textzHelpFormatter.add_texts? x  D$4 NN4,tf 5 5 5 5 5 $4$4r4c^|tur#||||f}||j|dSdSr6)rr _format_usage)r+usageactionsgroupsprefixrss r2 add_usagezHelpFormatter.add_usages@  '661D NN4-t 4 4 4 4 4 ! r4c||jtur|j}||g}||D] }|||!t t t|}||jz}t |j ||_ | |j |gdSdSr6) helpr_format_action_invocation_iter_indented_subactionsr&rOmaplenrRrTr_format_action)r+actionget_invocation invocations subactioninvocation_length action_lengths r2 add_argumentzHelpFormatter.add_arguments ;h & &";N)>&112K!;;FCC > > "">>)#<#<====!$C[$9$9 : : -0DDM&)$*A*7'9'9D # NN4. 9 9 9 9 9 ' &r4c:|D]}||dSr6)r)r+rrs r2 add_argumentszHelpFormatter.add_argumentss2 & &F   f % % % % & &r4c|j}|r3|jd|}|ddz}|S)N rw)rVr~r\substrip)r+rs r2r~zHelpFormatter.format_helpsQ!--//  ++//==D::d##d*D r4c@dd|DS)Nruc(g|]}|r |tu |Sr<)r)rqparts r2rtz-HelpFormatter._join_parts..&s5::: :$($8$8$8$8$8r4)r*)r+ part_stringss r2rxzHelpFormatter._join_parts%s4ww::$0:::;; ;r4cv|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: r]z%(prog)s cg|]}||Sr<r<)rqss r2rtz/HelpFormatter._format_usage..FsCCCACaCCCr4z%\(.*?\)+(?=\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)Nrdrr)rr&r*)partsindentrlineslineline_lenr text_widths r2 get_linesz.HelpFormatter._format_usage..get_linesZsED)#&v;;?#&v;;? %22#a<#d))3j@@T@!LL#((4..)@AAA#%D'*6{{QH D))) CIIM1> Vchhtnn%<===)#(8CKKLL#9a Lr4g?rdrwrr6) ryrzrLoption_stringsr&_format_actions_usager*rQrRrrXfindallextend)r+rrrrr] optionals positionalsrformat action_usage part_regexp opt_usage pos_usage opt_parts pos_partsrrrrrs @r2rzHelpFormatter._format_usage*sE >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$43C3C3C3Cr4z[\[(]z[\])]z(%s) z\1 (%s)z *ru)set_group_actions ValueErrorindexraddrrrequiredrange enumerater&getpopr#_get_default_metavar_for_positional _format_argsnargs format_usage!_get_default_metavar_for_optionalsortedr*rXrr)r+rr group_actionsinsertsgroupstartgroup_action_countendsuppressed_actions_countrexposed_actions_countirdefaultr option_string args_stringropencloses r2rz#HelpFormatter._format_actions_usages} * )* )E' 9 !7!7!7888& ) e&:1&=>>&))=%>%>"0059%)===/0,"'"6::%))&111!;(22494,>AY,Y)0!  >/ G++#ENNNd2NNNN-0GEN'>>#CLLLC/LLLL+.GCLL.22 G++#ENNNd2NNNN-0GEN'>>#CLLLC/LLLL+.GCL"519c22))%( I    N"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<<zz|| s E  EEcd|vr|t|jz}t|j|jz d}d|jz}||||dzS)Nz%(prog)r rr)rzrLrOrQrR _fill_text)r+rrrs r2rzHelpFormatter._format_textse   $DJ////Dt';;R@@ t++tZ886AAr4c~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) NrErrurvz %*s%-*s rrdrw)rNrTrPrOrQrRrrrr _expand_help _split_linesr&endswithrrrx) r+r help_position help_width action_width action_headertup indent_firstr help_text help_linesrrs r2rzHelpFormatter._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&&&r4c|js8||}|||d\}|Sg}|jdkr||jnO||}|||}|jD]}||d|d|S)Nrdrrr!) rr_metavar_formatterrrrrr&r*)r+rrmetavarrrrs r2rz'HelpFormatter._format_action_invocation4s$ $>>vFFG?t..vw??BBHGNE|q   V23333 @@HH"//@@ %+%:IIMLLMMM;;!GHHHH99U## #r4c|j|jn3|j*d|jD}dd|zn|fd}|S)Nc,g|]}t|Sr<str)rqchoices r2rtz4HelpFormatter._metavar_formatter..PsDDD63v;;DDDr4z{%s},c>ttrSf|zSr6) isinstancetuple) tuple_sizeresults r2rz0HelpFormatter._metavar_formatter..formatUs'&%(( / zJ..r4)rchoicesr*)r+rdefault_metavar choice_strsrrs @r2rz HelpFormatter._metavar_formatterLsn > %^FF ^ 'DDV^DDDKchh{333FF$F / / / / /  r4c|||}|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%srdrrEz [%s [%s ...]]z[%s ...]z %s [%s ...]rz%s ...rucg|]}dS)r r<)rqrys r2rtz.HelpFormatter._format_args..rs===A4===r4zinvalid nargs valuer) rrrrrrrrrr TypeErrorrr*)r+rr  get_metavarrrformatss r2rzHelpFormatter._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)Nrr$rr!c,g|]}t|Sr<r)rqcs r2rtz.HelpFormatter._expand_help..s$G$G$GSVV$G$G$Gr4) rzvarsrLr7rhasattrr$rr*_get_help_string)r+rparamsr0 choices_strs r2rzHelpFormatter._expand_helpxsd6ll444LL ! !Dd|x''4LLL 5 5Dvd|Z00 5%d|4t ::i ,))$G$GVI5F$G$G$GHHK +F9 $$V,,v55r4c#K |j}||Ed{V|dS#t$rYdSwxYwr6)_get_subactionsrfrhAttributeError)r+rget_subactionss r2rz'HelpFormatter._iter_indented_subactionssw #3N LLNNN%~'' ' ' ' ' ' ' ' LLNNNNN     DD sA AAc|jd|}ddl}|||S)Nrr)r[rrtextwrapwrap)r+rr`rs r2rzHelpFormatter._split_linessE'++C66<<>> }}T5)))r4c|jd|}ddl}|||||S)Nrr)initial_indentsubsequent_indent)r[rrrfill)r+rr`rrs r2rzHelpFormatter._fill_textsT'++C66<<>>}}T5,2/577 7r4c|jSr6)rr+rs r2rzHelpFormatter._get_help_string {r4c4|jSr6)destupperr%s r2rz/HelpFormatter._get_default_metavar_for_optionals{  """r4c|jSr6)r(r%s r2rz1HelpFormatter._get_default_metavar_for_positionalr&r4)rErFNr6) r$r=r>r?rarfrhobjectrUrrrrrrrr~rxrrrrrrrrrrrrrrr<r4r2rrs#$#% ;;;;> :::::6:::@999 ((( 6665555 :::$&&&;;; ^,^,^,@qqqfBBB.'.'.'`$$$0 8 6 6 6***777###r4rceZdZdZdZdS)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)Nruc3"K|] }|zV dSr6r<)rqrrs r2 z9RawDescriptionHelpFormatter._fill_text..s'PPv}PPPPPPr4T)keepends)r* splitlines)r+rr`rs `r2rz&RawDescriptionHelpFormatter._fill_texts8wwPPPP$1O1OPPPPPPr4N)r$r=r>r?rr<r4r2r r s2 QQQQQr4r 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*|Sr6)r1)r+rr`s r2rz!RawTextHelpFormatter._split_liness   r4N)r$r=r>r?rr<r4r2r r s- !!!!!r4r 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|vr>|jtur0ttg}|js |j|vr|tdz }|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. Nruz %(default)z (default: %(default)s))rrrrrrrry)r+rrdefaulting_nargss r2rz.ArgumentDefaultsHelpFormatter._get_help_stringsh{ <D t # #~X--$,l#; (9FLr?rr<r4r2rrs- r4rceZdZdZdZdZdS)r a Help 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|jjSr6r#r$r%s r2rz:MetavarTypeHelpFormatter._get_default_metavar_for_optional {##r4c|jjSr6r9r%s r2rzr?rrr<r4r2r r s<$$$$$$$$r4r c|dS|jrd|jS|jdtfvr|jS|jdtfvr|jS|jr dd|jzdzSdS)N/{r})rr*rrr(r)arguments r2_get_action_namerAst  xx/000  $!1 1 1 tX. . .}  SXXh.///#55tr4ceZdZdZdZdZdS)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||_||_dSr6)rA argument_namemessage)r+r@rEs r2razArgumentError.__init__s-h77 r4cp|jd}ntd}|t|j|jzS)Nz %(message)sz'argument %(argument_name)s: %(message)s)rErD)rDryrzrE)r+rs r2__str__zArgumentError.__str__sH   %"FF@AAFT\+/+=???? ?r4N)r$r=r>r?rarGr<r4r2rrs< ?????r4rceZdZdZdS)rz@An error from trying to convert a command line string to a type.N)r$r=r>r?r<r4r2rrsJJDr4rc>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 ||_||_||_||_||_||_||_||_| |_| |_ dSr6 rr(rconstrr#rrrr) r+rr(rrLrr#rrrrs r2razAction.__init__LsO-          r4c(gd}fd|DS)NrKc4g|]}|t|fSr<getattrrqr0r+s r2rtz&Action._get_kwargs..o(>>>wtT**+>>>r4r<r+namess` r2r(zAction._get_kwargsbs0    ?>>>>>>>r4c|jdSrArr:s r2rzAction.format_usageqs"1%%r4c:ttd)Nz.__call__() not defined)NotImplementedErrorryr+parser namespacevaluesrs r2__call__zAction.__call__ts!!$=">">???r4NNNNNFNNr6)r$r=r>r?rar(rr]r<r4r2r r s00j, ? ? ?&&&@@@@@@r4r c:eZdZ dfd ZddZdZxZS)rNFc g} |D]N} | | | dr"d| ddz} | | Ot| |d|||||| dS)N----no-rEr) rr(rrr#rrrr)r& startswithsuperra) r+rr(rr#rrrr_option_stringsr __class__s r2razBooleanOptionalAction.__init__ys+ 6 6M  " "= 1 1 1''-- 6 '-*; ; &&}555 *      r4cp||jvr,t||j|d dSdS)Nrb)rsetattrr(rcrYs r2r]zBooleanOptionalAction.__call__sC D/ / / Itym.F.Fw.O.O*O P P P P P 0 /r4c6d|jS)Nz | )r*rr:s r2rz"BooleanOptionalAction.format_usageszz$-...r4)NNNFNNr6)r$r=r>rar]r __classcell__rfs@r2rrxsx<QQQQ///////r4rc8eZdZ 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 constrK)rrrdrmra r+rr(rrLrr#rrrrrfs r2raz_StoreAction.__init__s A::KLL L  (!2!2?(JKK K lD!!**) +     r4c2t||j|dSr6)rhr(rYs r2r]z_StoreAction.__call__s 49f-----r4r^r6r$r=r>rar]rjrks@r2rmrmsk :........r4rmc2eZdZ dfd ZddZxZS)_StoreConstActionNFc ftt|||d||||dS)Nr)rr(rrLrrr)rdrtra r+rr(rLrrrrrfs r2raz_StoreConstAction.__init__sL &&//) 0     r4c<t||j|jdSr6)rhr(rLrYs r2r]z_StoreConstAction.__call__s 49dj11111r4NNFNNr6rrrks@r2rtrtsb "22222222r4rtc&eZdZ dfd ZxZS)_StoreTrueActionFNcdtt|||d|||dS)NTrr(rLrrr)rdrzrar+rr(rrrrfs r2raz_StoreTrueAction.__init__sI %%..) /     r4)FFNr$r=r>rarjrks@r2rzrzsH           r4rzc&eZdZ dfd ZxZS)_StoreFalseActionTFNcdtt|||d|||dS)NFr|)rdrrar}s r2raz_StoreFalseAction.__init__sI &&//) 0     r4)TFNr~rks@r2rrsH           r4rc8eZdZ 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 appropriaterorK)rrrdrrarps r2raz_AppendAction.__init__s A::OPP P  (!2!2?(JKK K mT""++) ,     r4ct||jd}t|}||t ||j|dSr6)rPr(rCr&rhr+rZr[r\rr9s r2r]z_AppendAction.__call__N 49d33E"" V 49e,,,,,r4r^r6rrrks@r2rrsk :--------r4rc2eZdZ dfd ZddZxZS)_AppendConstActionNFc htt|||d|||||dS)Nr)rr(rrLrrrr)rdrrarvs r2raz_AppendConstAction.__init__#sO  $''00) 1     r4ct||jd}t|}||jt ||j|dSr6)rPr(rCr&rLrhrs r2r]z_AppendConstAction.__call__5sP 49d33E"" TZ    49e,,,,,r4rxr6rrrks@r2rr!sb $--------r4rc.eZdZ dfd ZddZxZS) _CountActionNFcdtt|||d|||dS)Nr)rr(rrrr)rdrrar}s r2raz_CountAction.__init__>sH lD!!**) +     r4clt||jd}|d}t||j|dzdSNrrd)rPr(rh)r+rZr[r\rcounts r2r]z_CountAction.__call__Ls= 49d33 =E 49eai00000r4)NFNr6rrrks@r2rr<s\       11111111r4rc.eZdZeedffd ZddZxZS) _HelpActionNcbtt||||d|dS)Nrrr(rrr)rdrra)r+rr(rrrfs r2raz_HelpAction.__init__UsE k4  ))) *     r4cV||dSr6) print_helpexitrYs r2r]z_HelpAction.__call__as% r4r6r$r=r>rrar]rjrks@r2rrSs\!      r4rc0eZdZdeedffd ZddZxZS)_VersionActionNc|td}tt||||d|||_dS)Nz&show program's version number and exitrr)ryrdrraversion)r+rrr(rrrfs r2raz_VersionAction.__init__hs[ <=>>D nd##,,) -     r4c|j}||j}|}||||t j|dSr6)r_get_formatterr_print_messager~_sysstdoutr)r+rZr[r\rrrls r2r]z_VersionAction.__call__xso, ?nG))++ 7###i3355t{CCC r4r6rrks@r2rrfs_!  r4rcXeZdZGddeZedddffd ZdZdZd dZ xZ S) _SubParsersActionceZdZfdZxZS)&_SubParsersAction._ChoicesPseudoActionc|x}}|r|dd|zz }ttj|}|g|||dS)Nrr!)rr(rr)r*rdr_ChoicesPseudoActionra)r+r0aliasesrrr(suprfs r2raz/_SubParsersAction._ChoicesPseudoAction.__init__sq! !Gd 87TYYw%7%777)>EEC LLD!(  * * * * *r4r~rks@r2rrs8 * * * * * * * * *r4rFNc ||_||_i|_g|_t t |||t|j|||dS)N)rr(rrrrr) _prog_prefix _parser_class_name_parser_map_choices_actionsrdrrar) r+rr] parser_classr(rrrrfs r2raz_SubParsersAction.__init__so!) " " &&//)) 0     r4c |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)Nr]rrr<zconflicting subparser: %szconflicting subparser alias: %sr) rrrrrryrrr&r)r+r0kwargsraliasr choice_actionrZs r2 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 !% ( ( r4c|jSr6)rr:s r2rz!_SubParsersAction._get_subactionss $$r4ct|d}|dd}|jturt||j| |j|}nM#t$r@|d|jd}t d|z}t||wxYw||d\} }t|  D]\} } t|| | |rRt| tgt|t|dSdS)Nrrdr!) parser_namerz5unknown parser %(parser_name)r (choices: %(choices)s))r(rrhrKeyErrorr*ryrparse_known_argsrr9 setdefault_UNRECOGNIZED_ARGS_ATTRrPr) r+rZr[r\rrr-rsmsg subnamespacekeyr1s r2r]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 Br6) r$r=r>r rrrarrr]rjrks@r2rrs*****v***.<%%%LLLLLLLLr4rceZdZddZdS) _ExtendActionNct||jd}t|}||t ||j|dSr6)rPr(rCrrhrs r2r]z_ExtendAction.__call__rr4r6)r$r=r>r]r<r4r2rrs(------r4rc&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>||_||_||_||_dSr6)_mode_bufsize _encoding_errors)r+modebufsizeencodingerrorss r2razFileType.__init__s"  ! r4c|dkrdjvr&djvrtjjn tjSt fddDr&djvrtjjn tjSt djz}t| t|jj j j S#t$r+}||d}t d}t||zd}~wwxYw) N-rbc3*K|] }|jvVdSr6)r)rqrr+s r2r/z$FileType.__call__.. s)44Q$*_444444r4waxzargument "-" with mode %r)filenameerrorz$can't open '%(filename)s': %(error)s)rrstdinbufferanyrryrrrrrOSErrorr)r+stringrersrEs` r2r]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)r')rqr/s r2rtz%FileType.__repr__..s#EEEC3"99d3ii999r4c&g|]\}}||d|S)Nrr<)rqkwr/s r2rtz%FileType.__repr__.. s3222gb#!$*,SS1!0r4r r")rrrrr*r#r$)r+rsrargs_strs r2r3zFileType.__repr__sz4=(t~.4<0HI99EE4EEE22222233 ::...99r4)rrNN)r$r=r>r?rar]r3r<r4r2rrsP  444(:::::r4rc$eZdZdZdZdZdZdS)r zSimple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. c >|D]}t||||dSr6)rh)r+rr0s r2razNamespace.__init__/s4 . .D D$t - - - - . .r4czt|tstSt|t|kSr6)rr NotImplementedr)r+others r2__eq__zNamespace.__eq__3s1%++ "! !DzzT%[[((r4c||jvSr6)r8)r+rs r2 __contains__zNamespace.__contains__8sdm##r4N)r$r=r>r?rarrr<r4r2r r (sK ...))) $$$$$r4r 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_falser& append_constrrrparsersrz^-\d+$|^-\d*\.\d+$)rdrra descriptionargument_default prefix_charsconflict_handler _registriesregisterrmrtrzrrrrrrrr _get_handler_actions_option_string_actions_action_groups_mutually_exclusive_groups _defaultsrXrY_negative_number_matcher_has_negative_number_optionals)r+rrrrrfs r2raz_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+++r4cF|j|i}|||<dSr6)rr)r+ registry_namer1r+registrys r2rz_ActionsContainer.registerss'#..}bAA r4NcD|j|||Sr6)rr)r+rr1rs r2 _registry_getz_ActionsContainer._registry_getws  .225'BBBr4c |j||jD]}|j|vr||j|_dSr6)rupdaterr(r)r+rrs r2 set_defaultsz_ActionsContainer.set_defaults}sQ f%%%m 5 5F{f$$!' !4 5 5r4c|jD]}|j|kr|j |jcS|j|dSr6)rr(rrr)r+r(rs r2 get_defaultz_ActionsContainer.get_defaultsNm & &F{d""v~'A~%%%~!!$---r4c8|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, ...) rdrr(z+dest supplied twice for positional argumentrNzunknown action ""r#z 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_classcallablerr#rrrrr _add_action)r+rsrcharsr( action_classr type_funcs r2rz_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||Sr6)_ArgumentGrouprr&)r+rsrrs r2add_argument_groupz$_ActionsContainer.add_argument_groups;t5d555f55 ""5))) r4c Tt|fi|}|j||Sr6)_MutuallyExclusiveGrouprr&)r+rrs r2add_mutually_exclusive_groupz._ActionsContainer.add_mutually_exclusive_groups3'7777 '..u555 r4c$|||j|||_|jD] }||j|< |jD]=}|j|r!|js|jd>|S)NT) _check_conflictrr& containerrrrmatchr)r+rrs r2rz_ActionsContainer._add_actions V$$$ V$$$$2 @ @M9?D ' 6 6$2 E EM,22=AA E:E7>>tDDD r4c:|j|dSr6)rremover%s r2_remove_actionz _ActionsContainer._remove_actions V$$$$$r4ci}|jD];}|j|vr&td}t||jz|||j< > >!%F:  ::g  , . .9F3J3J!%F: Fb9999r4c@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)rrdr(z%dest= is required for options like %rrryr') rryrr&rrlstripreplacerz) r+rsrrlong_option_stringsrrr(dest_option_strings r2r z&_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))DFnEEEEr4c\|d|}|d||S)Nr)rr)r+rrrs r2r z#_ActionsContainer._pop_action_class?s-Hg..!!(FF;;;r4cd|jz} t||S#t$r'td}t ||jzwxYw)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)rrPrryr)r+handler_func_namers r2rz_ActionsContainer._get_handlerCse1D4II :4!233 3 : : :;<.^s,%=%=%=)>&3%=%=%=r4)rrr*r)r+rconflicting_actionsrEconflict_strings r2_handle_conflict_errorz(_ActionsContainer._handle_conflict_errorZsk:;23355))%=%=(;%=%=%=>>FGo$=>>>r4c|D][\}}|j||j|d|js|j|\dSr6)rrrrrr)r+rr6rs r2_handle_conflict_resolvez*_ActionsContainer._handle_conflict_resolvecsy&9 8 8 !M6  ! ( ( 7 7 7  ' + +M4 @ @ @( 8 //777 8 8r4r6)r$r=r>rarrrrrrrrrr%r r r rrr8r:rjrks@r2rr<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<)rrrrrdrrar!rrrrrrr)r+rr!rrr super_initrfs r2raz_ArgumentGroup.__init__ts"!9#=>>>~y5666!9#=>>>>4009  55{5f555  %0!* &/&F#",  4 +*3*N'''r4ctt||}|j||Sr6)rdrrrr&r+rrfs r2rz_ArgumentGroup._add_actions<~t,,88@@ ""6*** r4ctt|||j|dSr6)rdrrrrr?s r2rz_ArgumentGroup._remove_actions> nd##226::: ""6*****r4cntjdtdtj|i|S)Nz&Nesting argument groups is deprecated.rEcategory stacklevel)warningswarnDeprecationWarningrdrr+rsrrfs r2rz!_ArgumentGroup.add_argument_groupsC 4'    *uww)4:6:::r4NN)r$r=r>rarrrrjrks@r2rrrsOOOOOO, +++++;;;;;;;;;r4rc6eZdZdfd ZdZdZfdZxZS)rFcttt||||_||_dSr6)rdrrar _container)r+rrrfs r2raz _MutuallyExclusiveGroup.__init__s4 %t,,55i@@@  #r4c|jrtd}t||j|}|j||S)Nz-mutually exclusive arguments must be optional)rryrrLrrr&)r+rrs r2rz#_MutuallyExclusiveGroup._add_actionsW ? "CDDCS// !,,V44 ""6*** r4cn|j||j|dSr6)rLrrrr%s r2rz&_MutuallyExclusiveGroup._remove_actions5 &&v... ""6*****r4cntjdtdtj|i|S)Nz0Nesting mutually exclusive groups is deprecated.rErB)rErFrGrdrrHs r2rz4_MutuallyExclusiveGroup.add_mutually_exclusive_groupsC >'    4uww3TDVDDDr4)F)r$r=r>rarrrrjrks@r2rrs}$$$$$$ +++EEEEEEEEEr4rc 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|Sr6r<)rs r2identityz)ArgumentParser.__init__..identitysMr4r#rhrErzshow this help message and exit)rrr)rdrra_ospathbasenamerargvr]repilogformatter_classfromfile_prefix_charsadd_help allow_abbrev exit_on_errorrry _positionals _optionals _subparsersrrrr%rrr)r+r]rrrZparentsr[rr\rrr]r^r_ superinit add_grouprTdefault_prefixrmdefaultsrfs r2razArgumentParser.__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)r]rrr[rr]c4g|]}|t|fSr<rOrQs r2rtz.ArgumentParser._get_kwargs..rRr4r<rSs` r2r(zArgumentParser._get_kwargss0   ?>>>>>>>r4c |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 subcommandsr]rurrr<)rbrryrr#rrr`rr_get_positional_actionsrrrr~rr r) r+rr!rrlrr parsers_classrs r2add_subparserszArgumentParser.add_subparserss   ' JJqCDD E E E .$t**555 f    7 7fjj-8899EFJJ}d;;<.Es0***(****r4rr:s r2_get_optional_actionsz$ArgumentParser._get_optional_actionsDs%**"m*** *r4c$d|jDS)Nc g|] }|j | Sr<rVrrs r2rtz:ArgumentParser._get_positional_actions..Js0...,....r4rsr:s r2rlz&ArgumentParser._get_positional_actionsIs%.."m... .r4c|||\}}|r:td}||d|z|SNzunrecognized arguments: %sr)rryrr*r+rsr[rYrs r2 parse_argszArgumentParser.parse_argsQsW**4;; d  -011C JJsSXXd^^+ , , , r4c|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 ||fSrc)rrYr7r rr(rrrrhrr__parse_known_argsrrrrrrPdelattr)r+rsr[rr(errs r2rzArgumentParser.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)NrdrarAOruch | ||}||jurc ||gD]7}| vr1t d}t |}t |||z8|tur| ||dSdS)Nznot allowed with argument %s)r _get_valuesrrryrArr) rargument_stringsrargument_valuesconflict_actionr action_nameaction_conflictsr[ seen_actionsseen_non_default_actionsr+s r2 take_actionz5ArgumentParser._parse_known_args..take_actions   V $ $ $"..v7GHHO fn44(,,V444'7';';FB'G'GGGO&*BBB >??&6&G&G +FC+4EFFFCh..tYGGGGG/.r4c|}|\}}}}j}g} | ||dzS|)||d}j} |dkr|d| vr|dkr|s |d| vr"td} t || |z||g|f|d} | |dz}j} || vr5| |}|dd}|sdx}}n|ddkr d}|dd}nd}n| |z|dz} n|dkr!|dz} |g}||||fngtd} t || |z|dz}|d}|||}||z} || }||||fn|sJ|D]\}}}|||| S)NTrdrrruzignored explicit argument %rr)_match_argumentr&rryrr) start_index option_tuplerrsep explicit_argmatch_argument action_tuples arg_countrrchar optionals_mapstoprsrselected_patternsr-arg_strings_patternextrasoption_string_indicesr+rs r2consume_optionalz:ArgumentParser._parse_known_args..consume_optionals1=L7C 4FM3 "1NMB >MM+k":;;;&?* + .vs ; ;I !-E!Q)!,E99(B..L,q/U":":"#$B"C"CC"/l8J"K"KK%,,fb--HIII,Q/(,|A(> (,(C (M99%2=%AF+7+;L#/)59 9ll!-aC!7!7&)/;ABB/? &("MM$*=>>>#.?D!#a*Q ,~%,,fdM-JKKK  >??+FC,4FGGG (!OE(;EFF(C% .v7H I II 9,D&uTz2D!((&$ )FGGGEB L! =/< 9 9+m FD-8888Kr4c j}|d}| |}t |D]#\}}|||z}||z } ||$ t|d dd<|Sr6)_match_arguments_partialzipr) r match_partialselected_pattern arg_countsrrrsr-rrr+rs r2consume_positionalsz=ArgumentParser._parse_known_args..consume_positionalss 9M2;<<@ &{4DEEJ&)j%A%A * *! "; i0G#GHy(  FD)))))Z)9)9:KN r4rrc g|] }|k| Sr<r<)rqrrs r2rtz4ArgumentParser._parse_known_args..9s.,),),)K'''''r4z(the following arguments are required: %sr!cHg|]}|jtut| Sr<)rrrArrs r2rtz4ArgumentParser._parse_known_args..xs7===!' & 8 ; ;.f55 ; ; ;r4z#one of the arguments %s is requiredrr6)r\_read_args_from_filesrrrrriterr&_parse_optionalr*rrlrOrNrrrArrrrr(rPrh _get_valuerry)"r+r-r[r$rr mutex_action conflictsarg_string_pattern_partsarg_strings_iter arg_stringrpatternrrmax_option_string_indexnext_option_string_indexpositionals_end_indexstrings stop_indexrequired_actionsrrrTrrrrrrrrrrs"``` @@@@@@@@@r2r|z 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*S S S S S S S S S S n2244          (  )&)*?&@&@ # #&( #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&  r4c<g}|D]}|r|d|jvr||* t|dd5}g}|D]/}||D]}||0||}||dddn #1swxYwY#t$r-}| t|Yd}~d}~wwxYw|Sr) r\r&rreadr1convert_arg_line_to_argsrrrrr)r+r-new_arg_stringsr args_filearg_liner/r~s r2rz$ArgumentParser._read_args_from_filess% ) )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|gSr6r<)r+rs r2rz'ArgumentParser.convert_arg_line_to_argss zr4c||}tj||}|dtdttdt tdi}||j}|tdd|j|jz}t||t| dS)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrd) _get_nargs_patternrXrryrrrrrrrr)r+rr nargs_patternr nargs_errorsrs r2rzArgumentParser._match_arguments//77  -)<== =a/00!;<<Q?@@L ""6<00C{56%|--/5|< ,, ,5;;q>>"""r4c8g}tt|ddD]w}|d|}dfd|D}tj||}|3|d|Dnx|S)Nrrruc:g|]}|Sr<)r)rqrr+s r2rtz;ArgumentParser._match_arguments_partial..s7<<<#) $66v>><<.sHHHvs6{{HHHr4)rrr*rXrrr)r+rrrr actions_slicerrs` r2rz'ArgumentParser._match_arguments_partialss7||Q++  A#BQBKMgg<<<<-:<<<==GIg':;;E  HHHHHIII!  r4ct|sdS|d|jvrdS||jvr|j|}||ddfSt|dkrdS|d\}}}|r||jvr|j|}||||fS||}t|dkrLdd|D}||d}t d} || |znt|dkr|\} | S|j |r |j sdSd|vrdSd|ddfS) Nrrdrr!cg|] \}}}}| Sr<r<)rqrrrrs r2rtz2ArgumentParser._parse_optional..s6!O!O!O>+!%!<]!K$mS,F c*** 1  & &=+;5+H+H)M"/"3 !.qrr!2 !%!< ' '  $777!8GF -5GGCMM#&&&&"--m<<'!8GF -t;CMM#&&& ' JJq788=H I I I r4cb|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-*rrur) rrrrrrrr*rr+)r+rrrs r2rz!ArgumentParser._get_nargs_pattern& s  =%MMh  &MMl " "'MMk ! !(MMi  &MMf__)MMh  $MM'3;)?)??M   ;)11$;;M)11#r::Mr4c|||\}}|r:td}||d|z|Srx)parse_known_intermixed_argsryrr*rys r2parse_intermixed_argsz$ArgumentParser.parse_intermixed_argsW sW55dIFF d  -011C JJsSXXd^^+ , , , r4c | 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<)rrrrrs r2rtz>ArgumentParser.parse_known_intermixed_args..l s3 5 5 5  333333r4z3parse_intermixed_args: positional arg with nargs=%src:g|]}|jD] }|v|jSr<)rr()rqrrrs r2rtz>ArgumentParser.parse_known_intermixed_args..r sI I I IE. I I&K2G2G K2G2G2G2Gr4z;parse_intermixed_args: positional in mutuallyExclusiveGroup)rFzDo not expect z in F)rlrrrrr save_nargsrr save_defaultrrr(rPrErFr}rtr save_required) r+rsr[a save_usagerremaining_argsrFrrrrs @r2rz*ArgumentParser.parse_known_intermixed_args^ 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 Icjs<jttfvr' |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)Nrardc<g|]}|Sr<rrqvrr+s r2rtz.ArgumentParser._get_values.. 'EEEAT__VQ//EEEr4c<g|]}|Sr<rrs r2rtz.ArgumentParser._get_values.. rr4rc<g|]}|Sr<rrs r2rtz.ArgumentParser._get_values.. rr4)rrrrrrrrLrrrr _check_valuerrr)r+rr-r1rrs`` r2rzArgumentParser._get_values sK$ fi=P)P)P ""4((((    * -v|x77$ ' %%% 166!!&%000 -&,,">">'#?~)#   fe , , , ,   " "v|h7G'G'G%KJOOFJ77E   fe , , , ,\Y & &EEEEEEEEEE\V # #EEEEEEEEE   feAh / / / /\X % %EEFEEEEEEEE - -!!&!,,,, s6 AAc4|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)Nr#z%r is not callabler$)r#r1z!invalid %(type)s value: %(value)r) rr#rryrrrPr'rrr) r+rrrrrr~r0rss r2rzArgumentParser._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!)r1rz3invalid choice: %(value)r (choose from %(choices)s))rr*rr'ryr)r+rr1rsrs r2rzArgumentParser._check_value sr > %%v~*E*E"#yyT6>)B)BCCEEDIJJCd 33 3 & %*E*Er4c|}||j|j|j|Sr6)rrrrrr~)r+rls r2rzArgumentParser.format_usage sK'')) DJ  ; = = =$$&&&r4c|}||j|j|j||j|jD]d}||j ||j| |j | e||j |Sr6)rrrrrrrrrr!rrrrZr~)r+rl action_groups r2r~zArgumentParser.format_help s''))  DJ  ; = = = 4+,,,!/ $ $L  # #L$6 7 7 7   |7 8 8 8  # #L$? @ @ @  ! ! # # # # 4;'''$$&&&r4c8||jS)Nr)r[r]r:s r2rzArgumentParser._get_formatter% s###333r4cr| tj}|||dSr6)rrrrr+files r2 print_usagezArgumentParser.print_usage+ s6 <;D D--//66666r4cr| tj}|||dSr6)rrrr~rs r2rzArgumentParser.print_help0 s6 <;D D,,..55555r4c|r>|p tj} ||dS#ttf$rYdSwxYwdSr6)rstderrwriterr)r+rErs r2rzArgumentParser._print_message5 sd  &4;D  7#####"G,       s )>>rcr|r ||tjtj|dSr6)rrrr)r+statusrEs r2rzArgumentParser.exit@ s8  6    5 5 5 &r4c|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. )r]rErEz%(prog)s: error: %(message)s N)rrrr]rry)r+rErss r2rzArgumentParser.errorE sQ %%% g66 !Q7884?@@@@@r4rIr6)rN)#r$r=r>r?rrar(rnrrtrlrzrr|rrrrrrrrrrrrrr~rrrrrrrjrks@r2rrsR,!!.!'+"&")"#=0=0=0=0=0=0D ? ? ?>*** ...$$$$LA!A!A!F2###, 7,7,7,r(((T+++bH!H!H!H!Z666p4444''' '''.444 7777 6666  A A A A A A Ar4r)3r? __version____all__osrVrerXsysrrErryrrrrrrrrr+rrCrr r rr rA Exceptionrrr rrmrtrzrrrrrrrrrr rrrrr<r4r2rs;;z    ,********      . v>   "GGGGGFGGGTQQQQQ-QQQ!!!!!6!!!M: $ $ $ $ $} $ $ $&   ?????I???(        \@\@\@\@\@ \@\@\@~$/$/$/$/$/F$/$/$/N . . . . .6 . . .F22222222.(")"#-#-#-#-#-F#-#-#-L--------6111116111.&&V8bLbLbLbLbLbLbLbLH-----M---1:1:1:1:1:v1:1:1:n$$$$$ $$$(s8s8s8s8s8s8s8s8l ';';';';';&';';';TEEEEEnEEE8XAXAXAXAXA%'8XAXAXAXAXAr4