grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a ´iGã@sdZdZgd¢ZddlZddlZddlZddl m Z m Z dZ dZ dZd Zd Zd Zd ZGd d„deƒZdd„ZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdd„ZGdd„deƒZGdd „d eƒZGd!d"„d"eƒZGd#d$„d$eƒZ Gd%d&„d&eƒZ!Gd'd(„d(eƒZ"Gd)d*„d*e"ƒZ#Gd+d,„d,e"ƒZ$Gd-d.„d.eƒZ%Gd/d0„d0eƒZ&Gd1d2„d2eƒZ'Gd3d4„d4eƒZ(Gd5d6„d6eƒZ)Gd7d8„d8eƒZ*Gd9d:„d:e%ƒZ+Gd;d<„d„d>eƒZ-Gd?d@„d@eƒZ.GdAdB„dBe.ƒZ/GdCdD„dDe/ƒZ0GdEdF„dFee.ƒZ1dS)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Ú ArgumentErrorÚArgumentTypeErrorÚBooleanOptionalActionÚFileTypeÚ HelpFormatterÚArgumentDefaultsHelpFormatterÚRawDescriptionHelpFormatterÚRawTextHelpFormatterÚMetavarTypeHelpFormatterÚ NamespaceÚActionÚ ONE_OR_MOREÚOPTIONALÚPARSERÚ REMAINDERÚSUPPRESSÚ ZERO_OR_MOREéN)ÚgettextÚngettextz ==SUPPRESS==ú?Ú*ú+zA...ú...Ú_unrecognized_argsc@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú_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__. cCsŒt|ƒj}g}i}| ¡D]}| t|ƒ¡q| ¡D],\}}| ¡rZ| d||f¡q6|||<q6|rz| dt|ƒ¡d|d |¡fS)Nú%s=%rz**%sú%s(%s)ú, )ÚtypeÚ__name__Ú _get_argsÚappendÚreprÚ _get_kwargsÚ isidentifierÚjoin)ÚselfÚ type_nameÚ arg_stringsÚ star_argsÚargÚnameÚvalue©r.ú /usr/lib64/python3.9/argparse.pyÚ__repr__ts   z_AttributeHolder.__repr__cCst|j ¡ƒS©N)ÚlistÚ__dict__Úitems©r'r.r.r/r$ƒsz_AttributeHolder._get_kwargscCsgSr1r.r5r.r.r/r!†sz_AttributeHolder._get_argsN)r Ú __module__Ú __qualname__Ú__doc__r0r$r!r.r.r.r/rksrcCs6|dur gSt|ƒtur$|dd…Sddl}| |¡S©Nr)rr2Úcopy)r4r:r.r.r/Ú _copy_itemsŠs   r;c@sôeZdZdZd;dd„Zdd„Zd d „ZGd d „d eƒZd d„Z dd„Z dd„Z dd„Z dÖóz6HelpFormatter._Section.format_help..Úz%*s%s: Ú ) r^r]r[Ú _join_partsr4r\r_rrH)r'r&Ú item_helpÚcurrent_indentr_r.r.r/Ú format_helpÑs    z"HelpFormatter._Section.format_help)N)r r6r7rWrjr.r.r.r/rKÉs rKcCs|jj ||f¡dSr1)rMr4r")r'rarbr.r.r/Ú _add_itemèszHelpFormatter._add_itemcCs0| ¡| ||j|¡}| |jg¡||_dSr1)r[rKrMrkrj)r'r_Úsectionr.r.r/Ú start_sectionîszHelpFormatter.start_sectioncCs|jj|_| ¡dSr1)rMr^r\r5r.r.r/Ú end_sectionôs zHelpFormatter.end_sectioncCs$|tur |dur | |j|g¡dSr1)rrkÚ _format_text)r'Útextr.r.r/Úadd_textøszHelpFormatter.add_textcCs&|tur"||||f}| |j|¡dSr1)rrkÚ _format_usage)r'ÚusageÚactionsÚgroupsÚprefixrbr.r.r/Ú add_usageüs zHelpFormatter.add_usagecCsr|jturn|j}||ƒg}| |¡D]}| ||ƒ¡q$ttt|ƒƒ}||j}t|j |ƒ|_ |  |j |g¡dSr1) ÚhelprÚ_format_action_invocationÚ_iter_indented_subactionsr"rEÚmapÚlenrHrJrkÚ_format_action)r'ÚactionÚget_invocationÚ invocationsÚ subactionÚinvocation_lengthÚ action_lengthr.r.r/Ú add_arguments   ÿzHelpFormatter.add_argumentcCs|D]}| |¡qdSr1)r„)r'rtr~r.r.r/Ú add_argumentsszHelpFormatter.add_argumentscCs.|j ¡}|r*|j d|¡}| d¡d}|S)Nú rf)rLrjrRÚsubÚstrip)r'rxr.r.r/rjs  zHelpFormatter.format_helpcCsd dd„|Dƒ¡S)NrecSsg|]}|r|tur|‘qSr.)r)r`Úpartr.r.r/rc"s þz-HelpFormatter._join_parts..)r&)r'Ú part_stringsr.r.r/rg!s ÿzHelpFormatter._join_partscs|durtdƒ}|dur,|t|jd�}�nÖ|durL|sLdt|jd�}�n¶|du�rdt|jd�}g}g}|D] }|jrˆ| |¡qr| |¡qr|j} | |||ƒ} d dd„|| fDƒ¡}|j|j‰t |ƒt |ƒˆk�rd} | ||ƒ} | ||ƒ} t   | | ¡}t   | | ¡}d‡fdd „ }t |ƒt |ƒd ˆk�rždt |ƒt |ƒd }|�r|||g|||ƒ}|  |||ƒ¡n |�r–||g|||ƒ}n|g}nZdt |ƒ}||}|||ƒ}t |ƒd k�rîg}|  |||ƒ¡|  |||ƒ¡|g|}d  |¡}d ||fS)Nzusage: ©rSz%(prog)sú cSsg|] }|r|‘qSr.r.)r`Úsr.r.r/rcBrdz/HelpFormatter._format_usage..z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+csÆg}g}|durt|ƒd}n t|ƒd}|D]Z}|dt|ƒˆkrn|rn| |d |¡¡g}t|ƒd}| |¡|t|ƒd7}q.|r¢| |d |¡¡|durÂ|dt|ƒd…|d<|S)NrYrŒr)r|r"r&)ÚpartsÚindentrvÚlinesÚlineÚline_lenr‰©Ú text_widthr.r/Ú get_linesVs"   z.HelpFormatter._format_usage..get_linesgè?rYrfz%s%s )N) Ú_ÚdictrBÚoption_stringsr"Ú_format_actions_usager&rGrHr|rNÚfindallÚextend)r'rsrtrurvrSÚ optionalsÚ positionalsr~ÚformatÚ action_usageÚ part_regexpÚ opt_usageÚ pos_usageÚ opt_partsÚ pos_partsr•r�r�rŽr.r“r/rr&sX     ÿ        zHelpFormatter._format_usagec Cstƒ}i}|D�]*}|js(td|›�ƒ‚z| |jd¡}WntyRYqYq0|t|jƒ}|||…|jkr|jD]}| |¡qz|jsÖ||vrª||d7<nd||<||vrÌ||d7<nd||<nF||vrð||d7<nd||<||v�r||d7<nd||<t|d |ƒD]} d || <�q*qg} t|ƒD�]"\} }|j t u�r¨|   d¡|  | ¡d k�r„|  | ¡n"|  | d ¡d k�rj|  | d ¡nÂ|j�s| |¡} | || ¡} ||v�rø| ddk�rø| d dk�rø| d d …} |   | ¡nf|jd} |jdk�r$| ¡} n"| |¡} | || ¡}d | |f} |j�s`||v�r`d | } |   | ¡�qHt|dd�D]} || g| | | …<�qzd dd„| Dƒ¡}d}d}t d|d|¡}t d|d|¡}t d||fd|¡}t dd|¡}| ¡}|S)Nz empty group rz [ú[ú]z (ú(ú)rYú|éÿÿÿÿú%s %sú[%s]T)ÚreverserŒcSsg|]}|dur|‘qSr1r.)r`Úitemr.r.r/rcârdz7HelpFormatter._format_actions_usage..z[\[(]z[\])]z(%s) z\1ú (%s)z%s *%srez \(([^|]*)\))ÚsetÚ_group_actionsÚ ValueErrorÚindexr|ÚaddÚrequiredÚrangeÚ enumeraterxrr"ÚgetÚpopr˜Ú#_get_default_metavar_for_positionalÚ _format_argsÚnargsÚ format_usageÚ!_get_default_metavar_for_optionalÚsortedr&rNr‡rˆ)r'rtruÚ group_actionsÚinsertsÚgroupÚstartÚendr~ÚirŽÚdefaultr‰Ú option_stringÚ args_stringrpÚopenÚcloser.r.r/r™†s~                     z#HelpFormatter._format_actions_usagecCsFd|vr|t|jd�}t|j|jdƒ}d|j}| |||¡dS)Nz%(prog)r‹é rŒr†)r—rBrErGrHÚ _fill_text)r'rpr”r�r.r.r/roðs  zHelpFormatter._format_textc CsNt|jd|jƒ}t|j|dƒ}||jd}| |¡}|jsV|jd|f}d|}n@t|ƒ|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|j�r |j  ¡�r |  |¡} | �r"|  | |¡} |  d|d| df¡| dd…D]} |  d|d| f¡qðn|  d¡�s"|  d¡| |¡D]} |  | | ¡¡�q,| |¡S) Nr<rËrez%*s%s z %*s%-*s rrYrf)rDrJrFrErGrHryrxr|rˆÚ _expand_helpÚ _split_linesr"Úendswithrzr}rg) r'r~Ú help_positionÚ help_widthÚ action_widthÚ action_headerÚtupÚ indent_firstrŽÚ help_textÚ help_linesr‘r�r.r.r/r}÷s: ÿ         zHelpFormatter._format_actioncCs„|js&| |¡}| ||¡dƒ\}|Sg}|jdkrB| |j¡n4| |¡}| ||¡}|jD]}| d||f¡q^d |¡SdS)NrYrr«r) r˜rºÚ_metavar_formatterr¼r›r¾r»r"r&)r'r~rÆÚmetavarrŽrÈrÇr.r.r/ry's     z'HelpFormatter._format_action_invocationcsP|jdur|j‰n.|jdur.z{%s}ú,cstˆtƒrˆSˆf|SdSr1)Ú isinstanceÚtuple)Ú tuple_size©Úresultr.r/ržHs z0HelpFormatter._metavar_formatter..format)rÙÚchoicesr&)r'r~Údefault_metavarÚ choice_strsržr.rár/rØ?s   z HelpFormatter._metavar_formattercCs | ||¡}|jdur$d|dƒ}nä|jtkr.zinvalid nargs valuerŒ) rØr¼rrr|r rrrr¶Ú TypeErrorr²r&)r'r~räÚ get_metavarrârÙÚformatsr.r.r/r»Os0            zHelpFormatter._format_argscCs˜tt|ƒ|jd�}t|ƒD]}||tur||=qt|ƒD] }t||dƒr:||j||<q:| d¡durŠd dd„|dDƒ¡}||d<|  |¡|S)Nr‹r rãrcSsg|] }t|ƒ‘qSr.rÚ©r`Úcr.r.r/rctrdz.HelpFormatter._expand_help..) r—ÚvarsrBr2rÚhasattrr r¸r&Ú_get_help_string)r'r~Úparamsr,Ú choices_strr.r.r/rÍks   zHelpFormatter._expand_helpccs>z |j}WntyYn0| ¡|ƒEdH| ¡dSr1)Ú_get_subactionsÚAttributeErrorr[r\)r'r~Úget_subactionsr.r.r/rzxs   z'HelpFormatter._iter_indented_subactionscCs&|j d|¡ ¡}ddl}| ||¡S)NrŒr)rQr‡rˆÚtextwrapÚwrap)r'rprVrôr.r.r/r΂szHelpFormatter._split_linescCs,|j d|¡ ¡}ddl}|j||||d�S)NrŒr)Úinitial_indentÚsubsequent_indent)rQr‡rˆrôÚfill)r'rprVr�rôr.r.r/r̉s þzHelpFormatter._fill_textcCs|jSr1)rx©r'r~r.r.r/rî�szHelpFormatter._get_help_stringcCs |j ¡Sr1)ÚdestÚupperrùr.r.r/r¾“sz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr1)rúrùr.r.r/rº–sz1HelpFormatter._get_default_metavar_for_positional)r<r=N)N) r r6r7r8rWr[r\ÚobjectrKrkrmrnrqrwr„r…rjrgrrr™ror}ryrØr»rÍrzrÎrÌrîr¾rºr.r.r.r/ršs>ü  `j0  rc@seZdZdZdd„ZdS)rzÙHelp 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. cs d ‡fdd„|jdd�Dƒ¡S)Nrec3s|]}ˆ|VqdSr1r.)r`r‘©r�r.r/Ú ¢rdz9RawDescriptionHelpFormatter._fill_text..T)Úkeepends)r&Ú splitlines)r'rprVr�r.rýr/rÌ¡sz&RawDescriptionHelpFormatter._fill_textN)r r6r7r8rÌr.r.r.r/ršsrc@seZdZdZdd„ZdS)r zÖHelp 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. cCs| ¡Sr1)r)r'rprVr.r.r/rάsz!RawTextHelpFormatter._split_linesN)r r6r7r8rÎr.r.r.r/r ¥sr c@seZdZdZdd„ZdS)rz×Help 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. cCs>|j}d|jvr:|jtur:ttg}|js2|j|vr:|d7}|S)Nz %(default)ú (default: %(default)s))rxrÆrrrr˜r¼)r'r~rxÚdefaulting_nargsr.r.r/rî·s  z.ArgumentDefaultsHelpFormatter._get_help_stringN)r r6r7r8rîr.r.r.r/r°src@s eZdZdZdd„Zdd„ZdS)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. cCs|jjSr1©rr rùr.r.r/r¾Ész:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSr1rrùr.r.r/rºÌsz.r.©r'Únamesr.r5r/r$Js zAction._get_kwargscCs |jdSr9©r˜r5r.r.r/r½YszAction.format_usagecCsttdƒƒ‚dS)Nz.__call__() not defined)ÚNotImplementedErrorr–©r'ÚparserÚ namespaceÚvaluesrÇr.r.r/Ú__call__\szAction.__call__)NNNNNFNN)N)r r6r7r8rWr$r½rr.r.r.r/r s5ö r cs0eZdZd ‡fdd„ Zd dd„Zdd„Z‡ZS) rNFc s~g} |D]2} |  | ¡|  d¡rd| dd…} |  | ¡q|dur\|dur\|tur\|d7}tƒj| |d||||||d� dS)Nú--ú--no-r<rr) r˜rúr¼rÆrrãrµrxrÙ)r"Ú startswithrÚsuperrW) r'r˜rúrÆrrãrµrxrÙÚ_option_stringsrÇ©Ú __class__r.r/rW`s&    ÷zBooleanOptionalAction.__init__cCs$||jvr t||j| d¡ ƒdS)Nr)r˜Úsetattrrúrrr.r.r/r€s zBooleanOptionalAction.__call__cCs d |j¡S)Nz | )r&r˜r5r.r.r/r½„sz"BooleanOptionalAction.format_usage)NNNFNN)N)r r6r7rWrr½Ú __classcell__r.r.r r/r_sø rcs(eZdZd‡fdd„ Zddd„Z‡ZS) Ú _StoreActionNFc sT|dkrtdƒ‚|dur,|tkr,tdtƒ‚tt|ƒj||||||||| | d� dS)Nrz…nargs 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 constr )r²rrr$rWrr r.r/rWŠs   öz_StoreAction.__init__cCst||j|ƒdSr1)r"rúrr.r.r/r§sz_StoreAction.__call__)NNNNNFNN)N©r r6r7rWrr#r.r.r r/r$ˆsör$cs(eZdZd‡fdd„ Zddd„Z‡ZS) Ú_StoreConstActionNFc s"tt|ƒj||d||||d�dS)Nr)r˜rúr¼r rÆrµrx)rr'rW©r'r˜rúr rÆrµrxrÙr r.r/rW­s ùz_StoreConstAction.__init__cCst||j|jƒdSr1)r"rúr rr.r.r/r¾sz_StoreConstAction.__call__)NFNN)Nr&r.r.r r/r'«s ùr'cseZdZd‡fdd„ Z‡ZS)Ú_StoreTrueActionFNcs tt|ƒj||d|||d�dS)NT©r˜rúr rÆrµrx)rr)rW©r'r˜rúrÆrµrxr r.r/rWÄs úz_StoreTrueAction.__init__)FFN©r r6r7rWr#r.r.r r/r)Âsûr)cseZdZd‡fdd„ Z‡ZS)Ú_StoreFalseActionTFNcs tt|ƒj||d|||d�dS)NFr*)rr-rWr+r r.r/rWÕs úz_StoreFalseAction.__init__)TFNr,r.r.r r/r-Ósûr-cs(eZdZd‡fdd„ Zddd„Z‡ZS) Ú _AppendActionNFc sT|dkrtdƒ‚|dur,|tkr,tdtƒ‚tt|ƒj||||||||| | d� dS)NrzŒnargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater%r )r²rrr.rWrr r.r/rWæs   öz_AppendAction.__init__cCs2t||jdƒ}t|ƒ}| |¡t||j|ƒdSr1)rrúr;r"r"©r'rrrrÇr4r.r.r/rs z_AppendAction.__call__)NNNNNFNN)Nr&r.r.r r/r.äsör.cs(eZdZd‡fdd„ Zddd„Z‡ZS) Ú_AppendConstActionNFc s$tt|ƒj||d|||||d�dS)Nr)r˜rúr¼r rÆrµrxrÙ)rr0rWr(r r.r/rW s øz_AppendConstAction.__init__cCs4t||jdƒ}t|ƒ}| |j¡t||j|ƒdSr1)rrúr;r"r r"r/r.r.r/rs z_AppendConstAction.__call__)NFNN)Nr&r.r.r r/r0 s ùr0cs(eZdZd‡fdd„ Zddd„Z‡ZS) Ú _CountActionNFcs tt|ƒj||d|||d�dS)Nr)r˜rúr¼rÆrµrx)rr1rWr+r r.r/rW's úz_CountAction.__init__cCs0t||jdƒ}|durd}t||j|dƒdS©NrrY)rrúr")r'rrrrÇÚcountr.r.r/r5sz_CountAction.__call__)NFN)Nr&r.r.r r/r1%s ûr1cs.eZdZeedf‡fdd„ Zddd„Z‡ZS)Ú _HelpActionNcstt|ƒj|||d|d�dS©Nr)r˜rúrÆr¼rx)rr4rW)r'r˜rúrÆrxr r.r/rW>s ûz_HelpAction.__init__cCs| ¡| ¡dSr1)Ú print_helpÚexitrr.r.r/rJsz_HelpAction.__call__)N©r r6r7rrWrr#r.r.r r/r4<s ü r4cs0eZdZdeedf‡fdd„ Zddd„Z‡ZS)Ú_VersionActionNz&show program's version number and exitcs$tt|ƒj|||d|d�||_dSr5)rr9rWÚversion)r'r˜r:rúrÆrxr r.r/rWQs ûz_VersionAction.__init__cCsD|j}|dur|j}| ¡}| |¡| | ¡tj¡| ¡dSr1)r:Ú_get_formatterrqÚ_print_messagerjÚ_sysÚstdoutr7)r'rrrrÇr:r]r.r.r/r_s z_VersionAction.__call__)Nr8r.r.r r/r9Os ûr9csPeZdZGdd„deƒZedddf‡fdd„ Zdd„Zd d „Zd d d „Z ‡Z S)Ú_SubParsersActioncseZdZ‡fdd„Z‡ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd |¡7}ttj|ƒ}|jg|||d�dS)Nr¯r)r˜rúrxrÙ)r&rr?Ú_ChoicesPseudoActionrW)r'r,ÚaliasesrxrÙrúÚsupr r.r/rWms  ÿz/_SubParsersAction._ChoicesPseudoAction.__init__r,r.r.r r/r@ksr@FNc s<||_||_i|_g|_tt|ƒj||t|j|||d�dS)N)r˜rúr¼rãrµrxrÙ)Ú _prog_prefixÚ _parser_classÚ_name_parser_mapÚ_choices_actionsrr?rWr)r'r˜rSÚ parser_classrúrµrxrÙr r.r/rWus  ùz_SubParsersAction.__init__cKsŠ| d¡dur d|j|f|d<| dd¡}d|vrX| d¡}| |||¡}|j |¡|jfi|¤Ž}||j|<|D]}||j|<qv|S)NrSr«rAr.rx)r¸rCr¹r@rFr"rDrE)r'r,ÚkwargsrArxÚ choice_actionrÚaliasr.r.r/Ú add_parserŒs     z_SubParsersAction.add_parsercCs|jSr1)rFr5r.r.r/rñ£sz!_SubParsersAction._get_subactionsc CsÐ|d}|dd…}|jtur,t||j|ƒz|j|}Wn:tyt|d |j¡dœ}tdƒ|}t||ƒ‚Yn0| |d¡\} }t | ƒ  ¡D]\} } t|| | ƒq’|rÌt |ƒ  t g¡t |t ƒ |¡dS)NrrYr)Ú parser_namerãz5unknown parser %(parser_name)r (choices: %(choices)s))rúrr"rEÚKeyErrorr&r–rÚparse_known_argsrìr4Ú setdefaultÚ_UNRECOGNIZED_ARGS_ATTRrr›) r'rrrrÇrLr)rbÚmsgÚ subnamespaceÚkeyr-r.r.r/r¦s$    ÿ  z_SubParsersAction.__call__)N) r r6r7r r@rrWrKrñrr#r.r.r r/r?isùr?c@seZdZddd„ZdS)Ú _ExtendActionNcCs2t||jdƒ}t|ƒ}| |¡t||j|ƒdSr1)rrúr;r›r"r/r.r.r/rÇs z_ExtendAction.__call__)N)r r6r7rr.r.r.r/rTÆsrTc@s*eZdZdZd dd„Zdd„Zd d „ZdS) raÆ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. ÚrrªNcCs||_||_||_||_dSr1)Ú_modeÚ_bufsizeÚ _encodingÚ_errors)r'ÚmodeÚbufsizeÚencodingÚerrorsr.r.r/rWâszFileType.__init__c sÐ|dkrndˆjvr*dˆjvr$tjjStjSt‡fdd„dDƒƒrXdˆjvrRtjjStjStdƒˆj}t|ƒ‚zt|ˆjˆj ˆj ˆj ƒWSt yÊ}z*||dœ}td ƒ}t ||ƒ‚WYd}~n d}~00dS) Nú-rUÚbc3s|]}|ˆjvVqdSr1)rVrêr5r.r/rþírdz$FileType.__call__..Úwaxzargument "-" with mode %r)ÚfilenameÚerrorz$can't open '%(filename)s': %(error)s)rVr=ÚstdinÚbufferÚanyr>r–r²rÉrWrXrYÚOSErrorr)r'ÚstringrQÚerbr r.r5r/rès ÿ zFileType.__call__cCsT|j|jf}d|jfd|jfg}d dd„|Dƒdd„|Dƒ¡}dt|ƒj|fS)Nr\r]rcSsg|]}|dkrt|ƒ‘qS)rª)r#)r`r+r.r.r/rcÿrdz%FileType.__repr__..cSs$g|]\}}|durd||f‘qS)Nrr.)r`Úkwr+r.r.r/rcs ÿr)rVrWrXrYr&rr )r'rbrHÚargs_strr.r.r/r0üs   ÿzFileType.__repr__)rUrªNN)r r6r7r8rWrr0r.r.r.r/rÑs rc@s(eZdZdZdd„Zdd„Zdd„ZdS) r z“Simple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. cKs|D]}t||||ƒqdSr1)r")r'rHr,r.r.r/rWszNamespace.__init__cCst|tƒstSt|ƒt|ƒkSr1)rÞr ÚNotImplementedrì)r'Úotherr.r.r/Ú__eq__s zNamespace.__eq__cCs ||jvSr1)r3)r'rSr.r.r/Ú __contains__szNamespace.__contains__N)r r6r7r8rWrmrnr.r.r.r/r sr cs¨eZdZ‡fdd„Zdd„Zd&dd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zd'dd„Zdd„Zd d!„Zd"d#„Zd$d%„Z‡ZS)(Ú_ActionsContainercstt|ƒ ¡||_||_||_||_i|_| ddt ¡| ddt ¡| ddt ¡| ddt ¡| ddt ¡| ddt ¡| ddt¡| ddt¡| dd t¡| dd t¡| dd t¡| dd t¡| ¡g|_i|_g|_g|_i|_t d ¡|_g|_dS)Nr~ÚstoreÚ store_constÚ store_trueÚ store_falser"Ú append_constr3rxr:Úparsersr›z^-\d+$|^-\d*\.\d+$)rrorWÚ descriptionÚargument_defaultÚ prefix_charsÚconflict_handlerÚ _registriesÚregisterr$r'r)r-r.r0r1r4r9r?rTÚ _get_handlerÚ_actionsÚ_option_string_actionsÚ_action_groupsÚ_mutually_exclusive_groupsÚ _defaultsrNrOÚ_negative_number_matcherÚ_has_negative_number_optionals)r'rvrxrwryr r.r/rWs4 z_ActionsContainer.__init__cCs|j |i¡}|||<dSr1)rzrO)r'Ú registry_namer-rüÚregistryr.r.r/r{Ssz_ActionsContainer.registerNcCs|j| ||¡Sr1)rzr¸)r'r„r-rÆr.r.r/Ú _registry_getWsz_ActionsContainer._registry_getcKs2|j |¡|jD]}|j|vr||j|_qdSr1)r�Úupdater}rúrÆ)r'rHr~r.r.r/Ú set_defaults]s   z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdur|jSq|j |d¡Sr1)r}rúrÆr�r¸)r'rúr~r.r.r/Ú get_defaultfs  z_ActionsContainer.get_defaultcOsP|j}|r&t|ƒdkrL|dd|vrL|r:d|vr:tdƒ‚|j|i|¤Ž}n|j|i|¤Ž}d|vrš|d}||jvr†|j||d<n|jdurš|j|d<| |¡}t|ƒsºtd|fƒ‚|fi|¤Ž}|  d|j |j ¡}t|ƒsðtd |fƒ‚|t u�rtd |fƒ‚t |d ƒ�rFz|  ¡ |d¡Wnt�yDtd ƒ‚Yn0| |¡S) zƒ add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...) rYrrúz+dest supplied twice for positional argumentrÆNzunknown action "%s"rú%r is not callablez<%r is a FileType class object, instance of it must be passedr;z,length of metavar tuple does not match nargs)rxr|r²Ú_get_positional_kwargsÚ_get_optional_kwargsr�rwÚ_pop_action_classÚcallabler†rrrír;r»rçÚ _add_action)r'rbrHÚcharsrúÚ action_classr~Ú type_funcr.r.r/r„ps:        ÿ z_ActionsContainer.add_argumentcOs&t|g|¢Ri|¤Ž}|j |¡|Sr1)Ú_ArgumentGrouprr")r'rbrHrÂr.r.r/Úadd_argument_group£s z$_ActionsContainer.add_argument_groupcKs t|fi|¤Ž}|j |¡|Sr1)Ú_MutuallyExclusiveGroupr€r")r'rHrÂr.r.r/Úadd_mutually_exclusive_group¨s z._ActionsContainer.add_mutually_exclusive_groupcCs`| |¡|j |¡||_|jD]}||j|<q"|jD]"}|j |¡r8|js8|j d¡q8|S)NT) Ú_check_conflictr}r"Ú containerr˜r~r‚Úmatchrƒ)r'r~rÇr.r.r/r�­s      z_ActionsContainer._add_actioncCs|j |¡dSr1)r}Úremoverùr.r.r/Ú_remove_actionÂsz _ActionsContainer._remove_actioncCsÚi}|jD].}|j|vr.tdƒ}t||jƒ‚|||j<q i}|jD]D}|j|vrn|j|j|j|jd�||j<|jD]}||j||<qtqD|jD]&}|j |j d�}|jD] }|||<q¨q�|j D]}|  ||¡  |¡q¾dS)Nz.cannot merge actions - two groups are named %r)Útitlervry)rµ)rrœr–r²r”rvryr±r€r–rµr}r¸r�)r'r˜Útitle_group_maprÂrQÚ group_mapr~Ú mutex_groupr.r.r/Ú_add_container_actionsÅs0     ý   ÿ   z(_ActionsContainer._add_container_actionscKs^d|vrtdƒ}t|ƒ‚| d¡ttfvr2d|d<| d¡tkrPd|vrPd|d<t||gd�S)Nrµz1'required' is an invalid argument for positionalsr¼TrÆ©rúr˜)r–rçr¸rrr—)r'rúrHrQr.r.r/r‹ísz(_ActionsContainer._get_positional_kwargsc OsÖg}g}|D]`}|d|jvr>||jdœ}tdƒ}t||ƒ‚| |¡t|ƒdkr |d|jvr | |¡q | dd¡}|durÈ|r�|d}n|d}| |j¡}|s¼tdƒ}t||ƒ‚| dd¡}t|||d �S) Nr)ÚoptionrxzNinvalid option string %(option)r: must start with a character %(prefix_chars)rrYrúz%dest= is required for options like %rr^r–r¡) rxr–r²r"r|r¹ÚlstripÚreplacer—) r'rbrHr˜Úlong_option_stringsrÇrQrúÚdest_option_stringr.r.r/rŒýs.ÿ        z&_ActionsContainer._get_optional_kwargscCs| d|¡}| d||¡S)Nr~)r¹r†)r'rHrÆr~r.r.r/r�s z#_ActionsContainer._pop_action_classcCsDd|j}z t||ƒWSty>tdƒ}t||jƒ‚Yn0dS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)ryrròr–r²)r'Úhandler_func_namerQr.r.r/r|#s    z_ActionsContainer._get_handlercCsLg}|jD]&}||jvr |j|}| ||f¡q |rH| ¡}|||ƒdSr1)r˜r~r"r|)r'r~Úconfl_optionalsrÇÚconfl_optionalryr.r.r/r—,s   z!_ActionsContainer._check_conflictcCs6tddt|ƒƒ}d dd„|Dƒ¡}t|||ƒ‚dS)Nzconflicting option string: %szconflicting option strings: %srcSsg|] \}}|‘qSr.r.)r`rÇr~r.r.r/rc>sÿz<_ActionsContainer._handle_conflict_error..)rr|r&r)r'r~Úconflicting_actionsr Úconflict_stringr.r.r/Ú_handle_conflict_error:sþ þz(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j |¡|j |d¡|js|j |¡qdSr1)r˜ršr~r¹r˜r›)r'r~rªrÇr.r.r/Ú_handle_conflict_resolveCs   z*_ActionsContainer._handle_conflict_resolve)N)N)r r6r7rWr{r†rˆr‰r„r”r–r�r›r r‹rŒr�r|r—r¬r­r#r.r.r r/ros$ 5   3("   rocs6eZdZd‡fdd„ Z‡fdd„Z‡fdd„Z‡ZS) r“Nc sˆ|j}|d|jƒ|d|jƒ|d|jƒtt|ƒj}|fd|i|¤Ž||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ |j|_dS)Nryrxrwrv)rOryrxrwrr“rWrœr±rzr}r~r�rƒr€)r'r˜rœrvrHr‡Ú super_initr r.r/rWTs    ÿz_ArgumentGroup.__init__cs tt|ƒ |¡}|j |¡|Sr1)rr“r�r±r"rùr r.r/r�js z_ArgumentGroup._add_actioncs tt|ƒ |¡|j |¡dSr1)rr“r›r±ršrùr r.r/r›osz_ArgumentGroup._remove_action)NN©r r6r7rWr�r›r#r.r.r r/r“Rs r“cs.eZdZd‡fdd„ Zdd„Zdd„Z‡ZS) r•Fcs tt|ƒ |¡||_||_dSr1)rr•rWrµÚ _container)r'r˜rµr r.r/rWvsz _MutuallyExclusiveGroup.__init__cCs2|jrtdƒ}t|ƒ‚|j |¡}|j |¡|S)Nz-mutually exclusive arguments must be optional)rµr–r²r°r�r±r")r'r~rQr.r.r/r�{s   z#_MutuallyExclusiveGroup._add_actioncCs|j |¡|j |¡dSr1)r°r›r±ršrùr.r.r/r›ƒs z&_MutuallyExclusiveGroup._remove_action)Fr¯r.r.r r/r•tsr•c s,eZdZdZddddgedddddddf ‡fdd„ Zdd „Zd d „Zd d „Zdd„Z dd„Z dAdd„Z dBdd„Z dd„Z dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„ZdCd&d'„ZdDd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„ZdEd6d7„ZdFd8d9„ZdGd:d;„ZdHd=d>„Z d?d@„Z!‡Z"S)Ira)Object for parsing command line strings into Python objects. Keyword Arguments: - prog -- The name of the program (default: 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^rbTc s&tt|ƒj}|||| | d�|dur6tj tjd¡}||_||_ ||_ ||_ ||_ | |_ | |_| |_|j}|tdƒƒ|_|tdƒƒ|_d|_dd„}| dd|¡d|vr°dn|d}|j râ|j|d |d d d ttd ƒd �|D]:}| |¡z |j}Wnt�yYqæ0|j |¡qædS)N)rvrxrwryrzpositional argumentszoptional argumentscSs|Sr1r.)rgr.r.r/ÚidentityÅsz)ArgumentParser.__init__..identityrr^Úhr<rxzshow this help message and exit)r~rÆrx)rrrWÚ_osÚpathÚbasenamer=ÚargvrSrsÚepilogÚformatter_classÚfromfile_prefix_charsÚadd_helpÚ allow_abbrevÚ exit_on_errorr”r–Ú _positionalsÚ _optionalsÚ _subparsersr{r„rr r�ròr‡)r'rSrsrvr·Úparentsr¸rxr¹rwryrºr»r¼Ú superinitÚ add_groupr±Údefault_prefixr^Údefaultsr r.r/rW�sH ýý  zArgumentParser.__init__csgd¢}‡fdd„|DƒS)N)rSrsrvr¸ryrºcsg|]}|tˆ|ƒf‘qSr.rrr5r.r/rcèrdz.ArgumentParser._get_kwargs..r.rr.r5r/r$ßszArgumentParser._get_kwargsc Ksä|jdur| tdƒ¡| dt|ƒ¡d|vs8d|vrht| dd¡ƒ}t| dd¡ƒ}| ||¡|_n|j|_| d¡dur¶|  ¡}|  ¡}|j }|  |j ||d¡| ¡ ¡|d<| |d¡}|fd gi|¤Ž}|j |¡|S) Nz(cannot have multiple subparser argumentsrGrœrvÚ subcommandsrSrerur˜)r¿rbr–rOrr¹r”r½r¸r;Ú_get_positional_actionsr€rwrsrjrˆr�r�) r'rHrœrvr]r�ruÚ parsers_classr~r.r.r/Úadd_subparsersís$   zArgumentParser.add_subparserscCs$|jr|j |¡n |j |¡|Sr1)r˜r¾r�r½rùr.r.r/r� s zArgumentParser._add_actioncCsdd„|jDƒS)NcSsg|]}|jr|‘qSr.r©r`r~r.r.r/rcsþz8ArgumentParser._get_optional_actions..©r}r5r.r.r/Ú_get_optional_actionssÿz$ArgumentParser._get_optional_actionscCsdd„|jDƒS)NcSsg|]}|js|‘qSr.rrÉr.r.r/rcsþz:ArgumentParser._get_positional_actions..rÊr5r.r.r/rÆsÿz&ArgumentParser._get_positional_actionscCs4| ||¡\}}|r0tdƒ}| |d |¡¡|S©Nzunrecognized arguments: %srŒ)rNr–rbr&©r'rbrr¶rQr.r.r/Ú parse_args s zArgumentParser.parse_argscCs|durtjdd…}nt|ƒ}|dur.tƒ}|jD]4}|jtur4t||jƒs4|jtur4t ||j|jƒq4|j D] }t||ƒspt |||j |ƒqp|j rÜz|  ||¡\}}Wqìt yØt ¡d}| t|ƒ¡Yqì0n|  ||¡\}}t|tƒ�r| t|tƒ¡t|tƒ||fSrX)r=r¶r2r r}rúrrírÆr"r�r¼Ú_parse_known_argsrÚexc_inforbrÛrPr›rÚdelattr)r'rbrr~rúÚerrr.r.r/rN's0          zArgumentParser.parse_known_argscsˆ jdurˆ  ˆ¡‰i‰ˆ jD]R}|j}t|jƒD]<\}}ˆ |g¡}| |d|…¡| ||dd…¡q2qi‰g}tˆƒ} t| ƒD]^\}} | dkrº| d¡| D]} | d¡q¨qŠˆ   | ¡} | durÒd} n | ˆ|<d} | | ¡qŠd  |¡‰t ƒ‰t ƒ‰d‡‡‡‡‡ fdd„ ‰ ‡‡‡‡‡ ‡ fd d „} ˆ   ¡‰‡‡‡‡ ‡ fd d „}g‰d ‰ ˆ�r`t ˆƒ}nd}ˆ |k�rÞt‡ fdd„ˆDƒƒ}ˆ |k�r®|ˆ ƒ}|ˆ k�rª|‰ �qdn|‰ ˆ ˆv�rÒˆˆ |…}ˆ |¡|‰ | ˆ ƒ‰ �qd|ˆ ƒ}ˆ ˆ|d…¡g}ˆ jD]|}|ˆv�r|j�r(| t|ƒ¡nT|jdu�rt|jtƒ�rtˆ|jƒ�r|jtˆ|jƒu�rtˆ|jˆ  ||j¡ƒ�q|�ržˆ  tdƒd  |¡¡ˆ jD]X}|j�r¤|jD]}|ˆv�r¶�q¤�q¶dd„|jDƒ}tdƒ}ˆ  |d  |¡¡�q¤ˆˆfS)NrYrr^ÚAÚOrecs|ˆ |¡ˆ ||¡}||jurbˆ |¡ˆ |g¡D]*}|ˆvr6tdƒ}t|ƒ}t|||ƒ‚q6|turx|ˆˆ||ƒdS)Nznot allowed with argument %s)r´Ú _get_valuesrÆr¸r–rrr)r~Úargument_stringsrÇÚargument_valuesÚconflict_actionrQÚ action_name)Úaction_conflictsrÚ seen_actionsÚseen_non_default_actionsr'r.r/Ú take_action}s    z5ArgumentParser._parse_known_args..take_actioncs~ˆ|}|\}}}ˆj}g}|dur:ˆ ˆ|¡|dS|du�r||dƒ}ˆj}|dkrÐ|d|vrÐ| |g|f¡|d} | |d}|dd…pšd} ˆj} || vr¸| |}| }ntdƒ} t|| |ƒ‚nB|dkrü|d} |g}| |||f¡�q\ntdƒ} t|| |ƒ‚q|d}ˆ|d…}|||ƒ}||} ˆ|| …}| |||f¡�q\q|D]\}}}ˆ|||ƒ�q`| S)NrYrÓrzignored explicit argument %r)Ú_match_argumentr"rxr~r–r)Ú start_indexÚ option_tupler~rÇÚ explicit_argÚmatch_argumentÚ action_tuplesÚ arg_countr�ÚcharÚnew_explicit_argÚ optionals_maprQÚstoprbrÃÚselected_patterns)r)Úarg_strings_patternÚextrasÚoption_string_indicesr'rÝr.r/Úconsume_optional’sL       z:ArgumentParser._parse_known_args..consume_optionalcsnˆj}ˆ|d…}|ˆ|ƒ}tˆ|ƒD]*\}}ˆ|||…}||7}ˆ||ƒq&ˆt|ƒd…ˆdd…<|Sr1)Ú_match_arguments_partialÚzipr|)rßÚ match_partialÚselected_patternÚ arg_countsr~rärb)r)rêr�r'rÝr.r/Úconsume_positionalsßs   z=ArgumentParser._parse_known_args..consume_positionalsrrªcsg|]}|ˆkr|‘qSr.r.)r`r³)rßr.r/rcüsþz4ArgumentParser._parse_known_args..z(the following arguments are required: %srcSsg|]}|jturt|ƒ‘qSr.)rxrrrÉr.r.r/rc;s þz#one of the arguments %s is requiredrŒ)N)r¹Ú_read_args_from_filesr€r±r·rOr›Úiterr"Ú_parse_optionalr&r°rÆrErDr}rµrrÆrÞrÛrírúrr"Ú _get_valuerbr–)r'r)rrŸrÀrÅÚ mutex_actionÚ conflictsÚarg_string_pattern_partsÚarg_strings_iterÚ arg_stringràÚpatternríróÚmax_option_string_indexÚnext_option_string_indexÚpositionals_end_indexÚstringsÚ stop_indexÚrequired_actionsr~rÂrrQr.) rÚr)rêrërrìr�rÛrÜr'rßrÝr/rÏNs¤        J   þ          ÿ þý ÿ ÿ    ÿz ArgumentParser._parse_known_argsc CsÖg}|D]È}|r|d|jvr*| |¡qzxt|dd…ƒ�T}g}| ¡ ¡D]}| |¡D]}| |¡q\qN| |¡}| |¡Wdƒn1s–0YWqtyÎt   ¡d}|  t |ƒ¡Yq0q|Sr2) r¹r"rÉÚreadrÚconvert_arg_line_to_argsrôr›rfr=rÐrbrÛ)r'r)Únew_arg_stringsrüÚ args_fileÚarg_liner+rÒr.r.r/rôDs   ,  z$ArgumentParser._read_args_from_filescCs|gSr1r.)r'rr.r.r/r^sz'ArgumentParser.convert_arg_line_to_argscCsz| |¡}t ||¡}|durldtdƒttdƒttdƒi}| |j¡}|durbtdd|jƒ|j}t ||ƒ‚t |  d¡ƒS)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsrY) Ú_get_nargs_patternrNr™r–rr r¸r¼rrr|rÂ)r'r~rêÚ nargs_patternr™Ú nargs_errorsrQr.r.r/rÞas"  ý þþ zArgumentParser._match_argumentcsrg}tt|ƒddƒD]X}|d|…}d ‡fdd„|Dƒ¡}t ||¡}|dur| dd„| ¡Dƒ¡qnq|S)Nrrªrecsg|]}ˆ |¡‘qSr.)r rÉr5r.r/rc}sÿz;ArgumentParser._match_arguments_partial..cSsg|] }t|ƒ‘qSr.)r|)r`rgr.r.r/rc�rd)r¶r|r&rNr™r›ru)r'rtrêrârÅÚ actions_slicerýr™r.r5r/rîws ÿ z'ArgumentParser._match_arguments_partialc Cs|sdS|d|jvrdS||jvr8|j|}||dfSt|ƒdkrHdSd|vr~| dd¡\}}||jvr~|j|}|||fS| |¡}t|ƒdkrÊd dd„|Dƒ¡}||dœ}tdƒ}| ||¡nt|ƒdkrà|\} | S|j  |¡rö|j södSd |v�rdSd|dfS) NrrYú=rcSsg|]\}}}|‘qSr.r.)r`r~rÇrár.r.r/rc¦sÿz2ArgumentParser._parse_optional..)r¢Úmatchesz4ambiguous option: %(option)s could match %(matches)srŒ) rxr~r|ÚsplitÚ_get_option_tuplesr&r–rbr‚r™rƒ) r'rür~rÇráÚ option_tuplesÚoptionsrbrQràr.r.r/rö‡s>          ÿ    zArgumentParser._parse_optionalc Cs0g}|j}|d|vr€|d|vr€|jr~d|vrB| dd¡\}}n|}d}|jD],}| |¡rP|j|}|||f}| |¡qPn¬|d|v�r|d|v�r|}d}|dd…}|dd…} |jD]T}||krî|j|}||| f}| |¡qÂ| |¡rÂ|j|}|||f}| |¡qÂn| tdƒ|¡|S)NrrYr r<zunexpected option string: %s)rxr»rr~rr"rbr–) r'rÇrâr�Ú option_prefixrár~rÔÚshort_option_prefixÚshort_explicit_argr.r.r/rÁs:             z!ArgumentParser._get_option_tuplescCsœ|j}|durd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd  d |¡}|jr˜|  d d ¡}|  d d ¡}|S) Nz(-*A-*)z(-*A?-*)z (-*[A-]*)z (-*A[A-]*)z([-AO]*)z (-*A[-AO]*)z(-*-*)z(-*%s-*)z-*rÓrer^) r¼rrr rrrr&r˜r¤)r'r~r¼r r.r.r/r îs(  z!ArgumentParser._get_nargs_patterncCs4| ||¡\}}|r0tdƒ}| |d |¡¡|SrÌ)Úparse_known_intermixed_argsr–rbr&rÍr.r.r/Úparse_intermixed_args s z$ArgumentParser.parse_intermixed_argsc sö| ¡‰dd„ˆDƒ}|r,td|djƒ‚‡fdd„|jDƒrHtdƒ‚�zš|j}zÀ|jdurp| ¡dd…|_ˆD] }|j|_t|_|j|_ t|_qt|  ||¡\}}ˆD]J}t ||j ƒrªt ||j ƒgkrªddlm}|d |j |fƒt||j ƒqªWˆD]}|j|_|j |_qünˆD]}|j|_|j |_�q0| ¡}zt|D]}|j|_d |_�q@|jD]} | j| _d | _�q\|  ||¡\}} W|D]}|j|_�qˆ|jD]} | j| _�qžn,|D]}|j|_�q´|jD]} | j| _�qÊ0W||_n||_0|| fS) NcSsg|]}|jttfvr|‘qSr.)r¼rrrÉr.r.r/rc4 sÿz>ArgumentParser.parse_known_intermixed_args..z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|ˆvr|j‘qqSr.)r±rú)r`rÂr~©r�r.r/rc: sÿz;parse_intermixed_args: positional in mutuallyExclusiveGroupé)ÚwarnzDo not expect %s in %sF)rÆrçr¼r€rsr½Ú save_nargsrrÆÚ save_defaultrNrírúrÚwarningsrrÑrËrµÚ save_required) r'rbrÚaÚ save_usager~Úremaining_argsrrœrÂrër.rr/r& sn ÿ ÿ ÿ  þ   ÿ   ý  z*ArgumentParser.parse_known_intermixed_argscs€ˆjttfvr0z| d¡Wnty.Yn0|sxˆjtkrxˆjrLˆj}nˆj}t |t ƒrtˆ  ˆ|¡}ˆ  ˆ|¡�n|s°ˆjt kr°ˆjs°ˆjduržˆj}n|}ˆ  ˆ|¡nÌt|ƒdkrêˆjdtfvrê|\}ˆ  ˆ|¡}ˆ  ˆ|¡n’ˆjtk�r ‡‡fdd„|Dƒ}npˆjtk�r>‡‡fdd„|Dƒ}ˆ  ˆ|d¡n>ˆjtk�rPt}n,‡‡fdd„|Dƒ}|D]}ˆ  ˆ|¡�qh|S)NrrYcsg|]}ˆ ˆ|¡‘qSr.©r÷©r`Úv©r~r'r.r/rc— rdz.ArgumentParser._get_values..csg|]}ˆ ˆ|¡‘qSr.r"r#r%r.r/rc› rdrcsg|]}ˆ ˆ|¡‘qSr.r"r#r%r.r/rc¤ rd)r¼rrršr²rr˜r rÆrÞrÛr÷Ú _check_valuerr|r)r'r~r)r-rür$r.r%r/rÕs sD   ÿ     zArgumentParser._get_valuesc CsÊ| d|j|j¡}t|ƒs0tdƒ}t|||ƒ‚z ||ƒ}Wnˆty|t|jdt|jƒƒ}tt   ¡dƒ}t||ƒ‚YnJt t fyÄt|jdt|jƒƒ}||dœ}tdƒ}t|||ƒ‚Yn0|S)NrrŠr rY)rr-z!invalid %(type)s value: %(value)r) r†rrŽr–rrrr#rÛr=rÐrçr²)r'r~rür’rQrâr,rbr.r.r/r÷« s    zArgumentParser._get_valuecCsF|jdurB||jvrB|d tt|jƒ¡dœ}tdƒ}t|||ƒ‚dS)Nr)r-rãz3invalid choice: %(value)r (choose from %(choices)s))rãr&r{r#r–r)r'r~r-rbrQr.r.r/r&Å s ÿzArgumentParser._check_valuecCs$| ¡}| |j|j|j¡| ¡Sr1)r;rwrsr}r€rj)r'r]r.r.r/r½Ð s  ÿzArgumentParser.format_usagecCst| ¡}| |j|j|j¡| |j¡|jD]0}| |j ¡| |j¡|  |j ¡|  ¡q.| |j ¡| ¡Sr1)r;rwrsr}r€rqrvrrmrœr…r±rnr·rj)r'r]Ú action_groupr.r.r/rjÖ s ÿ       zArgumentParser.format_helpcCs|j|jd�S)Nr‹)r¸rSr5r.r.r/r;í szArgumentParser._get_formattercCs"|durtj}| | ¡|¡dSr1)r=r>r<r½©r'Úfiler.r.r/Ú print_usageó szArgumentParser.print_usagecCs"|durtj}| | ¡|¡dSr1)r=r>r<rjr(r.r.r/r6ø szArgumentParser.print_helpcCs |r|durtj}| |¡dSr1)r=ÚstderrÚwrite)r'r r)r.r.r/r<ý szArgumentParser._print_messagercCs |r| |tj¡t |¡dSr1)r<r=r+r7)r'Ústatusr r.r.r/r7 szArgumentParser.exitcCs0| tj¡|j|dœ}| dtdƒ|¡dS)zðerror(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. )rSr r<z%(prog)s: error: %(message)s N)r*r=r+rSr7r–)r'r rbr.r.r/rb s  zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)#r r6r7r8rrWr$rÈr�rËrÆrÎrNrÏrôrrÞrîrörr rrrÕr÷r&r½rjr;r*r6r<r7rbr#r.r.r r/rˆsXóB  'w:-1  M8    r)2r8Ú __version__Ú__all__Úosr³ÚrerNÚsysr=rr–rrrrr rrrPrürr;rrr rr rÚ Exceptionrrr rr$r'r)r-r.r0r1r4r9r?rTrr ror“r•rr.r.r.r/Ús`=   ^)#&] 78"