
    F\h                        S r Sr/ SQrSrSSKrSSKrSSKrS r SSKJrJ	r	  \r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S\5      r " S S\5      rS rS r\\" S5      4\\" S5      4\\" S5      4\\" S 5      4S!.rS" rS# rS$r " S% S&5      rS'rS(r  " S) S*5      r! " S+ S,5      r" " S- S.\"5      r# " S/ S0\"5      r$S1 r%\r&g! \
 a	    S rS	 r	 Nf = f)2a  A powerful, extensible, and easy-to-use option parser.

By Greg Ward <gward@python.net>

Originally distributed as Optik.

For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).

Simple usage example:

   from optparse import OptionParser

   parser = OptionParser()
   parser.add_option("-f", "--file", dest="filename",
                     help="write report to FILE", metavar="FILE")
   parser.add_option("-q", "--quiet",
                     action="store_false", dest="verbose", default=True,
                     help="don't print status messages to stdout")

   (options, args) = parser.parse_args()
z1.5.3)Optionmake_optionSUPPRESS_HELPSUPPRESS_USAGEValuesOptionContainerOptionGroupOptionParserHelpFormatterIndentedHelpFormatterTitledHelpFormatterOptParseErrorOptionErrorOptionConflictErrorOptionValueErrorBadOptionErrorcheck_choicea"  
Copyright (c) 2001-2006 Gregory P. Ward.  All rights reserved.
Copyright (c) 2002-2006 Python Software Foundation.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

  * Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

  * Neither the name of the author nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    Nc                 L    SU R                   R                  [        U 5      U 4-  $ )Nz<%s at 0x%x: %s>)	__class____name__idselfs    /usr/lib/python3.13/optparse.py_reprr   O   s"    !8!8"T(D III    )gettextngettextc                     U $ N )messages    r   r   r   \   s    r   c                     US:X  a  U $ U$ N   r!   )singularpluralns      r   r   r   _   s    6Or   c                        \ rS rSrS rS rSrg)r   g   c                     Xl         g r    msgr   r-   s     r   __init__OptParseError.__init__h   s    r   c                     U R                   $ r    r,   r   s    r   __str__OptParseError.__str__k   s    xxr   r,   N)r   
__module____qualname____firstlineno__r/   r2   __static_attributes__r!   r   r   r   r   g   s    r   r   c                   $    \ rS rSrSrS rS rSrg)r   o   zQ
Raised if an Option instance is created with invalid or
inconsistent arguments.
c                 0    Xl         [        U5      U l        g r    )r-   str	option_id)r   r-   options      r   r/   OptionError.__init__u   s    Vr   c                 x    U R                   (       a  SU R                   < SU R                  < 3$ U R                  $ )Nzoption z: )r<   r-   r   s    r   r2   OptionError.__str__y   s'    >>>&*nndhh??88Or   )r-   r<   Nr   r4   r5   r6   __doc__r/   r2   r7   r!   r   r   r   r   o   s    
%r   r   c                       \ rS rSrSrSrg)r      z=
Raised if conflicting options are added to an OptionParser.
r!   Nr   r4   r5   r6   rB   r7   r!   r   r   r   r      s    r   r   c                       \ rS rSrSrSrg)r      zG
Raised if an invalid option value is encountered on the command
line.
r!   NrE   r!   r   r   r   r      s    r   r   c                   $    \ rS rSrSrS rS rSrg)r      z:
Raised if an invalid option is seen on the command line.
c                     Xl         g r    opt_strr   rL   s     r   r/   BadOptionError.__init__   s    r   c                 2    [        S5      U R                  -  $ )Nzno such option: %s)_rL   r   s    r   r2   BadOptionError.__str__   s    %&55r   rK   NrA   r!   r   r   r   r      s    6r   r   c                   $    \ rS rSrSrS rS rSrg)AmbiguousOptionError   z<
Raised if an ambiguous option is seen on the command line.
c                 :    [         R                  X5        X l        g r    )r   r/   possibilities)r   rL   rV   s      r   r/   AmbiguousOptionError.__init__   s    .*r   c                 h    [        S5      U R                  SR                  U R                  5      4-  $ )Nzambiguous option: %s (%s?), )rP   rL   joinrV   r   s    r   r2   AmbiguousOptionError.__str__   s2    ./<<4+=+=!>?@ 	Ar   )rV   NrA   r!   r   r   rS   rS      s    +Ar   rS   c                   v    \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rSrg)r
      a5  
Abstract base class for formatting option help.  OptionParser
instances should use one of the HelpFormatter subclasses for
formatting help; by default IndentedHelpFormatter is used.

Instance attributes:
  parser : OptionParser
    the controlling OptionParser instance
  indent_increment : int
    the number of columns to indent per nesting level
  max_help_position : int
    the maximum starting column for option help text
  help_position : int
    the calculated starting column for option help text;
    initially the same as the maximum
  width : int
    total number of columns for output (pass None to constructor for
    this value to be taken from the $COLUMNS environment variable)
  level : int
    current indentation level
  current_indent : int
    current indentation level (in columns)
  help_width : int
    number of columns available for option help text (calculated)
  default_tag : str
    text to replace with each option's default value, "%default"
    by default.  Set to false value to disable default value expansion.
  option_strings : { Option : str }
    maps Option instances to the snippet of help text explaining
    the syntax of that option, e.g. "-h, --help" or
    "-fFILE, --file=FILE"
  _short_opt_fmt : str
    format string controlling how short options with values are
    printed in help text.  Must be either "%s%s" ("-fFILE") or
    "%s %s" ("-f FILE"), because those are the two syntaxes that
    Optik supports.
  _long_opt_fmt : str
    similar but for long options; must be either "%s %s" ("--file FILE")
    or "%s=%s" ("--file=FILE").
nonec                 b   S U l         Xl        Uc"   [        [        R                  S   5      nUS-  nX0l        [        U[        US-
  US-  5      5      =U l
        U l        SU l        SU l        S U l        X@l        SU l        0 U l        SU l        SU l        g ! [
        [        4 a    Sn Nf = f)	NCOLUMNSP         r   z%defaultz%s %sz%s=%s)parserindent_incrementintosenvironKeyError
ValueErrorwidthminmaxhelp_positionmax_help_positioncurrent_indentlevel
help_widthshort_firstdefault_tagoption_strings_short_opt_fmt_long_opt_fmtr   re   ro   rk   rs   s        r   r/   HelpFormatter.__init__   s    
  0=BJJy12 QJE
%s52:7G!7K'LM	NT3
&% %$ j) s   B B.-B.c                     Xl         g r    )rd   r   rd   s     r   
set_parserHelpFormatter.set_parser   s    r   c                 F    US;  a  [        SU-  5      eSU-   S-   U l        g )N)  z/invalid metavar delimiter for short options: %r%s)rj   rv   r   delims     r   set_short_opt_delimiter%HelpFormatter.set_short_opt_delimiter   s2    	!AEIK K"UlT1r   c                 F    US;  a  [        SU-  5      eSU-   S-   U l        g )N)=r   z.invalid metavar delimiter for long options: %rr   )rj   rw   r   s     r   set_long_opt_delimiter$HelpFormatter.set_long_opt_delimiter   s2    
"@5HJ J!E\D0r   c                 l    U =R                   U R                  -  sl         U =R                  S-  sl        g r$   rp   re   rq   r   s    r   indentHelpFormatter.indent   s&    t444

a
r   c                     U =R                   U R                  -  sl         U R                   S:  d   S5       eU =R                  S-  sl        g )Nr   zIndent decreased below 0.r%   r   r   s    r   dedentHelpFormatter.dedent   s@    t444""a'D)DD'

a
r   c                     [        S5      eNzsubclasses must implementNotImplementedErrorr   usages     r   format_usageHelpFormatter.format_usage       !"=>>r   c                     [        S5      er   r   r   headings     r   format_headingHelpFormatter.format_heading  r   r   c                     [        U R                  U R                  -
  S5      nSU R                  -  n[        R                  " UUUUS9$ )zi
Format a paragraph of free-form text for inclusion in the
help output at the current indentation level.
   r   )initial_indentsubsequent_indent)rm   rk   rp   textwrapfill)r   text
text_widthr   s       r   _format_textHelpFormatter._format_text  sK    
 d&9&992>
T(((}}T',2/57 	7r   c                 :    U(       a  U R                  U5      S-   $ gN
r   r   r   descriptions     r   format_description HelpFormatter.format_description  s    $$[1D88r   c                 @    U(       a  SU R                  U5      -   S-   $ gr   r   )r   epilogs     r   format_epilogHelpFormatter.format_epilog  s#    $++F33d::r   c                 B   U R                   b  U R                  (       d  UR                  $ U R                   R                  R	                  UR
                  5      nU[        L d  Uc  U R                  nUR                  R                  U R                  [        U5      5      $ r    )
rd   rt   helpdefaultsgetdest
NO_DEFAULTNO_DEFAULT_VALUEreplacer;   )r   r=   default_values      r   expand_defaultHelpFormatter.expand_default  sv    ;;d&6&6;;,,00=J&-*? 11M{{""4#3#3S5GHHr   c           	         / nU R                   U   nU R                  U R                  -
  S-
  n[        U5      U:  a  SU R                  SU4-  nU R                  nOSU R                  SXC4-  nSnUR	                  U5        UR
                  (       a  U R                  U5      n[        R                  " X`R                  5      nUR	                  SUSUS   4-  5        UR                  USS   Vs/ s H  nSU R                  SU4-  PM     sn5        OUS   S:w  a  UR	                  S5        SR                  U5      $ s  snf )	Nrb   z%*s%s
r   z	%*s%-*s  r   r%   r   )ru   rn   rp   lenappendr   r   r   wraprr   extendrZ   )	r   r=   resultopts	opt_widthindent_first	help_text
help_lineslines	            r   format_optionHelpFormatter.format_option(  s9    ""6*&&)<)<<q@	t9y  3 3R>>D--L$"5"5r9!KKDLd;;++F3I!y//BJMM)|RA&GGHMM'1!"~7'5t %(:(:B'EE'57 8"XMM$wwv	7s   /D>c                    U R                  5         SnUR                   HD  nU R                  U5      nX@R                  U'   [	        U[        U5      U R                  -   5      nMF     U R                  5         UR                   HW  nUR                   HD  nU R                  U5      nX@R                  U'   [	        U[        U5      U R                  -   5      nMF     MY     U R                  5         U R                  5         [        US-   U R                  5      U l        [	        U R                  U R                  -
  S5      U l        g )Nr   rb   r   )r   option_listformat_option_stringsru   rm   r   rp   option_groupsr   rl   ro   rn   rk   rr   )r   rd   max_lenoptstringsgroups         r   store_option_strings"HelpFormatter.store_option_stringsK  s   %%C005G'.$'3w<$2E2E#EFG & 	))E((44S9+2##C(gs7|d6I6I'IJ ) *
 	 1d.D.DEdjj4+=+==rBr   c                    UR                  5       (       a  UR                  =(       d    UR                  R                  5       nUR                   Vs/ s H  nU R
                  X24-  PM     nnUR                   Vs/ s H  nU R                  XR4-  PM     nnOUR                  nUR                  nU R                  (       a  XF-   nOXd-   nSR                  U5      $ s  snf s  snf )z@Return a comma-separated list of option strings & metavariables.rY   )
takes_valuemetavarr   upper_short_optsrv   
_long_optsrw   rs   rZ   )r   r=   r   sopt
short_optslopt	long_optsr   s           r   r   #HelpFormatter.format_option_strings]  s    nn;(9(9(;G&,&8&8:&8d --?&8  : &,%6%68%6T ++to=%6  8I  ++J))I)D)Dyy:8s   C;C )rw   rv   rp   rt   rn   rr   re   rq   ro   ru   rd   rs   rk   N)r   r4   r5   r6   rB   r   r/   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   r!   r   r   r
   r
      s^    'R %221
??
7I!FC$r   r
   c                   6    \ rS rSrSr    SS jrS rS rSrg)	r   ip  z.Format help with indented section bodies.
    Nc                 2    [         R                  XX#U5        g r    r
   r/   rx   s        r   r/   IndentedHelpFormatter.__init__t      
 	$5k	Kr   c                     [        S5      U-  $ )Nz
Usage: %s
)rP   r   s     r   r   "IndentedHelpFormatter.format_usage|  s    %''r   c                 &    SU R                   SU4-  $ )Nz%*s%s:
r   )rp   r   s     r   r   $IndentedHelpFormatter.format_heading  s    T00"g>>>r   r!   )rb      Nr%   	r   r4   r5   r6   rB   r/   r   r   r7   r!   r   r   r   r   p  s%     #$#%	K(?r   r   c                   6    \ rS rSrSr    SS jrS rS rSrg)	r   i  z1Format help with underlined section headers.
    Nc                 2    [         R                  XX#U5        g r    r   rx   s        r   r/   TitledHelpFormatter.__init__  r   r   c                 F    U R                  [        S5      5      < SU< S3$ )NUsagez  r   )r   rP   r   s     r   r    TitledHelpFormatter.format_usage  s    !007<eDDr   c                 H    U< SSU R                      [        U5      -  < S3$ )Nr   z=-)rq   r   r   s     r   r   "TitledHelpFormatter.format_heading  s    $d4::&6W&EFFr   r!   )r   r   Nr   r   r!   r   r   r   r     s'     #$#%	KEGr   r   c                     U S S R                  5       S:X  a  SnO6U S S R                  5       S:X  a  SnU SS  =(       d    Sn OU S S S:X  a  SnOSnU" X5      $ )	Nrb   0x   0b0r%      
   )lower)valtyperadixs      r   
_parse_numr    se    
2Aw}}$	RaD	 !"gn	RaCr   c                 "    [        U [        5      $ r    )r  rf   )r   s    r   
_parse_intr    s    c3r   integerzfloating-pointcomplex)rf   longfloatr  c                     [         U R                     u  p4 U" U5      $ ! [         a    [        [	        S5      XU4-  5      ef = f)Nzoption %s: invalid %s value: %r)_builtin_cvtr   rj   r   rP   )r=   r   valuecvtwhats        r   check_builtinr    sU    v{{+KSG5z G/0Cu3EEG 	GGs	    $Ac                     X R                   ;   a  U$ SR                  [        [        U R                   5      5      n[	        [        S5      XU4-  5      e)NrY   z.option %s: invalid choice: %r (choose from %s))choicesrZ   mapreprr   rP   )r=   r   r  r  s       r   r   r     sM    ))Cfnn56>?7#$% 	%r   )NODEFAULTc                       \ rS rSrSr/ SQrSrSrSrSr	Sr
S	r\\\\\S
.rSrS rS rS rS rS rS rS rS rS rS rS r\\\\\\\/rS r\rS rS rS r S r!S r"S r#Sr$g)r   i  a2  
Instance attributes:
  _short_opts : [string]
  _long_opts : [string]

  action : string
  type : string
  dest : string
  default : any
  nargs : int
  const : any
  choices : [string]
  callback : function
  callback_args : (any*)
  callback_kwargs : { string : any }
  help : string
  metavar : string
)actionr   r   defaultnargsconstr  callbackcallback_argscallback_kwargsr   r   )
storestore_const
store_truestore_falser   append_constcountr  r   version)r  r  r  r   r   r!  r"  )r  r   r  )r  r   )r  r!  )stringrf   r  r  r  choice)rf   r  r  r  r%  Nc                     / U l         / U l        U R                  U5      nU R                  U5        U R	                  U5        U R
                   H  nU" U 5        M     g r    )r   r   _check_opt_strings_set_opt_strings
_set_attrsCHECK_METHODS)r   r   attrscheckers       r   r/   Option.__init__4  sX     &&t,d# 	 ))GDM *r   c                 h    U Vs/ s H  o"(       d  M  UPM     nnU(       d  [        S5      eU$ s  snf )Nz+at least one option string must be supplied)	TypeErrorr   r   r   s      r   r'  Option._check_opt_stringsG  s3      $+tst+IJJ ,s   
//c                 d   U H  n[        U5      S:  a  [        SU-  U 5      e[        U5      S:X  a>  US   S:X  a	  US   S:w  d  [        SU-  U 5      eU R                  R                  U5        Mn  USS S:X  a	  US   S:w  d  [        SU-  U 5      eU R                  R                  U5        M     g )	Nrb   z>invalid option string %r: must be at least two characters longr   -r%   zMinvalid short option string %r: must be of the form -x, (x any non-dash char)--zGinvalid long option string %r: must start with --, followed by non-dash)r   r   r   r   r   r0  s      r   r(  Option._set_opt_stringsP  s    C3x!|!;=@ABFH H SQA##a&C-%HJMN    '',AaD(SVs]%CEHI  &&s+% r   c                    U R                    H>  nX!;   a  [        XX   5        X	 M  US:X  a  [        X[        5        M2  [        XS 5        M@     U(       a7  [        UR	                  5       5      n[        SSR                  U5      -  U 5      eg )Nr  zinvalid keyword arguments: %srY   )ATTRSsetattrr   sortedkeysr   rZ   )r   r+  attrs      r   r)  Option._set_attrse  s}    JJD}EK0K9$D
3D-  5::<(E/$))E2BB  r   c                     U R                   c  SU l         g U R                   U R                  ;  a  [        SU R                   -  U 5      eg )Nr  zinvalid action: %r)r  ACTIONSr   r   s    r   _check_actionOption._check_actionx  s?    ;;!DK[[,2T[[@$GG -r   c                    U R                   c8  U R                  U R                  ;   a  U R                  b  SU l         g SU l         g g [	        U R                   [         5      (       a  U R                   R
                  U l         U R                   S:X  a  SU l         U R                   U R                  ;  a  [        SU R                   -  U 5      eU R                  U R                  ;  a  [        SU R                  -  U 5      eg )Nr%  r$  r;   zinvalid option type: %rz$must not supply a type for action %r)	r   r  ALWAYS_TYPED_ACTIONSr  
isinstancer   TYPESr   TYPED_ACTIONSr   s    r   _check_typeOption._check_type~  s    99{{d777<<+ (DI !)DI 8 $))T** II..	yyE!$	yy

*!";dii"GNN{{$"4"44!:T[[H$P P 5r   c                 h   U R                   S:X  a|  U R                  c  [        SU 5      e[        U R                  [        [
        45      (       d=  [        S[        [        U R                  5      5      R                  S5      S   -  U 5      eg U R                  b  [        SU R                   -  U 5      eg )Nr%  z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)'r%   z#must not supply choices for type %r)r   r  r   rC  tuplelistr;   splitr   s    r   _check_choiceOption._check_choice  s    99 ||#!EtM Mudm<<!G$t||,-33C8;<=AC C = \\%5		A4I I &r   c                 ,   U R                   U R                  ;   =(       d    U R                  S LnU R                  cY  U(       aQ  U R                  (       a(  U R                  S   SS  R                  SS5      U l        g U R                  S   S   U l        g g g )Nr   rb   r3  rP   r%   )r  STORE_ACTIONSr   r   r   r   r   )r   r   s     r   _check_destOption._check_dest  s     {{d&8&88 -yy, 	99  OOA.qr2::3D	 ,,Q/2	 "-r   c                     U R                   U R                  ;  a'  U R                  b  [        SU R                   -  U 5      eg g )Nz*'const' must not be supplied for action %r)r  CONST_ACTIONSr  r   r   s    r   _check_constOption._check_const  sB    ;;d000TZZ5K<t{{J  6L0r   c                     U R                   U R                  ;   a  U R                  c  SU l        g g U R                  b  [        SU R                   -  U 5      eg )Nr%   z*'nargs' must not be supplied for action %r)r  rE  r  r   r   s    r   _check_nargsOption._check_nargs  sU    ;;$,,,zz!
 "ZZ#<t{{J  $r   c                 R   U R                   S:X  a  [        U R                  5      (       d  [        SU R                  -  U 5      eU R                  b8  [        U R                  [        5      (       d  [        SU R                  -  U 5      eU R                  b9  [        U R                  [        5      (       d  [        SU R                  -  U 5      eg g U R                  b  [        SU R                  -  U 5      eU R                  b  [        SU 5      eU R                  b  [        SU 5      eg )Nr  zcallback not callable: %rz3callback_args, if supplied, must be a tuple: not %rz4callback_kwargs, if supplied, must be a dict: not %rz.callback supplied (%r) for non-callback optionz.callback_args supplied for non-callback optionz0callback_kwargs supplied for non-callback option)	r  callabler  r   r  rC  rJ  r  dictr   s    r   _check_callbackOption._check_callback  s8   ;;*$DMM**!/$--?G G"".t11599!I(()*.0 0 $$0t33T::!J**+,02 2 ; 1 }}(!Dmm$%)+ + !!-!DdL L##/!FN N 0r   c                 R    SR                  U R                  U R                  -   5      $ )N/)rZ   r   r   r   s    r   r2   Option.__str__  s     xx((4??:;;r   c                     U R                   S L$ r    )r   r   s    r   r   Option.takes_value  s    yy$$r   c                 `    U R                   (       a  U R                   S   $ U R                  S   $ Nr   )r   r   r   s    r   get_opt_stringOption.get_opt_string  s)    ????1%%##A&&r   c                 h    U R                   R                  U R                  5      nUc  U$ U" XU5      $ r    )TYPE_CHECKERr   r   )r   r   r  r,  s       r   check_valueOption.check_value  s3    ##''		2?L4e,,r   c           	          UbK  U R                   S:X  a  U R                  X5      $ [        U Vs/ s H  o0R                  X5      PM     sn5      $ g s  snf r$   )r  rj  rJ  )r   r   r  vs       r   convert_valueOption.convert_value   sR    zzQ''33F1..s6FGG	  Gs   Ac                 t    U R                  X5      nU R                  U R                  U R                  XX45      $ r    )rn  take_actionr  r   )r   r   r  valuesrd   s        r   processOption.process  s<     ""3.
 KKC@ 	@r   c                 
   US:X  a  [        XRU5        gUS:X  a  [        XRU R                  5        gUS:X  a  [        XRS5        gUS:X  a  [        XRS5        gUS:X  a"  UR                  U/ 5      R                  U5        gUS:X  a,  UR                  U/ 5      R                  U R                  5        gUS	:X  a   [        XRUR                  US
5      S-   5        gUS:X  aB  U R                  =(       d    SnU R
                  =(       d    0 nU R                  " XXF/UQ70 UD6  gUS:X  a!  UR                  5         UR                  5         gUS:X  a!  UR                  5         UR                  5         g[        SU R                  -  5      e)Nr  r  r  Tr   Fr   r!  r"  r   r%   r  r!   r   r#  zunknown action %r)r8  r  ensure_valuer   r  r  r  
print_helpexitprint_versionrj   r  )	r   r  r   r   r  rr  rd   argskwargss	            r   rq  Option.take_action  s   WF%(4 3 }$F$**-0 / |#F$', + }$F%(( ' xb)007$ # ~%b)00<   wF&"5"5dA">"BC  z!%%+D))/RFMM$UDTDVD  vKKM  y   "KKM  04;;>??r   )r   r   r  r   r  r   )%r   r4   r5   r6   rB   r7  r>  rP  rE  rB  rT  rD  r  r   ri  r*  r/   r'  r(  r)  r?  rF  rM  rQ  rU  rX  r]  r2   r   __repr__r   rf  rj  rn  rs  rq  r7   r!   r   r   r   r     s    *E	GM!M&%M
 DE$ !. - - - ,	L  M
&,*&HP0I3N8 # " !!$&M< H%'-H
@r   r   SUPPRESSHELPSUPPRESSUSAGEc                   Z    \ rS rSrSS jrS r\rS rS r	S r
S rSS	 jrSS
 jrS rSrg)r   i7  Nc                 ^    U(       a&  UR                  5        H  u  p#[        XU5        M     g g r    )itemsr8  )r   r   r;  r   s       r   r/   Values.__init__9  s'    '~~/C(  0 r   c                 ,    [        U R                  5      $ r    )r;   __dict__r   s    r   r2   Values.__str__>  s    4==!!r   c                     [        U[        5      (       a  U R                  UR                  :H  $ [        U[        5      (       a  U R                  U:H  $ [        $ r    )rC  r   r  r\  NotImplemented)r   others     r   __eq__Values.__eq__C  sD    eV$$==ENN22t$$==E))!!r   c                 `    [        U 5       H  nX!;   d  M
  X   nUc  M  [        XU5        M!     g)z
Update the option values from an arbitrary dictionary, but only
use keys from dict that already have a corresponding attribute
in self.  Any keys in dict without a corresponding attribute
are silently ignored.
N)dirr8  )r   r\  r;  dvals       r   _update_carefulValues._update_carefulK  s.     ID|z#D-	 r   c                 :    U R                   R                  U5        g)z
Update the option values from an arbitrary dictionary,
using all keys from the dictionary regardless of whether
they have a corresponding attribute in self or not.
N)r  update)r   r\  s     r   _update_looseValues._update_looseX  s     	T"r   c                 ~    US:X  a  U R                  U5        g US:X  a  U R                  U5        g [        SU-  5      e)Ncarefulloosezinvalid update mode: %r)r  r  rj   )r   r\  modes      r   _updateValues._update`  s>    9  &W_t$6=>>r   c                 v    [        U5        [        R                  U   nU R                  [	        U5      U5        g r    )
__import__sysmodulesr  vars)r   modnamer  mods       r   read_moduleValues.read_moduleh  s*    7kk'"T#Y%r   c                 p    0 n[        [        U5      R                  5       U5        U R                  X25        g r    )execopenreadr  )r   filenamer  r  s       r   	read_fileValues.read_filem  s*    T(^  "D)T r   c                 h    [        X5      (       a  [        X5      c  [        XU5        [        X5      $ r    )hasattrgetattrr8  )r   r;  r  s      r   rv  Values.ensure_valuer  s,    t""gd&9&AD&t""r   r!   r    )r  )r   r4   r5   r6   r/   r2   r   r}  r  r  r  r  r  r  rv  r7   r!   r   r   r   r   7  s6    )
" H".#?&
!
#r   r   c                   x    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rSrg)r   ix  a2  
Abstract base class.

Class attributes:
  standard_option_list : [Option]
    list of standard options that will be accepted by all instances
    of this parser class (intended to be overridden by subclasses).

Instance attributes:
  option_list : [Option]
    the list of Option objects contained by this OptionContainer
  _short_opt : { string : Option }
    dictionary mapping short option strings, eg. "-f" or "-X",
    to the Option instances that implement them.  If an Option
    has multiple short option strings, it will appear in this
    dictionary multiple times. [1]
  _long_opt : { string : Option }
    dictionary mapping long option strings, eg. "--file" or
    "--exclude", to the Option instances that implement them.
    Again, a given Option can occur multiple times in this
    dictionary. [1]
  defaults : { string : any }
    dictionary mapping option destination names to default
    values for each destination [1]

[1] These mappings are common to (shared by) all components of the
    controlling OptionParser, where they are initially created.

c                 t    U R                  5         Xl        U R                  U5        U R                  U5        g r    )_create_option_listoption_classset_conflict_handlerset_description)r   r  conflict_handlerr   s       r   r/   OptionContainer.__init__  s3    
 	  "(!!"23[)r   c                 .    0 U l         0 U l        0 U l        g r    
_short_opt	_long_optr   r   s    r   _create_option_mappings'OptionContainer._create_option_mappings  s     r   c                 j    UR                   U l         UR                  U l        UR                  U l        g r    r  r{   s     r   _share_option_mappings&OptionContainer._share_option_mappings  s)     !++))r   c                 8    US;  a  [        SU-  5      eXl        g )N)errorresolvez$invalid conflict_resolution value %r)rj   r  )r   handlers     r   r  $OptionContainer.set_conflict_handler  s"    ..CgMNN 'r   c                     Xl         g r    r   r   s     r   r  OptionContainer.set_description  s    &r   c                     U R                   $ r    r  r   s    r   get_descriptionOptionContainer.get_description  s    r   c                     U ? U ?U ?gzsee OptionParser.destroy().Nr  r   s    r   destroyOptionContainer.destroy  s    ONMr   c           
      >   / nUR                    H3  nX0R                  ;   d  M  UR                  X0R                  U   45        M5     UR                   H3  nX0R                  ;   d  M  UR                  X0R                  U   45        M5     U(       Ga  U R
                  nUS:X  a1  [        SSR                  U Vs/ s H  oUS   PM	     sn5      -  U5      eUS:X  a  U H  u  p6UR                  S5      (       a)  UR                  R                  U5        U R                  U	 O(UR                   R                  U5        U R                  U	 UR                   (       a  M  UR                  (       a  M  UR                  R                  R                  U5        M     g g g s  snf )Nr  z conflicting option string(s): %srY   r   r  r4  )r   r  r   r   r  r  r   rZ   
startswithremove	containerr   )r   r=   conflict_optsr   r  coc_options          r   _check_conflictOptionContainer._check_conflict  se   %%Coo%$$c??3+?%@A & $$Cnn$$$c>>#+>%?@ % ++G'!)6ii ?2A ?@A  I%'4OS~~d++ ++2237 NN3/ ,,33C8 OOC0$000H4G4G4G **66==hG (5 & 
 !@s   8Fc                    [        US   [        5      (       a  U R                  " U0 UD6nOJ[        U5      S:X  a0  U(       d)  US   n[        U[        5      (       d  [        SU-  5      eO[        S5      eU R                  U5        U R                  R                  U5        Xl	        UR                   H  nX0R                  U'   M     UR                   H  nX0R                  U'   M     UR                  bk  UR                  [         La%  UR                  U R"                  UR                  '   U$ UR                  U R"                  ;  a  SU R"                  UR                  '   U$ )z<add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
r   r%   znot an Option instance: %rinvalid argumentsN)rC  r;   r  r   r   r/  r  r   r   r  r   r  r   r  r   r  r   r   )r   rz  r{  r=   r   s        r   
add_optionOptionContainer.add_option  s/    d1gs##&&77FY!^F!WFff-- <v EFF . /00V$'%%C#)OOC  &$$C"(NN3 % ;;"~~Z/-3^^fkk*  DMM1-1fkk*r   c                 8    U H  nU R                  U5        M     g r    )r  )r   r   r=   s      r   add_optionsOptionContainer.add_options  s    !FOOF# "r   c                 |    U R                   R                  U5      =(       d    U R                  R                  U5      $ r    )r  r   r  rM   s     r   
get_optionOptionContainer.get_option  s0    ##G, ,""7+	-r   c                 H    XR                   ;   =(       d    XR                  ;   $ r    )r  r  rM   s     r   
has_optionOptionContainer.has_option  s     ??* *>>)	+r   c                 b   U R                   R                  U5      nUc  U R                  R                  U5      nUc  [        SU-  5      eUR                   H  nU R                   U	 M     UR
                   H  nU R                  U	 M     UR                  R                  R                  U5        g )Nzno such option %r)	r  r   r  rj   r   r   r  r   r  )r   rL   r=   r   s       r   remove_optionOptionContainer.remove_option  s    $$W->^^''0F>07:;;%%C$ &$$Cs# %$$++F3r   c                     U R                   (       d  g/ nU R                    H8  nUR                  [        Ld  M  UR                  UR	                  U5      5        M:     SR                  U5      $ Nr   )r   r   r   r   r   rZ   )r   	formatterr   r=   s       r   format_option_help"OptionContainer.format_option_help  sV    &&F;;-/i55f=> ' wwvr   c                 @    UR                  U R                  5       5      $ r    )r   r  r   r  s     r   r   "OptionContainer.format_description(  s    ++D,@,@,BCCr   c                     / nU R                   (       a   UR                  U R                  U5      5        U R                  (       a   UR                  U R	                  U5      5        SR                  U5      $ )Nr   )r   r   r   r   r  rZ   r   r  r   s      r   format_helpOptionContainer.format_help+  sV    MM$11)<=MM$11)<=yy  r   )r  r  r  r   r   r  N)r   r4   r5   r6   rB   r/   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r7   r!   r   r   r   r   x  sY    <	*((
' H6<$-+4 D!r   r   c                   6    \ rS rSrS	S jrS rS rS rS rSr	g)
r   i4  Nc                 r    Xl         [        R                  XR                  UR                  U5        X l        g r    )rd   r   r/   r  r  title)r   rd   r  r   s       r   r/   OptionGroup.__init__6  s.      %%v'>'>	M
r   c                 H    / U l         U R                  U R                  5        g r    )r   r  rd   r   s    r   r  OptionGroup._create_option_list<  s    ##DKK0r   c                     Xl         g r    )r  )r   r  s     r   	set_titleOptionGroup.set_title@  s    
r   c                 2    [         R                  U 5        U ?gr  )r   r  r   r   s    r   r  OptionGroup.destroyC  s    %r   c                     UR                  U R                  5      nUR                  5         U[        R	                  X5      -  nUR                  5         U$ r    )r   r  r   r   r  r   r  s      r   r  OptionGroup.format_helpJ  sH    ))$**5/--d>>r   )r   rd   r  r    )
r   r4   r5   r6   r/   r  r  r  r  r7   r!   r   r   r   r   4  s    1r   r   c            
       2   \ rS rSrSr/ rSS\SSSSSSS4
S jrS rS r	S	 r
S
 rS,S jrS rS rS rS rS rS rS rS rS rS rS rS rS-S jrS rS rS rS rS rS rS r S  r!S.S! jr"S" r#S# r$S/S$ jr%S% r&S/S& jr'S/S' jr(S( r)S/S) jr*S/S* jr+S+r,g)0r	   iR  a8  
Class attributes:
  standard_option_list : [Option]
    list of standard options that will be accepted by all instances
    of this parser class (intended to be overridden by subclasses).

Instance attributes:
  usage : string
    a usage string for your program.  Before it is displayed
    to the user, "%prog" will be expanded to the name of
    your program (self.prog or os.path.basename(sys.argv[0])).
  prog : string
    the name of the current program (to override
    os.path.basename(sys.argv[0])).
  description : string
    A paragraph of text giving a brief overview of your program.
    optparse reformats this paragraph to fit the current terminal
    width and prints it when the user requests help (after usage,
    but before the list of options).
  epilog : string
    paragraph of help text to print after option help

  option_groups : [OptionGroup]
    list of option groups in this parser (option groups are
    irrelevant for parsing the command-line, but very useful
    for generating help)

  allow_interspersed_args : bool = true
    if true, positional arguments may be interspersed with options.
    Assuming -a and -b each take a single argument, the command-line
      -ablah foo bar -bboo baz
    will be interpreted the same as
      -ablah -bboo -- foo bar baz
    If this flag were false, that command line would be interpreted as
      -ablah -- foo bar -bboo baz
    -- ie. we stop processing options as soon as we see the first
    non-option argument.  (This is the tradition followed by
    Python's getopt module, Perl's Getopt::Std, and other argument-
    parsing libraries, but it is generally annoying to users.)

  process_default_values : bool = true
    if true, option default values are processed similarly to option
    values from the command line: that is, they are passed to the
    type-checking function for the option's type (as long as the
    default value is a string).  (This really only matters if you
    have defined custom types; see SF bug #955889.)  Set it to false
    to restore the behaviour of Optik 1.4.1 and earlier.

  rargs : [string]
    the argument list currently being parsed.  Only set when
    parse_args() is active, and continually trimmed down as
    we consume arguments.  Mainly there for the benefit of
    callback options.
  largs : [string]
    the list of leftover arguments that we have skipped while
    parsing options.  If allow_interspersed_args is false, this
    list is always empty.
  values : Values
    the set of option values currently being accumulated.  Only
    set when parse_args() is active.  Also mainly for callbacks.

Because of the 'rargs', 'largs', and 'values' attributes,
OptionParser is not thread-safe.  If, for some perverse reason, you
need to parse command-line arguments simultaneously in different
threads, use different OptionParser instances.

Nr  Tc                 .   [         R                  XXV5        U R                  U5        Xl        X@l        SU l        SU l        Uc
  [        5       nXpl        U R                  R                  U 5        Xl
        U R                  UUS9  U R                  5         g )NT)add_help)r   r/   	set_usageprogr#  allow_interspersed_argsprocess_default_valuesr   r  r|   r   _populate_option_list_init_parsing_state)r   r   r   r  r#  r  r   r  add_help_optionr  r   s              r   r/   OptionParser.__init__  s     	   0	?u	'+$&*#-/I"!!$' 	"";,; 	# 	= 	  "r   c                     [         R                  U 5        U R                   H  nUR                  5         M     U ?U ?U ?g)z
Declare that you are done with this OptionParser.  This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly.  After calling destroy(), the
OptionParser is unusable.
N)r   r  r   r   r  )r   r   s     r   r  OptionParser.destroy  s<     	%''EMMO (Nr   c                 @    / U l         / U l        U R                  5         g r    )r   r   r  r   s    r   r   OptionParser._create_option_list  s    $$&r   c                 :    U R                  SSS[        S5      S9  g )Nz-hz--helpr   zshow this help message and exitr  r   r  rP   r   s    r   _add_help_optionOptionParser._add_help_option  s$    h%@A 	 	Cr   c                 8    U R                  SS[        S5      S9  g )Nz	--versionr#  z&show program's version number and exitr  r  r   s    r   _add_version_option OptionParser._add_version_option  s"    (GH 	 	Jr   c                     U R                   (       a  U R                  U R                   5        U(       a  U R                  U5        U R                  (       a  U R                  5         U(       a  U R	                  5         g g r    )standard_option_listr  r#  r  r  )r   r   r  s      r   r  "OptionParser._populate_option_list  sW    $$T667[)<<$$&!!# r   c                 .    S U l         S U l        S U l        g r    )rargslargsrr  r   s    r   r	   OptionParser._init_parsing_state  s    

r   c                     Uc  [        S5      U l        g U[        L a  S U l        g UR                  5       R	                  S5      (       a  USS  U l        g Xl        g )Nz%prog [options]zusage:    )rP   r   r   r   r  r   s     r   r  OptionParser.set_usage  sL    =,-DJn$DJ[[]%%i00qrDJJr   c                     SU l         g)zSet parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.TNr  r   s    r   enable_interspersed_args%OptionParser.enable_interspersed_args  s     (,$r   c                     SU l         g)zSet parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don't get confused.
FNr#  r   s    r   disable_interspersed_args&OptionParser.disable_interspersed_args  s     (-$r   c                     Xl         g r    )r  )r   rs  s     r   set_process_default_values'OptionParser.set_process_default_values  s    &-#r   c                      X R                   U'   g r    )r   )r   r   r  s      r   set_defaultOptionParser.set_default  s    #dr   c                 :    U R                   R                  U5        g r    )r   r  )r   r{  s     r   set_defaultsOptionParser.set_defaults  s    V$r   c                     U R                   S S  nU R                   H  nUR                  UR                   5        M      U$ r    )r   r   r   )r   optionsr   s      r   _get_all_optionsOptionParser._get_all_options  s9    ""1%''ENN5,,- (r   c                    U R                   (       d  [        U R                  5      $ U R                  R                  5       nU R	                  5        Hb  nUR                  UR                  5      n[        U[        5      (       d  M5  UR                  5       nUR                  XC5      XR                  '   Md     [        U5      $ r    )r  r   r   copyr4  r   r   rC  r;   rf  rj  )r   r   r=   r  rL   s        r   get_default_valuesOptionParser.get_default_values  s    **$--((==%%'++-Fll6;;/G'3'' //1(.(:(:7(L%	 . hr   c                 T   [        US   [        5      (       a  [        U /UQ70 UD6nOd[        U5      S:X  aJ  U(       dC  US   n[        U[        5      (       d  [	        SU-  5      eUR
                  U La  [        S5      eO[	        S5      eU R                  R                  U5        U$ )Nr   r%   znot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)r  )	rC  r;   r   r   r/  rd   rj   r   r   )r   rz  r{  r   s       r   add_option_groupOptionParser.add_option_group+  s    d1gs##6t6v6EY!^FGEe[11 AE IJJ||4' !EFF ( /00!!%(r   c                     U R                   R                  U5      =(       d    U R                  R                  U5      nU(       a  UR                  U La  UR                  $ g r    )r  r   r  r  )r   rL   r=   s      r   get_option_groupOptionParser.get_option_group;  sO    //%%g. ...$$W- 	f&&d2###r   c                 8    Uc  [         R                  SS  $ US S  $ r$   )r  argv)r   rz  s     r   	_get_argsOptionParser._get_argsE  s     <88AB<7Nr   c                 2   U R                  U5      nUc  U R                  5       nX0l        / =U l        nX l         U R                  XCU5      nXC-   nU R                  X!5      $ ! [        [        4 a$  nU R                  [        U5      5         SnANDSnAff = f)a  
parse_args(args : [string] = sys.argv[1:],
           values : Values = None)
-> (values : Values, args : [string])

Parse the command-line options found in 'args' (default:
sys.argv[1:]).  Any errors result in a call to 'error()', which
by default prints the usage message to stderr and calls
sys.exit() with an error message.  On success returns a pair
(values, args) where 'values' is a Values instance (with all
your option values) and 'args' is the list of arguments left
over after parsing options.
N)rB  r8  r  r  rr  _process_argsr   r   r  r;   check_values)r   rz  rr  r  r  stoperrs          r   
parse_argsOptionParser.parse_argsK  s     t$>,,.F 

U	!%%eF;D }  ..	  01 	!JJs3x  	!s   A" "B2BBc                     X4$ )as  
check_values(values : Values, args : [string])
-> (values : Values, args : [string])

Check that the supplied option values and leftover arguments are
valid.  Returns the option values and leftover arguments
(possibly adjusted, possibly completely new -- whatever you
like).  Default implementation just returns the passed-in
values; subclasses may override as desired.
r!   )r   rr  rz  s      r   rF  OptionParser.check_valuesr  s     ~r   c                    U(       a  US   nUS:X  a  US	 gUSS S:X  a  U R                  X#5        OQUSS S:X  a!  [        U5      S:  a  U R                  X#5        O'U R                  (       a  UR	                  U5        US	 OgU(       a  M  gg)a`  _process_args(largs : [string],
                 rargs : [string],
                 values : Values)

Process command-line arguments and populate 'values', consuming
options and arguments from 'rargs'.  If 'allow_interspersed_args' is
false, stop at the first non-option argument.  If true, accumulate any
interspersed non-option arguments in 'largs'.
r   r4  Nrb   r%   r3  )_process_long_optr   _process_short_optsr  r   )r   r  r  rr  args        r   rE  OptionParser._process_args  s     (C d{!HQqT!&&u5RaCCHqL ((7--S!!H' er   c                 ,    [        XR                  5      $ )z_match_long_opt(opt : string) -> string

Determine which long option string 'opt' matches, ie. which one
it is an unambiguous abbreviation for.  Raises BadOptionError if
'opt' doesn't unambiguously match any long option string.
)_match_abbrevr  )r   r   s     r   _match_long_optOptionParser._match_long_opt  s     S..11r   c                 <   UR                  S5      nSU;   a)  UR                  SS5      u  pEUR                  SU5        SnOUnSnU R                  U5      nU R                  U   nUR                  5       (       ai  UR                  n[        U5      U:  a"  U R                  [        SSU5      XHS.-  5        OSUS:X  a  UR                  S5      n	O;[        USU 5      n	USU2	 O'U(       a  U R                  [        S	5      U-  5        OS n	UR                  UW	X 5        g )
Nr   r   r%   TF.%(option)s option requires %(number)d argument/%(option)s option requires %(number)d argumentsr=   numberz%s option does not take a value)poprL  insertrT  r  r   r  r   r  r   rJ  rP   rs  )
r   r  rr  rP  r   next_arghad_explicit_valuer=   r  r  s
             r   rN  OptionParser._process_long_opt  s   iil #:!iiQ/OSLLH%!%C!&""3'$LLE5zE!

8DE ),=> ? !		!eAen-!E'NJJq:;cAB EsE60r   c                 6   UR                  S5      nSnSnUSS   H  nSU-   nU R                  R                  U5      nUS-  nU(       d  [        U5      eUR	                  5       (       a  U[        U5      :  a  UR                  SX5S  5        SnUR                  n	[        U5      U	:  a"  U R                  [        SSU	5      XyS.-  5        O.U	S:X  a  UR                  S5      n
O[        USU	 5      n
USU	2	 OS n
UR                  UW
X 5        U(       d  M    g    g )	Nr   Fr%   r3  TrW  rX  rY  )r[  r  r   r   r   r   r\  r  r  r   rJ  rs  )r   r  rr  rP  rG  ichr   r=   r  r  s              r   rO   OptionParser._process_short_opts  s!   iilab'B(C__((-FFA$S))!!## s3x<LLCG,Du:%JJxHI  -0!A B C aZ!IIaLE!%%.1Eag NN3v4tA r   c                     U R                   c0  [        R                  R                  [        R
                  S   5      $ U R                   $ re  )r  rg   pathbasenamer  rA  r   s    r   get_prog_nameOptionParser.get_prog_name  s3    9977##CHHQK0099r   c                 B    UR                  SU R                  5       5      $ )Nz%prog)r   rg  )r   ss     r   expand_prog_nameOptionParser.expand_prog_name  s    yy$"4"4"677r   c                 8    U R                  U R                  5      $ r    )rk  r   r   s    r   r  OptionParser.get_description  s    $$T%5%566r   c                 |    U(       a  [         R                  R                  U5        [         R                  " U5        g r    )r  stderrwriterx  )r   statusr-   s      r   rx  OptionParser.exit  s#    JJS!r   c                     U R                  [        R                  5        U R                  SU R	                  5       < SU< S35        g)zerror(msg : string)

Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
rb   z	: error: r   N)print_usager  rp  rx  rg  r.   s     r   r  OptionParser.error  s2     	$		!$*<*<*>DEr   c                     U R                   (       a4  U R                  R                  U R                  U R                   5      5      $ gr  )r   r  r   rk  r   s    r   	get_usageOptionParser.get_usage#  s7    ::>>..%%djj13 3 r   c                 X    U R                   (       a  [        U R                  5       US9  gg)a1  print_usage(file : file = stdout)

Print the usage message for the current program (self.usage) to
'file' (default stdout).  Any occurrence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]).  Does nothing if self.usage is empty
or not defined.
fileN)r   printrx  r   r|  s     r   ru  OptionParser.print_usage*  s!     ::$..". r   c                 \    U R                   (       a  U R                  U R                   5      $ gr  )r#  rk  r   s    r   get_versionOptionParser.get_version6  s!    <<((66r   c                 X    U R                   (       a  [        U R                  5       US9  gg)a  print_version(file : file = stdout)

Print the version message for this program (self.version) to
'file' (default stdout).  As with print_usage(), any occurrence
of "%prog" in self.version is replaced by the current program's
name.  Does nothing if self.version is empty or undefined.
r{  N)r#  r}  r  r~  s     r   ry  OptionParser.print_version<  s#     <<$""$40 r   c                    Uc  U R                   nUR                  U 5        / nUR                  UR                  [	        S5      5      5        UR                  5         U R                  (       a5  UR                  [        R                  X5      5        UR                  S5        U R                   H4  nUR                  UR                  U5      5        UR                  S5        M6     UR                  5         SR                  US S 5      $ )NOptionsr   r   r   )r  r   r   r   rP   r   r   r   r  r   r  r   rZ   )r   r  r   r   s       r   r  OptionParser.format_option_helpG  s    I&&t,i..q|<=MM/<<TMNMM$''EMM%++I67MM$ ( 	wwvcr{##r   c                 8    UR                  U R                  5      $ r    )r   r   r  s     r   r   OptionParser.format_epilogX  s    &&t{{33r   c                    Uc  U R                   n/ nU R                  (       a"  UR                  U R                  5       S-   5        U R                  (       a#  UR                  U R                  U5      S-   5        UR                  U R                  U5      5        UR                  U R                  U5      5        SR                  U5      $ r   )	r  r   r   rx  r   r   r  r   rZ   r  s      r   r  OptionParser.format_help[  s    I::MM$..*T12MM$11)<tCDd--i89d((34wwvr   c                 h    Uc  [         R                  nUR                  U R                  5       5        g)zprint_help(file : file = stdout)

Print an extended help message, listing all options and any
help text provided with them, to 'file' (default stdout).
N)r  stdoutrq  r  r~  s     r   rw  OptionParser.print_helpg  s'     <::D

4##%&r   )r  r   r  r  r   r   r  r  r  r   rr  r#  )T)NN)r   Nr    )-r   r4   r5   r6   rB   r  r   r/   r  r  r  r  r  r	  r  r$  r'  r*  r-  r0  r4  r8  r;  r>  rB  rI  rF  rE  rT  rN  rO  rg  rk  r  rx  r  rx  ru  r  ry  r  r   r  rw  r7   r!   r   r   r	   r	   R  s    BH  !$")!!%#D$'
C
J
$	,-.$% " %/Nf2"1H$R87
F
/	1$"4
'r   r	   c                    X;   a  U $ UR                  5        Vs/ s H  nUR                  U 5      (       d  M  UPM     nn[        U5      S:X  a  US   $ U(       d  [        U 5      eUR	                  5         [        X5      es  snf )z_match_abbrev(s : string, wordmap : {string : Option}) -> string

Return the string key in 'wordmap' for which 's' is an unambiguous
abbreviation.  If 's' is found to be ambiguous or doesn't match any of
'words', raise BadOptionError.
r%   r   )r:  r  r   r   sortrS   )rj  wordmapwordrV   s       r   rS  rS  t  s     	| +2,,. 0.$ OOA. . 0 }" ## ##  &q880s
   BB)'rB   __version____all____copyright__r  rg   r   r   r   r   ImportErrorrP   	Exceptionr   r   r   r   r   rS   r
   r   r   r  r  r  r  r
  r  r   r   r   r   r   r   r   r   r	   rS  r   r!   r   r   <module>r     sy  . $@  J	) Y =  ; 
 6m 6
AN 
AM M^?] ?&G= G&  %a	l3%q|4!1%5#67%q|47
G% 
n nf "#># >#By! y!x? <]'O ]'D9: m1  	s   C: :D	D	