ZRc @sdZdZdddddddd d g Zd d lZd d lZd d lZd d l Z d d l Z d d l m Zy eZWn!ek rd dlmZnXy eZWnek reZnXy eZWnek redZnXdZe jd ddfkrHd d lZejdddddeddndZdZ dZ!dZ"dZ#dZ$d e%fd!YZ&d"Z'de%fd#YZ(de(fd$YZ)d e)fd%YZ*d e(fd&YZ+d'Z,de-fd(YZ.d)e-fd*YZ/de&fd+YZ0d,e0fd-YZ1d.e0fd/YZ2d0e2fd1YZ3d2e2fd3YZ4d4e0fd5YZ5d6e0fd7YZ6d8e0fd9YZ7d:e0fd;YZ8d<e0fd=YZ9d>e0fd?YZ:de%fd@YZ;de&fdAYZ<dBe%fdCYZ=dDe=fdEYZ>dFe>fdGYZ?de&e=fdHYZ@d S(Is 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.1tArgumentParsert ArgumentErrort NamespacetActiontFileTypet HelpFormattertRawDescriptionHelpFormattertRawTextHelpFormattertArgumentDefaultsHelpFormatteriN(tgettext(tSetcCs-t|}|j|r)|jn|S(N(tlisttsorttreverse(titerableR tresult((s/opt/fido/fido/argparselocal.pyt_sortedrs    cCst|dpt|dS(Nt__call__t __bases__(thasattr(tobj((s/opt/fido/fido/argparselocal.pyt _callablezsiitactiontignoretmessages:BaseException.message has been deprecated as of Python 2.6tcategorytmoduletargparses ==SUPPRESS==t?t*t+sA...s...t_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((s/opt/fido/fido/argparselocal.pyt__repr__scCst|jjS(N(Rt__dict__titems(R'((s/opt/fido/fido/argparselocal.pyR%scCsgS(N((R'((s/opt/fido/fido/argparselocal.pyR"s(R!t __module__t__doc__R-R%R"(((s/opt/fido/fido/argparselocal.pyRs cCs8t||ddkr+t|||nt||S(N(tgetattrtNonetsetattr(t namespaceR+R,((s/opt/fido/fido/argparselocal.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+(R3tintt_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((s/opt/fido/fido/argparselocal.pyt__init__s"           cCs%|j|j7_|jd7_dS(Ni(RAR>RB(R'((s/opt/fido/fido/argparselocal.pyt_indentscCs@|j|j8_|jdks-td|jd8_dS(NisIndent decreased below 0.i(RAR>tAssertionErrorRB(R'((s/opt/fido/fido/argparselocal.pyt_dedentsRDcBseZddZdZRS(cCs(||_||_||_g|_dS(N(t formattertparenttheadingR/(R'RSRTRU((s/opt/fido/fido/argparselocal.pyROs   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 ( RTR3RSRPt _join_partsR/RRRUtSUPPRESSRA(R'R&tfunctargst item_helptcurrent_indentRU((s/opt/fido/fido/argparselocal.pyt format_helps . N(R!R0R3ROR](((s/opt/fido/fido/argparselocal.pyRDs cCs|jjj||fdS(N(RFR/R#(R'RYRZ((s/opt/fido/fido/argparselocal.pyt _add_itemscCsB|j|j||j|}|j|jg||_dS(N(RPRDRFR^R](R'RUtsection((s/opt/fido/fido/argparselocal.pyt start_section s cCs|jj|_|jdS(N(RFRTRR(R'((s/opt/fido/fido/argparselocal.pyt end_sectionscCs5|tk r1|dk r1|j|j|gndS(N(RXR3R^t _format_text(R'ttext((s/opt/fido/fido/argparselocal.pytadd_textscCs8|tk r4||||f}|j|j|ndS(N(RXR^t _format_usage(R'tusagetactionstgroupstprefixRZ((s/opt/fido/fido/argparselocal.pyt add_usages cCs|jtk r|j}||g}x*|j|D]}|j||q7Wtg|D]}t|^q^}||j}t|j||_|j |j |gndS(N( thelpRXt_format_action_invocationt_iter_indented_subactionsR#tmaxtlenRARCR^t_format_action(R'Rtget_invocationt invocationst subactiontstinvocation_lengtht action_length((s/opt/fido/fido/argparselocal.pyt add_argument s %   cCs"x|D]}|j|qWdS(N(Rw(R'RgR((s/opt/fido/fido/argparselocal.pyt add_arguments2s cCsD|jj}|r@|jjd|}|jdd}n|S(Ns s (RER]RJtsubtstrip(R'Rk((s/opt/fido/fido/argparselocal.pyR]9s cCs2djg|D]}|r |tk r |^q S(NRV(R&RX(R't part_stringstpart((s/opt/fido/fido/argparselocal.pyRW@s  cs|dkrtd}n|dk r@|td|j}n|dkrl| rldtd|j}n|dkr dtd|j}g}g}x4|D],}|jr|j|q|j|qW|j} | |||} djg|| gD]} | r| ^q}|j|j t |t |kr d} | ||} | ||}t j | | }t j | |}dj|| kst dj||kst dfd}t |t |dkr{dt |t |d}|rM||g|||}|j|||q|ro||g|||}q|g}n}dt |}||}|||}t |dkrg}|j||||j|||n|g|}d j|}q nd ||fS( Nsusage: RKs%(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||dgt|jD] }d^q}d j |||j}|S( Ns%sis[%s]s [%s [%s ...]]is %s [%s ...]s...s%s ...R}( RRR3tOPTIONALt ZERO_OR_MOREt ONE_OR_MOREt REMAINDERtPARSERRR&(R'RRt get_metavarRRtformats((s/opt/fido/fido/argparselocal.pyRXs  "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<R3RtsuperRRO( R'RRRRRR RRRkR((s/opt/fido/fido/argparselocal.pyROBs cCst||j|dS(N(R4R(R'RR5RR((s/opt/fido/fido/argparselocal.pyR_sN(R!R0R3RROR(((s/opt/fido/fido/argparselocal.pyR@s t_StoreConstActioncBs)eZdedddZddZRS(cCsAtt|jd|d|ddd|d|d|d|dS( NRRRiRRRRk(RRRO(R'RRRRRRkR((s/opt/fido/fido/argparselocal.pyROescCst||j|jdS(N(R4RR(R'RR5RR((s/opt/fido/fido/argparselocal.pyRvsN(R!R0R3RROR(((s/opt/fido/fido/argparselocal.pyRcs  t_StoreTrueActioncBseZeeddZRS(c Cs;tt|jd|d|dtd|d|d|dS(NRRRRRRk(RRROR(R'RRRRRk((s/opt/fido/fido/argparselocal.pyRO|sN(R!R0RR3RO(((s/opt/fido/fido/argparselocal.pyRzst_StoreFalseActioncBseZeeddZRS(c Cs;tt|jd|d|dtd|d|d|dS(NRRRRRRk(RRROR(R'RRRRRk((s/opt/fido/fido/argparselocal.pyROsN(R!R0RRR3RO(((s/opt/fido/fido/argparselocal.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<R3RRRRO( R'RRRRRR RRRkR((s/opt/fido/fido/argparselocal.pyROs cCsBtjt||jg}|j|t||j|dS(N(t_copytcopyR6RR#R4(R'RR5RRR/((s/opt/fido/fido/argparselocal.pyRs N(R!R0R3RROR(((s/opt/fido/fido/argparselocal.pyRs t_AppendConstActioncBs)eZdedddZddZRS(cCsGtt|jd|d|ddd|d|d|d|d |dS( NRRRiRRRRkR(RRRO(R'RRRRRRkR((s/opt/fido/fido/argparselocal.pyROscCsEtjt||jg}|j|jt||j|dS(N(RRR6RR#RR4(R'RR5RRR/((s/opt/fido/fido/argparselocal.pyRsN(R!R0R3RROR(((s/opt/fido/fido/argparselocal.pyRs  t _CountActioncBs&eZdeddZddZRS(c Cs;tt|jd|d|ddd|d|d|dS(NRRRiRRRk(RRRO(R'RRRRRk((s/opt/fido/fido/argparselocal.pyROscCs0t||jdd}t||j|dS(Nii(R6RR4(R'RR5RRt new_count((s/opt/fido/fido/argparselocal.pyRsN(R!R0R3RROR(((s/opt/fido/fido/argparselocal.pyRs t _HelpActioncBs&eZeeddZddZRS(c Cs5tt|jd|d|d|ddd|dS(NRRRRiRk(RRRO(R'RRRRk((s/opt/fido/fido/argparselocal.pyROs cCs|j|jdS(N(t print_helptexit(R'RR5RR((s/opt/fido/fido/argparselocal.pyRs N(R!R0RXR3ROR(((s/opt/fido/fido/argparselocal.pyRs t_VersionActioncBs)eZdeeddZddZRS(c Cs>tt|jd|d|d|ddd|||_dS(NRRRRiRk(RRROtversion(R'RRRRRk((s/opt/fido/fido/argparselocal.pyROscCsT|j}|dkr!|j}n|j}|j||jd|jdS(NR(RR3t_get_formatterRdRR](R'RR5RRRRS((s/opt/fido/fido/argparselocal.pyRs      N(R!R0R3RXROR(((s/opt/fido/fido/argparselocal.pyRs  t_SubParsersActioncBsNeZdefdYZedddZdZdZddZ RS(t_ChoicesPseudoActioncBseZdZRS(cCs2ttj|}|jdgd|d|dS(NRRRk(RRRRO(R'R+Rktsup((s/opt/fido/fido/argparselocal.pyRO s(R!R0RO(((s/opt/fido/fido/argparselocal.pyRsc Csb||_||_i|_g|_tt|jd|d|dtd|jd|d|dS(NRRRRRkR(t _prog_prefixt _parser_classt_name_parser_mapt_choices_actionsRRROR(R'RRKt parser_classRRkR((s/opt/fido/fido/argparselocal.pyRO$s     cKs|jddkr/d|j|f|d)s   cCs|jj|dS(N(R-tremove(R'R((s/opt/fido/fido/argparselocal.pyt_remove_action>scCsOi}xO|jD]D}|j|krGtd}t||jn|||j(R'RGttitle_group_mapRR t group_mapRt mutex_group((s/opt/fido/fido/argparselocal.pyt_add_container_actionsAs,      cKsd|kr'td}t|n|jdttgkrOt|dRJROR;R<R=R,RFRZR[(((s/opt/fido/fido/argparselocal.pyRs$ 4   (     (  #   RBcBs)eZdddZdZdZRS(cKs|j}|d|j|d|j|d|jtt|j}|d||||_g|_|j |_ |j |_ |j |_ |j |_ |j |_ dS(NR)R(R'R&(R4R)R(R'RRBRORKRR*R-R.R1R3(R'RGRKR&RR8t super_init((s/opt/fido/fido/argparselocal.pyROs       cCs,tt|j|}|jj||S(N(RRBR>RR#(R'R((s/opt/fido/fido/argparselocal.pyR>scCs*tt|j||jj|dS(N(RRBRJRRI(R'R((s/opt/fido/fido/argparselocal.pyRJsN(R!R0R3ROR>RJ(((s/opt/fido/fido/argparselocal.pyRBs RDcBs&eZedZdZdZRS(cCs,tt|j|||_||_dS(N(RRDRORt _container(R'RGR((s/opt/fido/fido/argparselocal.pyROs cCsJ|jr$td}t|n|jj|}|jj||S(Ns-mutually exclusive arguments must be optional(RRR<R]R>RR#(R'RR ((s/opt/fido/fido/argparselocal.pyR>s   cCs$|jj||jj|dS(N(R]RJRRI(R'R((s/opt/fido/fido/argparselocal.pyRJs(R!R0RROR>RJ(((s/opt/fido/fido/argparselocal.pyRDs  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||jrO|jd d dddtdtdn|jr|jdddddtd|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((s/opt/fido/fido/argparselocal.pytidentityBsR s-hs--helpRRkRsshow this help message and exits-vs --versionRs&show program's version number and exit(R3twarningstwarntDeprecationWarningRRROR9tpathtbasenameRtargvRKRftepilogRtformatter_classtfromfile_prefix_charstadd_helpRCRt _positionalst _optionalst _subparsersR+RwRXROR1RR8(R'RKRfR&RfRtparentsRgR(RhR'R)RiR`t superinitt add_groupR_RTtdefaults((s/opt/fido/fido/argparselocal.pyROsR                      cCsAdddddddg}g|D]}|t||f^q"S(NRKRfR&RRgR)Ri(R2(R'RR+((s/opt/fido/fido/argparselocal.pyR%_s c KsG|jdk r%|jtdn|jdt|d|ksSd|krt|jdd}t|jdd}|j|||_n |j|_|j ddkr|j }|j }|j }|j |j||d|jj|d( R'RRKR&RSRRht parsers_classR((s/opt/fido/fido/argparselocal.pytadd_subparsersns$    cCs0|jr|jj|n|jj||S(N(RRkR>Rj(R'R((s/opt/fido/fido/argparselocal.pyR>s cCs#g|jD]}|jr |^q S(N(R-R(R'R((s/opt/fido/fido/argparselocal.pyt_get_optional_actionss cCs#g|jD]}|js |^q S(N(R-R(R'R((s/opt/fido/fido/argparselocal.pyRrs cCsK|j||\}}|rGtd}|j|dj|n|S(Nsunrecognized arguments: %sR}(tparse_known_argsRR^R&(R'RZR5ReR ((s/opt/fido/fido/argparselocal.pyR s  cCsP|dkrtjd}n|dkr4t}nx|jD]}|jtk r>t||js|jtk r|j}t |jt r|j ||}nt ||j|qqq>q>Wx:|j D]/}t||st |||j |qqWy|j||SWn4tk rKtjd}|jt|nXdS(Ni(R3RReRR-RRXRRRt _basestringt _get_valueR4R1t_parse_known_argsRtexc_infoR^R(R'RZR5RRRterr((s/opt/fido/fido/argparselocal.pyRvs(      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--RtAtORVcsj|j||}||jk rj|xWj|gD]@}|krNtd}t|}t|||qNqNWn|tk r|||ndS(Nsnot allowed with argument %s(Rt _get_valuesRRRRRRX(Rtargument_stringsRtargument_valuestconflict_actionR t action_name(taction_conflictsR5t seen_actionstseen_non_default_actionsR'(s/opt/fido/fido/argparselocal.pyt take_actions      cs |}|\}}}j}g}xtr|dkrVj||dS|dk r~||d}j}|dkr#|d|kr#|j|g|fxjD]G} | |d}|dpd}j} || kr| |}PqqWtd} t|| |q|dkr\|d} |g} |j|| |fPqtd} t|| |q+|d}|}|||}||} || !} |j|| |fPq+W|stx'|D]\}} }|| |qW| S(NiR|isignored explicit argument %r( t_match_argumentRR3R#R(R.RRRQ(t start_indext option_tupleRRt explicit_argtmatch_argumentt action_tuplest arg_countR?tchart optionals_mapR tstopRZRtselected_patterns(R)targ_strings_patterntextrastoption_string_indicesR'R(s/opt/fido/fido/argparselocal.pytconsume_optional sP                   csj}|}||}xEt|D]4\}}|||!}||7}||q2Wt|(|S(N(t_match_arguments_partialtzipRo(Rt match_partialtselected_patternt arg_countsRRRZ(R)RRR'R(s/opt/fido/fido/argparselocal.pytconsume_positionalsXs   iistoo few argumentssargument %s is requireds#one of the arguments %s is requiredR}(RhR3t_read_args_from_filesR0RRR4RtiterR#t_parse_optionalR&RRrRnRR^RR-RRRkRX(R'R)R5RNRRt mutex_actiont conflictstarg_string_pattern_partstarg_strings_itert arg_stringRtpatternRRRtmax_option_string_indexRtnext_option_string_indextpositionals_end_indextstringst stop_indexRR+RRR (( RR)RRR5RRRRR'Rs/opt/fido/fido/argparselocal.pyRys          J              !   ! !cCsg}x|D]}t|dks8|d|jkrH|j|q yt|d}zjg}xA|jjD]-}x$|j|D]}|j|qWqwW|j|}|j|Wd|j XWq t k r t j d}|j t|q Xq W|S(Nii(RoRhR#RtreadRtconvert_arg_line_to_argsRRRtIOErrorRRzR^R(R'R)tnew_arg_stringsRt args_filetarg_lineR*R{((s/opt/fido/fido/argparselocal.pyRs$ % cCs|gS(N((R'R((s/opt/fido/fido/argparselocal.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_patternRGRHR3RRRRRRRoR(R'RRt nargs_patternRHt nargs_errorsRR ((s/opt/fido/fido/argparselocal.pyRs   c Csg}xtt|ddD]}|| }djg|D]}|j|^q<}tj||}|dk r|jg|jD]} t| ^qPqqW|S(NiiRV( RRoR&RRGRHR3RRh( R'RgRRRt actions_sliceRRRHR((s/opt/fido/fido/argparselocal.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}( R3R(R.Rotsplitt_get_option_tuplesR&R^RR2RHR3( R'RRRRt option_tuplestoptionsRR((s/opt/fido/fido/argparselocal.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(RR3R.t startswithR#R^R( R'RRR?t option_prefixRRRtshort_option_prefixtshort_explicit_arg((s/opt/fido/fido/argparselocal.pyR0s8          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|RVR( RR3RRRRRR&RRR(R'RRR((s/opt/fido/fido/argparselocal.pyR\s$              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(RRRRRRRRRwRxt _check_valueRR3Ro(R'RR)RtR,Rtv((s/opt/fido/fido/argparselocal.pyR~s8(     ' (%% 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( R7R RRRRR2R$RRRzRPR<(R'RRRAR RR+((s/opt/fido/fido/argparselocal.pyRxs    cCse|jdk ra||jkra|djtt|jf}td|}t||ndS(Ns, s#invalid choice: %r (choose from %s)(RR3R&tmapR$RR(R'RR,RR ((s/opt/fido/fido/argparselocal.pyRs!cCs2|j}|j|j|j|j|jS(N(RRjRfR-R0R](R'RS((s/opt/fido/fido/argparselocal.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-R0RdR&R/R`RKRxRRaRfR](R'RSt action_group((s/opt/fido/fido/argparselocal.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`RS((s/opt/fido/fido/argparselocal.pytformat_versions  cCs|jd|jS(NRK(RgRK(R'((s/opt/fido/fido/argparselocal.pyR scCs2|dkrtj}n|j|j|dS(N(R3RRt_print_messageR(R'tfile((s/opt/fido/fido/argparselocal.pyt print_usage s  cCs2|dkrtj}n|j|j|dS(N(R3RRRR](R'R((s/opt/fido/fido/argparselocal.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`((s/opt/fido/fido/argparselocal.pyt print_version s  cCs2|r.|dkrtj}n|j|ndS(N(R3Rtstderrtwrite(R'RR((s/opt/fido/fido/argparselocal.pyR s  icCs-|r|j|tjntj|dS(N(RRRR(R'tstatusR((s/opt/fido/fido/argparselocal.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(RRRRRRK(R'R((s/opt/fido/fido/argparselocal.pyR^) s N(#R!R0R1R3RRROR%RtR>RuRrR RvRyRRRRRRRR~RxRRR]RRRRRRRR^(((s/opt/fido/fido/argparselocal.pyRsR ?          9 , , 1        (AR1t __version__t__all__RRtosR9treRGtsysRttextwrapRR RtsetRt NameErrortsetsR t basestringRwRtsortedRRRt version_infoR`tfilterwarningsRbRXRRRRRRRR6RRRRRt ExceptionRRRRRRRRRRRRRRRRRBRDR(((s/opt/fido/fido/argparselocal.pytLs                      [#%H+*!