AlkantarClanX12

Your IP : 18.188.91.223


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/optparse.cpython-36.opt-2.pyc

3


 \���@s�dZddddddddd	d
ddd
ddddgZdZddlZddlZddlZdd�ZyddlmZmZWn$e	k
r�dd�Zdd�ZYnXeZ
Gdd�de�ZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGd d�de�ZGd!d"�d"e�ZGd#d	�d	�ZGd$d
�d
e�ZGd%d�de�Zd&d'�Zd(d)�Zee
d*�fee
d*�fee
d+�fee
d,�fd-�Zd.d/�Zd0d�Zd=ZGd3d�d�Zd>Zd?ZGd7d�d�Z Gd8d�d�Z!Gd9d�de!�Z"Gd:d�de!�Z#d;d<�Z$eZ%dS)@z1.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.
�NcCsd|jjt|�|fS)Nz<%s at 0x%x: %s>)�	__class__�__name__�id)�self�r� /usr/lib64/python3.6/optparse.py�_reprOsr)�gettext�ngettextcCs|S)Nr)�messagerrrr\srcCs|dkr|S|S)N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�msg)rrrrr�__init__hszOptParseError.__init__cCs|jS)N)r)rrrr�__str__kszOptParseError.__str__N)r�
__module__�__qualname__r r!rrrrrgsc@seZdZdd�Zdd�ZdS)r
cCs||_t|�|_dS)N)r�str�	option_id)rr�optionrrrr uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r%r)rrrrr!yszOptionError.__str__N)rr"r#r r!rrrrr
osc@seZdZdS)rN)rr"r#rrrrrsc@seZdZdS)rN)rr"r#rrrrr�sc@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�opt_str)rr'rrrr �szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r')rrrrr!�szBadOptionError.__str__N)rr"r#r r!rrrrr�sc@seZdZdd�Zdd�ZdS)�AmbiguousOptionErrorcCstj||�||_dS)N)rr �
possibilities)rr'r*rrrr �szAmbiguousOptionError.__init__cCstd�|jdj|j�fS)Nzambiguous option: %s (%s?)z, )r(r'�joinr*)rrrrr!�szAmbiguousOptionError.__str__N)rr"r#r r!rrrrr)�sr)c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!r	ZnonecCs�d|_||_|dkrLyttjd�}Wnttfk
rBd}YnX|d8}||_t|t	|d|d��|_
|_d|_d|_
d|_||_d|_i|_d|_d|_dS)	NZCOLUMNS�P��rz%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)rr0r:r6r>rrrr �s$
 zHelpFormatter.__init__cCs
||_dS)N)r/)rr/rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N�� z/invalid metavar delimiter for short options: %rz%s)rDrE)r5rA)r�delimrrr�set_short_opt_delimiter�s
z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N�=rEz.invalid metavar delimiter for long options: %rz%s)rHrE)r5rB)rrFrrr�set_long_opt_delimiter�s
z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dS)Nr)r;r0r<)rrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dS)Nr)r;r0r<)rrrr�dedent�szHelpFormatter.dedentcCstd��dS)Nzsubclasses must implement)�NotImplementedError)r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dS)Nzsubclasses must implement)rL)r�headingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)N�rE)Zinitial_indentZsubsequent_indent)r8r6r;�textwrapZfill)r�textZ
text_widthrJrrr�_format_texts
zHelpFormatter._format_textcCs|r|j|�dSdSdS)N�
rD)rT)r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|j|�dSdSdS)NrUrD)rT)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsR|jdks|jr|jS|jjj|j�}|tks8|dkr>|j}|jj|jt	|��S)N)
r/r?�help�defaults�get�dest�
NO_DEFAULT�NO_DEFAULT_VALUE�replacer$)rr&Z
default_valuerrr�expand_defaultszHelpFormatter.expand_defaultcs�g}�j|}�j�jd}t|�|krBd�jd|f}�j}nd�jd||f}d}|j|�|jr��j|�}tj|�j	�}|jd|d|df�|j
�fdd�|dd�D��n|d
d	kr�|jd	�dj|�S)Nr-z%*s%s
rDz	%*s%-*s  rcsg|]}d�jd|f�qS)z%*s%s
rD)r9)�.0�line)rrr�
<listcomp>Esz/HelpFormatter.format_option.<locals>.<listcomp>rrU���)r@r9r;�len�appendrZrarRZwrapr=�extendr+)rr&�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesr)rr�
format_option(s$



zHelpFormatter.format_optioncCs�|j�d}x6|jD],}|j|�}||j|<t|t|�|j�}qW|j�xF|jD]<}x6|jD],}|j|�}||j|<t|t|�|j�}q`WqTW|j�|j�t	|d|j
�|_t|j|jd�|_
dS)Nrr-rQ)rJ�option_list�format_option_stringsr@r8rfr;�
option_groupsrKr7r:r9r6r=)rr/Zmax_len�optZstrings�grouprrr�store_option_stringsKs 



z"HelpFormatter.store_option_stringscst|j�rF|jp|jj����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}dj|�S)Ncsg|]}�j|�f�qSr)rA)rbZsopt)�metavarrrrrdasz7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rB)rbZlopt)rrrrrrdcsz, )�takes_valuerrr]�upper�_short_opts�
_long_optsr>r+)rr&Z
short_optsZ	long_optsrjr)rrrrrm]s

z#HelpFormatter.format_option_stringsN)rr"r#r_r rCrGrIrJrKrNrPrTrWrYrarkrqrmrrrrr	�s +
#c@s&eZdZddd�Zdd�Zd	d
�ZdS)r
r-�NrcCstj|||||�dS)N)r	r )rr0r:r6r>rrrr tszIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r()rrMrrrrN|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rD)r;)rrOrrrrPsz$IndentedHelpFormatter.format_heading)r-rwNr)rr"r#r rNrPrrrrr
ps
c@s&eZdZd
dd�Zdd�Zdd	�ZdS)rrrwNcCstj|||||�dS)N)r	r )rr0r:r6r>rrrr �szTitledHelpFormatter.__init__cCsd|jtd��|fS)Nz%s  %s
ZUsage)rPr()rrMrrrrN�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)r<rf)rrOrrrrP�sz"TitledHelpFormatter.format_heading)rrwNr)rr"r#r rNrPrrrrr�s
cCsh|dd�j�dkrd}nD|dd�j�dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr-Z0x�Z0b�0r��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�S)N)r�r1)r}rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r1�long�floatr�cCsFt|j\}}y||�Stk
r@ttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr~r5rr()r&ro�valueZcvtZwhatrrr�
check_builtin�sr�cCs:||jkr|Sdjtt|j��}ttd�|||f��dS)Nz, z.option %s: invalid choice: %r (choose from %s))�choicesr+�map�reprrr()r&ror�r�rrrr�s
�NO�DEFAULTc@s�eZdZddddddddd	d
ddgZdAZdBZdCZdDZdEZdFZ	e
e
e
e
ed�ZdZ
dd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZeeeeeeegZ
d3d4�ZeZd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dS)Gr�actionr~r]�default�nargs�constr��callback�
callback_args�callback_kwargsrZrr�store�store_const�
store_true�store_falserg�append_const�count�version�stringr1r�r�r��choice)r1r�r�r�r�NcOsFg|_g|_|j|�}|j|�|j|�x|jD]}||�q2WdS)N)rurv�_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rrj�attrs�checkerrrrr 4s


zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rbrorrrrdKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rrjrrrr�GszOption._check_opt_stringscCs�x�|D]�}t|�dkr&td||��qt|�dkrf|ddkoH|ddksXtd||��|jj|�q|dd�dko�|ddks�td||��|jj|�qWdS)	Nr-z>invalid option string %r: must be at least two characters longr�-rzMinvalid short option string %r: must be of the form -x, (x any non-dash char)z--zGinvalid long option string %r: must start with --, followed by non-dash)rfr
rurgrv)rrjrorrrr�Ps$
zOption._set_opt_stringscCszxP|jD]F}||kr,t||||�||=q|dkrBt||t�qt||d�qW|rvt|j��}tddj|�|��dS)Nr�zinvalid keyword arguments: %sz, )�ATTRS�setattrr^�sorted�keysr
r+)rr��attrrrrr�eszOption._set_attrscCs2|jdkrd|_n|j|jkr.td|j|��dS)Nr�zinvalid action: %r)r��ACTIONSr
)rrrr�
_check_actionxs
zOption._check_actioncCs�|jdkr0|j|jkr�|jdk	r(d|_q�d|_n^t|jt�rF|jj|_|jdkrVd|_|j|jkrrtd|j|��|j|jkr�td|j|��dS)Nr�r�r$zinvalid option type: %rz$must not supply a type for action %r)	r~r��ALWAYS_TYPED_ACTIONSr��
isinstancer�TYPESr
�
TYPED_ACTIONS)rrrr�_check_type~s



zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j��jd�d|��n|jdk	rntd|j|��dS)Nr�z/must supply a list of choices for type 'choice'z1choices must be a list of strings ('%s' supplied)�'rz#must not supply choices for type %r)r~r�r
r��tuple�listr$�split)rrrr�
_check_choice�s


 
zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd�jdd�|_n|jdd|_dS)Nrr-r�r(r)r��
STORE_ACTIONSr~r]rvr`ru)rrsrrr�_check_dest�s
zOption._check_destcCs*|j|jkr&|jdk	r&td|j|��dS)Nz*'const' must not be supplied for action %r)r��
CONST_ACTIONSr�r
)rrrr�_check_const�szOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nrz*'nargs' must not be supplied for action %r)r�r�r�r
)rrrr�_check_nargs�s

zOption._check_nargscCs�|jdkrvt|j�s$td|j|��|jdk	rLt|jt�rLtd|j|��|jdk	r�t|jt�r�td|j|��nB|jdk	r�td|j|��|jdk	r�td|��|jdk	r�td|��dS)Nr�zcallback 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�r�r�r��dict)rrrr�_check_callback�s0






zOption._check_callbackcCsdj|j|j�S)N�/)r+rurv)rrrrr!�szOption.__str__cCs
|jdk	S)N)r~)rrrrrs�szOption.takes_valuecCs|jr|jdS|jdSdS)Nr)rvru)rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|jj|j�}|dkr|S||||�SdS)N)�TYPE_CHECKERr\r~)rror�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr�j�|�St��fdd�|D��SdS)Nrcsg|]}�j�|��qSr)r�)rb�v)rorrrrdsz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rror�r)rorr�
convert_values
zOption.convert_valuecCs$|j||�}|j|j|j||||�S)N)r��take_actionr�r])rror��valuesr/rrr�processszOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|j|g�j|�n�|dkr�|j|g�j|j�n�|d	kr�t|||j|d
�d�n||dkr�|jp�f}|jp�i}|j||||f|�|�nF|d
k�r|j�|j�n*|dk�r(|j	�|j�nt
d|j��dS)Nr�r�r�Tr�Frgr�r�rrr�rZr�zunknown action %r)r�r��ensure_valuergr�r�r��
print_help�exit�
print_versionr5r�)	rr�r]ror�r�r/�args�kwargsrrrr�s4





zOption.take_action)
r�r�r�r�rgr�r�r�rZr�)r�r�r�r�rgr�r�)r�rgr�)r�rg)r�r�)r�r1r�r�r�r�)"rr"r#r�r�r�r�r�r�r�r�rr�r�r r�r�r�r�r�r�r�r�r�r�r!r�__repr__rsr�r�r�r�r�rrrrr�s�	
		ZSUPPRESSZHELPZUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs*|r&x |j�D]\}}t|||�qWdS)N)�itemsr�)rr[r�r}rrrr 9szValues.__init__cCs
t|j�S)N)r$�__dict__)rrrrr!>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdS)N)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs:x4t|�D](}||kr
||}|dk	r
t|||�q
WdS)N)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|jj|�dS)N)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|j|�n |dkr(|j|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r5)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|jt|�|�dS)N)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|�j�|�|j||�dS)N)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs0t||�st||�dkr&t|||�t||�S)N)�hasattr�getattrr�)rr�r�rrrr�rszValues.ensure_value)N)r�)r�)rr"r#r r!rr�r�r�r�r�r�r�r�rrrrr7s



c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"rcCs&|j�||_|j|�|j|�dS)N)�_create_option_list�option_class�set_conflict_handler�set_description)rr��conflict_handlerrVrrrr �s
zOptionContainer.__init__cCsi|_i|_i|_dS)N)�
_short_opt�	_long_optr[)rrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dS)N)r�r�r[)rr/rrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N�error�resolvez$invalid conflict_resolution value %r)r�r�)r5r�)r�handlerrrrr��sz$OptionContainer.set_conflict_handlercCs
||_dS)N)rV)rrVrrrr��szOptionContainer.set_descriptioncCs|jS)N)rV)rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dS)N)r�r�r[)rrrr�destroy�szOptionContainer.destroycCs�g}x,|jD]"}||jkr|j||j|f�qWx,|jD]"}||jkr:|j||j|f�q:W|r�|j}|dkr�tddjdd�|D��|��nh|dkr�x^|D]V\}}|jd�r�|jj	|�|j|=n|jj	|�|j|=|jp�|js�|j
jj	|�q�WdS)Nr�z conflicting option string(s): %sz, cSsg|]}|d�qS)rr)rb�corrrrd�sz3OptionContainer._check_conflict.<locals>.<listcomp>r�z--)rur�rgrvr�r�rr+�
startswith�remove�	containerrl)rr&Z
conflict_optsror�Zc_optionrrr�_check_conflict�s.



zOptionContainer._check_conflictcOs�t|dt�r|j||�}n:t|�dkrN|rN|d}t|t�sVtd|��ntd��|j|�|jj|�||_	x|j
D]}||j|<qzWx|jD]}||j
|<q�W|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)Nrrznot an Option instance: %rzinvalid arguments)r�r$r�rfrr�r�rlrgr�rur�rvr�r]r�r^r[)rr�r�r&rorrr�
add_option�s(



zOptionContainer.add_optioncCsx|D]}|j|�qWdS)N)r�)rrlr&rrr�add_optionss
zOptionContainer.add_optionscCs|jj|�p|jj|�S)N)r�r\r�)rr'rrr�
get_optionszOptionContainer.get_optioncCs||jkp||jkS)N)r�r�)rr'rrr�
has_options
zOptionContainer.has_optioncCsv|jj|�}|dkr |jj|�}|dkr4td|��x|jD]}|j|=q<Wx|jD]}|j|=qTW|jjj|�dS)Nzno such option %r)	r�r\r�r5rurvr�rlr�)rr'r&rorrr�
remove_optionszOptionContainer.remove_optioncCsB|js
dSg}x(|jD]}|jtk	r|j|j|��qWdj|�S)NrD)rlrZrrgrkr+)r�	formatterrir&rrr�format_option_helps
z"OptionContainer.format_option_helpcCs|j|j��S)N)rWr�)rrrrrrW(sz"OptionContainer.format_descriptioncCs:g}|jr|j|j|��|jr0|j|j|��dj|�S)NrU)rVrgrWrlrr+)rrrirrr�format_help+szOptionContainer.format_helpN)rr"r#r r�r�r�r�r�r�r�r�r�r�r�r�rrWrrrrrrxs  			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_tj||j|j|�||_dS)N)r/rr r�r��title)rr/rrVrrrr 6szOptionGroup.__init__cCsg|_|j|j�dS)N)rlr�r/)rrrrr�<szOptionGroup._create_option_listcCs
||_dS)N)r)rrrrr�	set_title@szOptionGroup.set_titlecCstj|�|`dS)N)rr�rl)rrrrr�Cs
zOptionGroup.destroycCs0|j|j�}|j�|tj||�7}|j�|S)N)rPrrJrrrK)rrrirrrrJs
zOptionGroup.format_help)N)rr"r#r r�rr�rrrrrr4s

c
@s^eZdZgZddedddddddf
dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dOdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdPd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�ZdQd;d<�Z d=d>�Z!d?d@�Z"dRdAdB�Z#dCdD�Z$dSdEdF�Z%dTdGdH�Z&dIdJ�Z'dUdKdL�Z(dVdMdN�Z)dS)WrNr�TcCsrtj||||�|j|�|	|_||_d|_d|_|dkr@t�}||_|jj	|�|
|_
|j||d�|j�dS)NT)�add_help)
rr �	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrCrX�_populate_option_list�_init_parsing_state)rrMrlr�r�r�rVrZadd_help_optionrrXrrrr �s
zOptionParser.__init__cCs2tj|�x|jD]}|j�qW|`|`|`dS)N)rr�rnrlr)rrprrrr��s
zOptionParser.destroycCsg|_g|_|j�dS)N)rlrnr�)rrrrr��sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helprZzshow this help message and exit)r�rZ)r�r()rrrr�_add_help_option�szOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exit)r�rZ)r�r()rrrr�_add_version_option�sz OptionParser._add_version_optioncCs>|jr|j|j�|r |j|�|jr.|j�|r:|j�dS)N)�standard_option_listr�r�r
r)rrlrrrrr
�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dS)N)�rargs�largsr�)rrrrr�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|j�jd�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r(rMrr|r�)rrMrrrr�szOptionParser.set_usagecCs
d|_dS)NT)r)rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)NF)r)rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dS)N)r	)rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dS)N)r[)rr]r�rrr�set_defaultszOptionParser.set_defaultcKs|jj|�dS)N)r[r�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs.|jdd�}x|jD]}|j|j�qW|S)N)rlrnrh)rZoptionsrprrr�_get_all_optionsszOptionParser._get_all_optionscCsd|jst|j�S|jj�}x@|j�D]4}|j|j�}t|t�r$|j	�}|j
||�||j<q$Wt|�S)N)r	rr[�copyrr\r]r�r$r�r�)rr[r&r�r'rrr�get_default_valuess


zOptionParser.get_default_valuescOs|t|dt�r t|f|�|�}nLt|�dkrd|rd|d}t|t�sPtd|��|j|k	rltd��ntd��|jj|�|S)Nrrznot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)zinvalid arguments)	r�r$rrfr�r/r5rnrg)rr�r�rprrr�add_option_group+s


zOptionParser.add_option_groupcCs0|jj|�p|jj|�}|r,|j|k	r,|jSdS)N)r�r\r�r�)rr'r&rrr�get_option_group;s
zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdS)Nr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argscCs�|j|�}|dkr|j�}||_g|_}||_y|j|||�}Wn4ttfk
rv}z|jt	|��WYdd}~XnX||}|j
||�S)N)rrrrr��
_process_argsrrr�r$�check_values)rr�r�rr�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fS)Nr)rr�r�rrrrrszOptionParser.check_valuescCs�x�|r�|d}|dkr |d=dS|dd�dkr>|j||�q|dd�dkrht|�dkrh|j||�q|jr�|j|�|d=qdSqWdS)Nrz--r-rr�)�_process_long_optrf�_process_short_optsrrg)rrrr��argrrrrs

zOptionParser._process_argscCst||j�S)N)�
_match_abbrevr�)rrorrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|jd�}d|kr4|jdd�\}}|jd|�d}n|}d}|j|�}|j|}|j�r�|j}t|�|kr�|jt	dd|�||d��q�|dkr�|jd�}	q�t
|d|��}	|d|�=n|r�|jtd	�|�nd}	|j||	||�dS)
NrrHrTFz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&�numberz%s option does not take a value)
�popr��insertr'r�rsr�rfr�rr�r(r�)
rrr�r%roZnext_argZhad_explicit_valuer&r�r�rrrr#�s0


zOptionParser._process_long_optcCs�|jd�}d}d}x�|dd�D]�}d|}|jj|�}|d7}|sLt|��|j�r�|t|�krx|jd||d��d}|j}	t|�|	kr�|jt	dd|	�||	d��q�|	dkr�|jd�}
q�t
|d|	��}
|d|	�=nd}
|j||
||�|r Pq WdS)	NrFrr�Tz.%(option)s option requires %(number)d argumentz/%(option)s option requires %(number)d arguments)r&r()r)r�r\rrsrfr*r�r�rr�r�)rrr�r%r �iZchror&r�r�rrrr$�s6
z OptionParser._process_short_optscCs&|jdkrtjjtjd�S|jSdS)Nr)rr2�path�basenamer�r)rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|jd|j��S)Nz%prog)r`r.)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|j|j�S)N)r0rV)rrrrr�szOptionParser.get_descriptionrcCs|rtjj|�tj|�dS)N)r��stderr�writer�)rZstatusrrrrr�szOptionParser.exitcCs(|jtj�|jdd|j�|f�dS)Nr-z%s: error: %s
)�print_usager�r1r�r.)rrrrrr�szOptionParser.errorcCs"|jr|jj|j|j��SdSdS)NrD)rMrrNr0)rrrr�	get_usage#szOptionParser.get_usagecCs|jrt|j�|d�dS)N)�file)rM�printr4)rr5rrrr3*s	zOptionParser.print_usagecCs|jr|j|j�SdSdS)NrD)r�r0)rrrr�get_version6szOptionParser.get_versioncCs|jrt|j�|d�dS)N)r5)r�r6r7)rr5rrrr�<szOptionParser.print_versioncCs�|dkr|j}|j|�g}|j|jtd���|j�|jrZ|jtj||��|jd�x(|j	D]}|j|j
|��|jd�qbW|j�dj|dd��S)NZOptionsrUrDrre)
rrqrgrPr(rJrlrrrnrrKr+)rrrirprrrrGs

zOptionParser.format_option_helpcCs|j|j�S)N)rYrX)rrrrrrYXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|j|j�d�|jrD|j|j|�d�|j|j|��|j|j|��dj|�S)NrUrD)	rrMrgr4rVrWrrYr+)rrrirrrr[szOptionParser.format_helpcCs |dkrtj}|j|j��dS)N)r��stdoutr2r)rr5rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)*rr"r#rrr r�r�rr
r
rrrrrrrrrrrrr"rrr'r#r$r.r0r�r�r�r4r3r7r�rrYrr�rrrrrRs^F

	

'
3	$)





csZ�|kr�S�fdd�|j�D�}t|�dkr6|dS|sDt���n|j�t�|��dS)Ncsg|]}|j��r|�qSr)r�)rbZword)r/rrrd�sz!_match_abbrev.<locals>.<listcomp>rr)r�rfr�sortr))r/Zwordmapr*r)r/rr&ts
r&)r�r�ZSUPPRESSHELPZ
SUPPRESSUSAGE)&�__version__�__all__Z
__copyright__r�r2rRrrr�ImportErrorr(�	Exceptionrr
rrrr)r	r
rr�r�r�r�r�r�rr^rrrrrrrr&rrrrr�<module>s| 


P



uA=&