Mc@s`dZdZdddddddd d d d d ddddgZddlZddlZddlZddl Z ddl Z ddl m ZyeWn!ek rddlmZnXyeWnek reZnXyeWnek redZnXdZdZdZdZdZdZdZdZdefd YZ d!Z!defd"YZ"de"fd#YZ#d e#fd$YZ$de"fd%YZ%d&Z&de'fd'YZ(de'fd(YZ)d e fd)YZ*d*e*fd+YZ+d,e*fd-YZ,d.e,fd/YZ-d0e,fd1YZ.d2e*fd3YZ/d4e*fd5YZ0d6e*fd7YZ1d8e*fd9YZ2d:e*fd;YZ3d<e*fd=YZ4defd>YZ5d e fd?YZ6d@efdAYZ7dBe7fdCYZ8dDe8fdEYZ9de e7fdFYZ:dS(Gs 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.) s1.2.1tArgumentParsert ArgumentErrortArgumentTypeErrortFileTypet HelpFormattertArgumentDefaultsHelpFormattertRawDescriptionHelpFormattertRawTextHelpFormattert NamespacetActiont ONE_OR_MOREtOPTIONALtPARSERt REMAINDERtSUPPRESSt ZERO_OR_MOREiN(tgettext(tSetcCs-t|}|j|r)|jn|S(N(tlisttsorttreverse(titerableRtresult((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytsortedls    cCst|dpt|dS(Nt__call__t __bases__(thasattr(tobj((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt _callabletss ==SUPPRESS==t?t*t+sA...s...t_unrecognized_argst_AttributeHoldercBs)eZdZdZdZdZRS(sAbstract 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__. cCst|j}g}x'|jD]}|jt|q"Wx1|jD]#\}}|jd||fqLWd|dj|fS(Ns%s=%rs%s(%s)s, (ttypet__name__t _get_argstappendtreprt _get_kwargstjoin(tselft type_namet arg_stringstargtnametvalue((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt__repr__scCst|jjS(N(Rt__dict__titems(R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR'scCsgS(N((R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR$s(R#t __module__t__doc__R/R'R$(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR!s cCs8t||ddkr+t|||nt||S(N(tgetattrtNonetsetattr(t namespaceR-R.((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt _ensure_valuescBseZdZddddZdZdZdefdYZdZ d Z d Z d Z dd Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZRS(sFormatter 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. iicCs|dkrPyttjd}Wnttfk rBd}nX|d8}n||_||_||_||_ d|_ d|_ d|_ |j |d|_|j|_tjd|_tjd|_dS(NtCOLUMNSiPiis\s+s\n\n\n+(R5tintt_ostenvirontKeyErrort ValueErrort_progt_indent_incrementt_max_help_positiont_widtht_current_indentt_levelt_action_max_lengtht_Sectiont _root_sectiont_current_sectiont_retcompilet_whitespace_matchert_long_break_matcher(R)tprogtindent_incrementtmax_help_positiontwidth((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt__init__s"           cCs%|j|j7_|jd7_dS(Ni(RCR@RD(R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt_indentscCs%|j|j8_|jd8_dS(Ni(RCR@RD(R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt_dedentsRFcBseZddZdZRS(cCs(||_||_||_g|_dS(N(t formattertparenttheadingR1(R)RTRURV((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs   cCs|jdk r|jjn|jj}x!|jD]\}}||q5W|g|jD]\}}||^q\}|jdk r|jjn|sdS|jtk r|jdk r|jj }d|d|jf}nd}|d||dgS(Nts%*s%s: s ( RUR5RTRRt _join_partsR1RSRVRRC(R)R(tfunctargst item_helptcurrent_indentRV((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt format_helps . N(R#R2R5RQR](((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRFs cCs|jjj||fdS(N(RHR1R%(R)RYRZ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt _add_itemscCsB|j|j||j|}|j|jg||_dS(N(RRRFRHR^R](R)RVtsection((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt start_sections cCs|jj|_|jdS(N(RHRURS(R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt end_sectionscCs5|tk r1|dk r1|j|j|gndS(N(RR5R^t _format_text(R)ttext((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytadd_text scCs8|tk r4||||f}|j|j|ndS(N(RR^t _format_usage(R)tusagetactionstgroupstprefixRZ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt add_usage s cCs|jtk r|j}||g}x*|j|D]}|j||q7Wtg|D]}t|^q^}||j}t|j||_|j |j |gndS(N( thelpRt_format_action_invocationt_iter_indented_subactionsR%tmaxtlenRCRER^t_format_action(R)tactiontget_invocationt invocationst subactiontstinvocation_lengtht action_length((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt add_arguments %   cCs"x|D]}|j|qWdS(N(Rx(R)RgRq((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt add_arguments$s cCsD|jj}|r@|jjd|}|jdd}n|S(Ns s (RGR]RLtsubtstrip(R)Rk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR]+s cCs2djg|D]}|r |tk r |^q S(NRW(R(R(R)t part_stringstpart((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRX2s  cs|dkrtd}n|dk r@|td|j}n|dkrl| rldtd|j}nk|dkrdtd|j}g}g}x4|D],}|jr|j|q|j|qW|j} | |||} djg|| gD]} | r| ^q}|j|j t |t |krd} | ||} | ||}t j | | }t j | |}dfd}t |t |dkrEdt |t |d}|r||g|||}|j |||q|r9||g|||}q|g}n}dt |}||}|||}t |dkrg}|j ||||j |||n|g|}d j|}qnd ||fS( Nsusage: RMs%(prog)st s\(.*?\)+|\[.*?\]+|\S+csg}g}|dk r+t|d}nt|d}x||D]t}|dt|kr|j|dj|g}t|d}n|j||t|d7}qBW|r|j|dj|n|dk r|dt||dRotaddtrequiredtranget enumerateRkRR%R5tgettpopRt _format_argstdesttnargstupperRtTrueR(RIRzR{(R)RgRht group_actionstinsertstgrouptstarttendRqtiRR}t option_stringtdefaultt args_stringtitemRctopentclose((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRsp                 . cCsYd|kr%|td|j}n|j|j}d|j}|j|||dS(Ns%(prog)RMR~s (RR?RBRCt _fill_text(R)RcRR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRbs   c Cst|jd|j}|j|}||jd}|j|}|jsn|jd|f}d|}n\t||kr|jd||f}d|}d}n"|jd|f}d|}|}|g}|jrM|j|} |j | |} |j d|d| dfxN| dD] } |j d|d| fq&Wn|j dsl|j dnx-|j |D]} |j |j | q|W|j|S(NiRWs%*s%s s %*s%-*s iis (tminRERARBRCRlRkRot _expand_helpt _split_linesR%tendswithRmRpRX( R)Rqt help_positiont help_widtht action_widtht action_headerttupt indent_firstRt help_textt help_linesRRt((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRps6          !cCs|js+|j||jd\}|Sg}|jdkrS|j|jnL|jj}|j||}x(|jD]}|jd||fq~Wdj|SdS(Niis%s %ss, ( Rt_metavar_formatterRRRRRR%R((R)RqtmetavarRRRR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRl)s cs{|jdk r|jnM|jdk rbg|jD]}t|^q4}ddj|n|fd}|S(Ns{%s}t,cs"ttrSf|SdS(N(t isinstancettuple(t tuple_size(R(s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRIs(RR5tchoiceststrR((R)Rqtdefault_metavartchoicet choice_strsR((Rs9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR@s "cCs|j||}|jdkr4d|d}n|jtkrVd|d}n|jtkrxd|d}n|jtkrd|d}nx|jtkrd}n`|jtkrd|d}n>gt|jD] }d^q}d j |||j}|S( Ns%sis[%s]s [%s [%s ...]]is %s [%s ...]s...s%s ...R~( RRR5R RR R R RR((R)RqRt get_metavarRRtformats((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRPs  "cCstt|d|j}x.t|D] }||tkr(||=q(q(Wx;t|D]-}t||drY||j|| 0; if you have nothing to store, actions such as store true or store const may be more appropriates nargs must be %r to supply constRRRRRR"RRRkR(R>R5R tsuperRRQ( R)RRRRRR"RRRkR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQ:s cCst||j|dS(N(R6R(R)RR7RR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRWsN(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR8s t_StoreConstActioncBs)eZdedddZddZRS(cCsAtt|jd|d|ddd|d|d|d|dS( NRRRiRRRRk(RRRQ(R)RRRRRRkR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQ]scCst||j|jdS(N(R6RR(R)RR7RR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRnsN(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR[s  t_StoreTrueActioncBseZeeddZRS(c Cs;tt|jd|d|dtd|d|d|dS(NRRRRRRk(RRRQR(R)RRRRRk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQtsN(R#R2RR5RQ(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRrst_StoreFalseActioncBseZeeddZRS(c Cs;tt|jd|d|dtd|d|d|dS(NRRRRRRk(RRRQR(R)RRRRRk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQsN(R#R2RRR5RQ(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRst _AppendActionc Bs5eZdddddedddZddZRS(c Cs|dkrtdn|dk rF|tkrFtdtntt|jd|d|d|d|d|d |d |d |d | d | dS(Nisnargs for append actions must be > 0; if arg strings are not supplying the value to append, the append const action may be more appropriates nargs must be %r to supply constRRRRRR"RRRkR(R>R5R RRRQ( R)RRRRRR"RRRkR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs cCsBtjt||jg}|j|t||j|dS(N(t_copytcopyR8RR%R6(R)RR7RRR1((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs N(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs t_AppendConstActioncBs)eZdedddZddZRS(cCsGtt|jd|d|ddd|d|d|d|d |dS( NRRRiRRRRkR(RRRQ(R)RRRRRRkR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQscCsEtjt||jg}|j|jt||j|dS(N(RRR8RR%RR6(R)RR7RRR1((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRsN(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs  t _CountActioncBs&eZdeddZddZRS(c Cs;tt|jd|d|ddd|d|d|dS(NRRRiRRRk(RRRQ(R)RRRRRk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQscCs0t||jdd}t||j|dS(Nii(R8RR6(R)RR7RRt new_count((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRsN(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs t _HelpActioncBs&eZeeddZddZRS(c Cs5tt|jd|d|d|ddd|dS(NRRRRiRk(RRRQ(R)RRRRk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs cCs|j|jdS(N(t print_helptexit(R)RR7RR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs N(R#R2RR5RQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs t_VersionActioncBs)eZdeeddZddZRS(s&show program's version number and exitc Cs>tt|jd|d|d|ddd|||_dS(NRRRRiRk(RRRQtversion(R)RRRRRk((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQscCsT|j}|dkr!|j}n|j}|j||jd|jdS(NR(RR5t_get_formatterRdRR](R)RR7RRRRT((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR s      N(R#R2R5RRQR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs  t_SubParsersActioncBsNeZdefdYZedddZdZdZddZ RS(t_ChoicesPseudoActioncBseZdZRS(cCs2ttj|}|jdgd|d|dS(NRRRk(RRRRQ(R)R-Rktsup((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs(R#R2RQ(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRsc Csb||_||_i|_g|_tt|jd|d|dtd|jd|d|dS(NRRRRRkR(t _prog_prefixt _parser_classt_name_parser_mapt_choices_actionsRRRQR (R)RRMt parser_classRRkR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs     cKs|jddkr/d|j|f|dR R(R)tstringR ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRrs  cCs]|j|jg}djg|D]}|dk rt|^q}dt|j|fS(Ns, s%s(%s)(R R R(R5R&R"R#(R)RZR,targs_str((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR/s4N(R#R2R3R5RQRR/(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRas  cBs8eZdZdZdZdZdZdZRS(sSimple object for storing attributes. Implements equality by attribute names and values, and provides a simple string representation. cKs)x"|D]}t||||qWdS(N(R6(R)RR-((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs cCst|t|kS(N(R(R)tother((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt__eq__scCs ||k S(N((R)R((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt__ne__scCs ||jkS(N(R0(R)tkey((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt __contains__sN( R#R2R3RQR5t__hash__RRR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs    t_ActionsContainercBseZdZdZddZdZdZdZdZ dZ dZ d Z d Z d Zd Zdd ZdZdZdZdZRS(cCsgtt|j||_||_||_||_i|_|jddt |jddt |jddt |jddt |jddt |jddt|jddt|jddt|jdd t|jdd t|jdd t|jg|_i|_g|_g|_i|_tjd |_g|_dS( NRqtstoret store_constt store_truet store_falseR%t append_consttcountRkRtparserss^-\d+$|^-\d*\.\d+$(RRRQt descriptiontargument_defaultt prefix_charstconflict_handlert _registriestregisterR5RRRRRRRRRRt _get_handlert_actionst_option_string_actionst_action_groupst_mutually_exclusive_groupst _defaultsRIRJt_negative_number_matchert_has_negative_number_optionals(R)R%R'R&R(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs2           cCs#|jj|i}|||t_get_positional_kwargst_get_optional_kwargsR0R&R5t_pop_action_classRR5R"t _add_action(R)RZRtcharsRt action_classRqt type_func((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRxs( -     cOs&t|||}|jj||S(N(t_ArgumentGroupR.R%(R)RZRR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytadd_argument_groupscKs#t||}|jj||S(N(t_MutuallyExclusiveGroupR/R%(R)RR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytadd_mutually_exclusive_group#scCs|j||jj|||_x|jD]}||j|RAR%R(RR/RCRR,RR<(R)REttitle_group_mapRR t group_mapRqt mutex_group((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt_add_container_actions@s,      cKsd|kr'td}t|n|jdttgkrOt|dR%RoRR5tlstriptreplaceR( R)RZRRtlong_option_stringsRR RRtdest_option_string((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR:xs.       cCs%|jd|}|jd||S(NRq(RR5(R)RRRq((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR;scCsUd|j}yt||SWn0tk rPtd}t||jnXdS(Ns_handle_conflict_%ss%invalid conflict_resolution value: %r(R(R4RRR>(R)thandler_func_nameR ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR+s    cCsrg}xC|jD]8}||jkr|j|}|j||fqqW|rn|j}|||ndS(N(RR-R%R+(R)Rqtconfl_optionalsRtconfl_optionalR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRDs  cCsKtd}djg|D]\}}|^q}t|||dS(Ns conflicting option string(s): %ss, (RR(R(R)Rqtconflicting_actionsRRtconflict_string((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt_handle_conflict_errors  cCsZxS|D]K\}}|jj||jj|d|js|jj|qqWdS(N(RRGR-RR5RERH(R)RqRVR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt_handle_conflict_resolves  N(R#R2RQR*R5R5R7R8RxRARCR<RHRMR9R:R;R+RDRXRY(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs$ 4   (     (  #   R@cBs)eZdddZdZdZRS(cKs|j}|d|j|d|j|d|jtt|j}|d||||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ dS(NR(R'R&R%(RR(R'R&RR@RQRIRR)R,R-R0R2(R)RERIR%RR6t super_init((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs       cCs,tt|j|}|jj||S(N(RR@R<RR%(R)Rq((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR<scCs*tt|j||jj|dS(N(RR@RHRRG(R)Rq((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRHsN(R#R2R5RQR<RH(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR@s RBcBs&eZedZdZdZRS(cCs,tt|j|||_||_dS(N(RRBRQRt _container(R)RER((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs cCsJ|jr$td}t|n|jj|}|jj||S(Ns-mutually exclusive arguments must be optional(RRR>R[R<RR%(R)RqR ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR<s   cCs$|jj||jj|dS(N(R[RHRRG(R)Rq((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRHs(R#R2RRQR<RH(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRBs  c BsUeZdZd!d!d!d!d!gedd!d!ded ZdZdZdZ dZ dZ d!d!d Z d!d!d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZd!dZd!dZd!dZd!dZ dd!dZ!d Z"RS("saObject 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 Rterrorc  Cs|dk r+ddl} | jdtntt|j}|d|d|d| d| |dkrtjj t j d}n||_ ||_ ||_||_||_| |_| |_|j}|td|_|td |_d|_d }|jd d|d |kr0d }n |d}|jrz|j|d |dddddtdtdn|jr|j|d|dddddtd|jdtdnxL|D]D}|j|y |j}Wntk rqX|jj|qWdS(NisThe "version" argument to ArgumentParser is deprecated. Please use "add_argument(..., action='version', version="N", ...)" insteadR%R'R&R(ispositional argumentssoptional argumentscSs|S(N((R((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytidentityAsR"RthiRkRqRsshow this help message and exittvRs&show program's version number and exit(R5twarningstwarntDeprecationWarningRRRQR;tpathtbasenameRtargvRMRftepilogRtformatter_classtfromfile_prefix_charstadd_helpRARt _positionalst _optionalst _subparsersR*RxRRMR0RR6(R)RMRfR%RfRtparentsRgR'RhR&R(RiR`t superinitt add_groupR]tdefault_prefixRUtdefaults((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRQs\                           cCsAdddddddg}g|D]}|t||f^q"S(NRMRfR%RRgR(Ri(R4(R)RR-((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR'ds c KsG|jdk r%|jtdn|jdt|d|ksSd|krt|jdd}t|jdd}|j|||_n |j|_|j ddkr|j }|j }|j }|j |j||d|jj|dt||js|jtk r|j}t |jt r|j ||}nt ||j|qqq>q>Wx:|j D]/}t||st |||j |qqWy[|j||\}}t|trQ|jt|tt|tn||fSWn4tk rtjd}|jt|nXdS(Ni(R5RReRR,RRRRRt basestringt _get_valueR6R0t_parse_known_argsRRR4tdelattrRtexc_infoR\R(R)RZR7RqRRterr((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs0      cs jdk r! jnixr jD]g}|j}xUt|jD]D\}}j|g}|j|| |j||dqPWq1Wig}t} xt| D]\}} | dkr|j dx_| D]} |j dqWq j | } | dkr+d} n| |x{|jD]}|krWPqWqWWg|jD]!}|jtk r{t|^q{}td} j|dj |q>q>WfS(Nis--RtAtORWcsj|j||}||jk rj|xWj|gD]@}|krNtd}t|}t|||qNqNWn|tk r|||ndS(Nsnot allowed with argument %s(Rt _get_valuesRRRRRR(Rqtargument_stringsRtargument_valuestconflict_actionR t action_name(taction_conflictsR7t seen_actionstseen_non_default_actionsR)(s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt take_actions      cs|}|\}}}j}g}xtr|dkrVj||dS|dk ry||d}j}|dkr|d|kr|j|g|f|d} | |d}|dpd} j} || kr| |}| }qvtd} t|| |q|dkrW|d} |g}|j|||fPqtd} t|| |q+|d}|}|||}||} || !}|j|||fPq+Wx'|D]\}}}|||qW| S(NiR~isignored explicit argument %r(t_match_argumentRR5R%R'R-RR(t start_indext option_tupleRqRt explicit_argtmatch_argumentt action_tuplest arg_countR=tchartnew_explicit_argt optionals_mapR tstopRZRtselected_patterns(R+targ_strings_patterntextrastoption_string_indicesR)R(s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytconsume_optionalsN                    csj}|}||}xEt|D]4\}}|||!}||7}||q2Wt|(|S(N(t_match_arguments_partialtzipRo(Rt match_partialtselected_patternt arg_countsRqRRZ(R+RRR)R(s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytconsume_positionalsas   iistoo few argumentssargument %s is requireds#one of the arguments %s is requiredR~(RhR5t_read_args_from_filesR/RRRRtiterR%t_parse_optionalR(RRsRnRR\RR,RRRkR(R)R+R7RLRRt mutex_actiont conflictstarg_string_pattern_partstarg_strings_itert arg_stringRtpatternRRRtmax_option_string_indexRtnext_option_string_indextpositionals_end_indextstringst stop_indexRqR-RRR (( RR+RRR7RRRRR)Rs9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRzs          J              !   ! !cCsg}x|D]}|d|jkr6|j|q yt|d}zjg}xA|jjD]-}x$|j|D]}|j|q{WqeW|j|}|j|Wd|jXWq t k rt j d}|j t |q Xq W|S(Nii(RhR%RtreadRtconvert_arg_line_to_argsRRRtIOErrorRR|R\R(R)R+tnew_arg_stringsRt args_filetarg_lineR,R}((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs$  cCs|gS(N((R)R((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRscCs|j|}tj||}|dkritdd6tdt6tdt6}td|j}|j|j|}t ||nt |j dS(Nsexpected one argumentsexpected at most one argumentsexpected at least one argumentsexpected %s argument(s)i( t_get_nargs_patternRIRFR5RR R RRRRoR(R)RqRt nargs_patternRFt nargs_errorsRR ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs   c Csg}xtt|ddD]}|| }djg|D]}|j|^q<}tj||}|dk r|jg|jD]} t| ^qPqqW|S(NiiRW( RRoR(RRIRFR5RRh( R)RgRRRt actions_sliceRqRRFR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs  " ,c Cs|s dS|d|jkr!dS||jkrJ|j|}||dfSt|dkr`dSd|kr|jdd\}}||jkr|j|}|||fSn|j|}t|dkr"djg|D]\}}}|^q}||f}|jtd|nt|dkrA|\}|S|j j |rc|j scdSnd|krsdSd|dfS(Niit=s, s#ambiguous option: %s could match %sR~( R5R'R-Rotsplitt_get_option_tuplesR(R\RR1RFR2( R)RRqRRt option_tuplestoptionsRR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs:     "    c Csg}|j}|d|kr|d|krd|krV|jdd\}}n |}d}x0|jD]A}|j|rl|j|}|||f}|j|qlqlWn|d|kr~|d|kr~|}d}|d }|d} x|jD]y}||kr<|j|}||| f}|j|q|j|r|j|}|||f}|j|qqWn|jtd||S(NiiRisunexpected option string: %s(R'RR5R-t startswithR%R\R( R)RRR=t option_prefixRRqRtshort_option_prefixtshort_explicit_arg((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR7s8          cCs|j}|dkrd}n|tkr3d}nk|tkrHd}nV|tkr]d}nA|tkrrd}n,|tkrd}nddjd |}|jr|j dd }|j d d }n|S( Ns(-*A-*)s(-*A?-*)s (-*[A-]*)s (-*A[A-]*)s([-AO]*)s (-*A[-AO]*)s(-*%s-*)s-*R~RWR( RR5R RR R R R(RRP(R)RqRR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRcs$              c Cs|jttgkr=g|D]}|dkr|^q}n| r|jtkr|jrh|j}n |j}t|tr|j ||}|j ||qnq| r|jt kr|j r|jdk r|j}n|}|j ||nt |dkrQ|jdtgkrQ|\}|j ||}|j ||n|jtkrg|D]}|j ||^qg}n|jtkrg|D]}|j ||^q}|j ||dnFg|D]}|j ||^q}x|D]}|j ||qW|S(Ns--ii(RR R R RRRRRxRyt _check_valueRR5Ro(R)RqR+RuR.RR_((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs8(     ' (%% cCs |jd|j|j}t|sItd}t|||ny||}Wntk rt|jdt|j}tt j d}t||nZt t fk rt|jdt|j}td}t||||fnX|S(NR"s%r is not callableR#isinvalid %s value: %r( R5R"RRRRR4R&RRR|RNR>(R)RqRR?R RR-((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRys    cCse|jdk ra||jkra|djtt|jf}td|}t||ndS(Ns, s#invalid choice: %r (choose from %s)(RR5R(tmapR&RR(R)RqR.RR ((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRs!cCs2|j}|j|j|j|j|jS(N(RRjRfR,R/R](R)RT((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt format_usages  cCs|j}|j|j|j|j|j|jxK|jD]@}|j|j |j|j|j |j |j qBW|j|j |jS(N(RRjRfR,R/RdR%R.R`RIRyRRaRfR](R)RTt action_group((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR]s  cCsBddl}|jdt|j}|j|j|jS(NiskThe format_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.(R`RaRbRRdRR](R)R`RT((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pytformat_version s  cCs|jd|jS(NRM(RgRM(R)((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR scCs2|dkrtj}n|j|j|dS(N(R5RRt_print_messageR(R)tfile((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt print_usage s  cCs2|dkrtj}n|j|j|dS(N(R5RRRR](R)R((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR s  cCs6ddl}|jdt|j|j|dS(NisjThe print_version method is deprecated -- the "version" argument to ArgumentParser is no longer supported.(R`RaRbRR(R)RR`((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt print_version s  cCs2|r.|dkrtj}n|j|ndS(N(R5Rtstderrtwrite(R)RR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR" s  icCs-|r|j|tjntj|dS(N(RRRR(R)tstatusR((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR+ scCs7|jtj|jdtd|j|fdS(serror(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. is%s: error: %s N(RRRRRRM(R)R((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyR\0 s N(#R#R2R3R5RRRQR'RuR<RvRsRwRRzRRRRRRRRRyRRR]RRRRRRRR\(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyRsR E     #     9 , , 1        (;R3t __version__t__all__RRtosR;treRItsysRttextwrapRRRRt NameErrortsetsRRxRRRRRR RR R R RRR!R8RRRRRt ExceptionRRR RRRRRRRRRRRRRR@RBR(((s9/opt/alt/python27/lib/python2.7/site-packages/argparse.pyt>s                [#%M+*!