Your IP : 18.227.46.202


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/optparse.cpython-38.opt-2.pyc

U

i�f���@s�dZddddddddd	d
ddd
ddddgZdZddlZddlZddlZdd�ZzddlmZmZWn$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�Zd1ZGd2d�d�Zd3Zd4ZGd5d�d�Z Gd6d�d�Z!Gd7d�de!�Z"Gd8d�de!�Z#d9d:�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�-/opt/alt/python38/lib64/python3.8/optparse.py�_reprOsr)�gettext�ngettextcCs|S�Nr)�messagerrrr\srcCs|dkr|S|S�N�r)ZsingularZplural�nrrrr_src@seZdZdd�Zdd�ZdS)rcCs
||_dSr��msg�rr#rrr�__init__hszOptParseError.__init__cCs|jSrr"rrrr�__str__kszOptParseError.__str__N�r�
__module__�__qualname__r%r&rrrrrgsc@seZdZdd�Zdd�ZdS)r
cCs||_t|�|_dSr)r#�str�	option_id)rr#�optionrrrr%uszOptionError.__init__cCs |jrd|j|jfS|jSdS)Nz
option %s: %s)r+r#rrrrr&yszOptionError.__str__Nr'rrrrr
osc@seZdZdS)rN�rr(r)rrrrrsc@seZdZdS)rNr-rrrrr�sc@seZdZdd�Zdd�ZdS)rcCs
||_dSr)�opt_str�rr.rrrr%�szBadOptionError.__init__cCstd�|jS)Nzno such option: %s)�_r.rrrrr&�szBadOptionError.__str__Nr'rrrrr�sc@seZdZdd�Zdd�ZdS)�AmbiguousOptionErrorcCst�||�||_dSr)rr%�
possibilities)rr.r2rrrr%�szAmbiguousOptionError.__init__cCstd�|jd�|j�fS)Nzambiguous option: %s (%s?)�, )r0r.�joinr2rrrrr&�s�zAmbiguousOptionError.__str__Nr'rrrrr1�sr1c@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	Znonec	Cs�d|_||_|dkrLzttjd�}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�rr9rCr?rGrrrr%�s&
�
zHelpFormatter.__init__cCs
||_dSr)r8�rr8rrr�
set_parser�szHelpFormatter.set_parsercCs&|dkrtd|��d|d|_dS)N)�� z/invalid metavar delimiter for short options: %r�%s)r>rJ�rZdelimrrr�set_short_opt_delimiter�s
�z%HelpFormatter.set_short_opt_delimitercCs&|dkrtd|��d|d|_dS)N)�=rPz.invalid metavar delimiter for long options: %rrQ)r>rKrRrrr�set_long_opt_delimiter�s
�z$HelpFormatter.set_long_opt_delimitercCs"|j|j7_|jd7_dSr�rDr9rErrrr�indent�szHelpFormatter.indentcCs"|j|j8_|jd8_dSrrVrrrr�dedent�szHelpFormatter.dedentcCstd��dS�Nzsubclasses must implement��NotImplementedError�r�usagerrr�format_usage�szHelpFormatter.format_usagecCstd��dSrYrZ�rZheadingrrr�format_headingszHelpFormatter.format_headingcCs.t|j|jd�}d|j}tj||||d�S)N�rP)Zinitial_indentZsubsequent_indent)rAr?rD�textwrapZfill)r�textZ
text_widthrWrrr�_format_texts
�zHelpFormatter._format_textcCs|r|�|�dSdSdS�N�
rO�rd�r�descriptionrrr�format_descriptionsz HelpFormatter.format_descriptioncCs|rd|�|�dSdSdSrerg)r�epilogrrr�
format_epilogszHelpFormatter.format_epilogcCsP|jdks|js|jS|jj�|j�}|tks6|dkr<|j}|j�|jt	|��Sr)
r8rH�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}|�|�|jr���|�}t�|�j	�}|�d|d|df�|�
�fdd�|dd�D��n|d	d
kr�|�d
�d�|�S)Nr6�%*s%s
rOz	%*s%-*s  rcsg|]}d�jd|f�qS)rurO)rB)�.0�linerrr�
<listcomp>Es�z/HelpFormatter.format_option.<locals>.<listcomp>r ���rf)rIrBrD�len�appendrmrtrbZwraprF�extendr4)rr,�result�optsZ	opt_widthZindent_firstZ	help_textZ
help_linesrrr�
format_option(s&



�

zHelpFormatter.format_optioncCs�|��d}|jD],}|�|�}||j|<t|t|�|j�}q|��|jD]8}|jD],}|�|�}||j|<t|t|�|j�}qXqN|��|��t	|d|j
�|_t|j|jd�|_
dS)Nrr6ra)rW�option_list�format_option_stringsrIrArzrD�
option_groupsrXr@rCrBr?rF)rr8Zmax_len�optZstrings�grouprrr�store_option_stringsKs 






z"HelpFormatter.store_option_stringscst|��rF|jp|j�����fdd�|jD�}��fdd�|jD�}n|j}|j}�jrb||}n||}d�|�S)Ncsg|]}�j|�f�qSr)rJ)rvZsopt��metavarrrrrxas�z7HelpFormatter.format_option_strings.<locals>.<listcomp>csg|]}�j|�f�qSr)rK)rvZloptr�rrrxcs�r3)�takes_valuer�rp�upper�_short_opts�
_long_optsrGr4)rr,Z
short_optsZ	long_optsr~rr�rr�]s��
z#HelpFormatter.format_option_stringsN)rr(r)rrr%rNrSrUrWrXr^r`rdrjrlrtrr�r�rrrrr	�s +
#c@s&eZdZddd�Zdd�Zd	d
�ZdS)r
r6�Nr cCst�|||||�dSr�r	r%rLrrrr%ts�zIndentedHelpFormatter.__init__cCstd�|S)Nz
Usage: %s
)r0r\rrrr^|sz"IndentedHelpFormatter.format_usagecCsd|jd|fS)Nz%*s%s:
rO)rDr_rrrr`sz$IndentedHelpFormatter.format_heading)r6r�Nr �rr(r)r%r^r`rrrrr
ps�
c@s&eZdZd
dd�Zdd�Zdd	�ZdS)rrr�NcCst�|||||�dSrr�rLrrrr%�s�zTitledHelpFormatter.__init__cCsd|�td��|fS)Nz%s  %s
ZUsage)r`r0r\rrrr^�sz TitledHelpFormatter.format_usagecCsd|d|jt|�fS)Nz%s
%s
z=-)rErzr_rrrr`�sz"TitledHelpFormatter.format_heading)rr�Nrr�rrrrr�s�
cCsh|dd���dkrd}nD|dd���dkrDd}|dd�p@d}n|dd�dkrZd}nd}|||�S)	Nr6Z0x�Z0b�0r ��
)�lower)�val�type�radixrrr�
_parse_num�sr�cCs
t|t�Sr)r�r:)r�rrr�
_parse_int�sr�Zintegerzfloating-point�complex)r:�long�floatr�cCsHt|j\}}z
||�WStk
rBttd�|||f��YnXdS)Nzoption %s: invalid %s value: %r)�_builtin_cvtr�r>rr0)r,r��valueZcvtZwhatrrr�
check_builtin�s
�r�cCs:||jkr|Sd�tt|j��}ttd�|||f��dS)Nr3z.option %s: invalid choice: %r (choose from %s))�choicesr4�map�reprrr0)r,r�r�r�rrrr�s
��)ZNOZDEFAULTc@s�eZdZddddddddd	d
ddgZd
ZdZdZdZdZdZ	e
e
e
e
ed�ZdZ
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�ZeeeeeeegZ
d+d,�ZeZd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Z d7d8�Z!dS)9r�actionr�rp�default�nargs�constr��callback�
callback_args�callback_kwargsrmr�)
�store�store_const�
store_true�store_falser{�append_const�countr�rm�version)r�r�r�r�r{r�r�)r�r{r�)r�r{)r�r�)�stringr:r�r�r��choice)r:r�r�r�r�NcOsBg|_g|_|�|�}|�|�|�|�|jD]}||�q0dSr)r�r��_check_opt_strings�_set_opt_strings�
_set_attrs�
CHECK_METHODS)rr~�attrs�checkerrrrr%4s



zOption.__init__cCsdd�|D�}|std��|S)NcSsg|]}|r|�qSrr)rvr�rrrrxKsz-Option._check_opt_strings.<locals>.<listcomp>z+at least one option string must be supplied)�	TypeError)rr~rrrr�GszOption._check_opt_stringscCs�|D]�}t|�dkr$td||��qt|�dkrd|ddkrH|ddksVtd||��|j�|�q|dd�dkr�|ddks�td||��|j�|�qdS)	Nr6z>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)rzr
r�r{r�)rr~r�rrrr�Ps2������zOption._set_opt_stringscCsv|jD]F}||kr*t||||�||=q|dkr@t||t�qt||d�q|rrt|���}tdd�|�|��dS)Nr�zinvalid keyword arguments: %sr3)�ATTRS�setattrrq�sorted�keysr
r4)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_ACTIONSrrrr�_check_type~s 



�zOption._check_typecCsr|jdkrT|jdkr td|��qnt|jttf�sntdtt|j���d�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)�'r z#must not supply choices for type %r)r�r�r
r��tuple�listr*�splitrrrr�
_check_choice�s$

���
�zOption._check_choicecCs\|j|jkp|jdk	}|jdkrX|rX|jrH|jddd��dd�|_n|jdd|_dS)Nrr6r�r0r )r��
STORE_ACTIONSr�rpr�rsr�)rr�rrr�_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�s
�zOption._check_constcCs<|j|jkr|jdkr8d|_n|jdk	r8td|j|��dS)Nr z*'nargs' must not be supplied for action %r)r�r�r�r
rrrr�_check_nargs�s

�zOption._check_nargscCs�|jdkrrt|j�s$td|j|��|jdk	rJt|jt�sJtd|j|��|jdk	r�t|jt�s�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��dictrrrr�_check_callback�sR

�

���

���
��
�
�zOption._check_callbackcCsd�|j|j�S)N�/)r4r�r�rrrrr&�szOption.__str__cCs
|jdk	Sr)r�rrrrr��szOption.takes_valuecCs|jr|jdS|jdSdS�Nr)r�r�rrrr�get_opt_string�s
zOption.get_opt_stringcCs*|j�|j�}|dkr|S||||�SdSr)�TYPE_CHECKERror�)rr�r�r�rrr�check_value�szOption.check_valuecs:|dk	r6�jdkr���|�St��fdd�|D��SdS)Nr csg|]}���|��qSr)r�)rv�v�r�rrrrxsz(Option.convert_value.<locals>.<listcomp>)r�r�r�)rr�r�rr�r�
convert_values
zOption.convert_valuecCs$|�||�}|�|j|j||||�Sr)r��take_actionr�rp)rr�r��valuesr8rrr�processs�zOption.processc	Cs:|dkrt|||��n|dkr2t|||j��n|dkrHt||d�n�|dkr^t||d�n�|dkrz|�|g��|�n�|dkr�|�|g��|j�n�|d	kr�t|||�|d
�d�n||dkr�|jp�d
}|jp�i}|j||||f|�|�nF|dk�r|��|��n*|dk�r(|�	�|��nt
d|j��dS)Nr�r�r�Tr�Fr{r�r�rr r�rrmr�zunknown action %r)r�r��ensure_valuer{r�r�r��
print_help�exit�
print_versionr>r�)	rr�rpr�r�r�r8�args�kwargsrrrr�s4





zOption.take_action)"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__r�r�r�r�r�r�rrrrr�sj�
�	
	�	ZSUPPRESSHELPZ
SUPPRESSUSAGEc@s^eZdZddd�Zdd�ZeZdd�Zdd	�Zd
d�Z	dd
�Z
ddd�Zddd�Zdd�Z
dS)rNcCs&|r"|��D]\}}t|||�qdSr)�itemsr�)rrnr�r�rrrr%9szValues.__init__cCs
t|j�Sr)r*�__dict__rrrrr&>szValues.__str__cCs2t|t�r|j|jkSt|t�r*|j|kStSdSr)r�rr�r��NotImplemented)r�otherrrr�__eq__Cs



z
Values.__eq__cCs6t|�D](}||kr||}|dk	rt|||�qdSr)�dirr�)rr�r�Zdvalrrr�_update_carefulKs
zValues._update_carefulcCs|j�|�dSr)r��update)rr�rrr�
_update_looseXszValues._update_loosecCs8|dkr|�|�n |dkr(|�|�ntd|��dS)N�carefulZloosezinvalid update mode: %r)r�r�r>)rr��moderrr�_update`s
zValues._updater�cCs&t|�tj|}|�t|�|�dSr)�
__import__�sys�modulesr��vars)r�modnamer��modrrr�read_modulehs
zValues.read_modulecCs&i}tt|���|�|�||�dSr)�exec�open�readr�)r�filenamer�r�rrr�	read_filemszValues.read_filecCs.t||�rt||�dkr$t|||�t||�Sr)�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&|��||_|�|�|�|�dSr)�_create_option_list�option_class�set_conflict_handler�set_description)rr�conflict_handlerrirrrr%�s
zOptionContainer.__init__cCsi|_i|_i|_dSr��
_short_opt�	_long_optrnrrrr�_create_option_mappings�sz'OptionContainer._create_option_mappingscCs|j|_|j|_|j|_dSrrrMrrr�_share_option_mappings�sz&OptionContainer._share_option_mappingscCs|dkrtd|��||_dS)N)�error�resolvez$invalid conflict_resolution value %r)r>r)r�handlerrrrr�sz$OptionContainer.set_conflict_handlercCs
||_dSr�rirhrrrr�szOptionContainer.set_descriptioncCs|jSrr
rrrr�get_description�szOptionContainer.get_descriptioncCs|`|`|`dSrrrrrr�destroy�szOptionContainer.destroycCs�g}|jD]"}||jkr
|�||j|f�q
|jD]"}||jkr4|�||j|f�q4|r�|j}|dkr�tdd�dd�|D��|��nd|dkr�|D]V\}}|�d�r�|j�	|�|j|=n|j�	|�|j|=|js�|js�|j
j�	|�q�dS)Nr
z conflicting option string(s): %sr3cSsg|]}|d�qS)rr)rv�corrrrx�sz3OptionContainer._check_conflict.<locals>.<listcomp>rr�)r�rr{r�rrrr4�
startswith�remove�	containerr�)rr,Z
conflict_optsr�rZc_optionrrr�_check_conflict�s2



��

zOptionContainer._check_conflictcOs�t|dt�r|j||�}n8t|�dkrL|sL|d}t|t�sTtd|��ntd��|�|�|j�|�||_	|j
D]}||j|<qv|jD]}||j
|<q�|jdk	r�|jtk	r�|j|j|j<n|j|jkr�d|j|j<|S)Nrr znot an Option instance: %r�invalid arguments)r�r*rrzrr�rr�r{rr�rr�rrpr�rqrn)rr�r�r,r�rrr�
add_option�s(





zOptionContainer.add_optioncCs|D]}|�|�qdSr)r)rr�r,rrr�add_optionsszOptionContainer.add_optionscCs|j�|�p|j�|�Sr)rrorr/rrr�
get_options
�zOptionContainer.get_optioncCs||jkp||jkSr)rrr/rrr�
has_options
�zOptionContainer.has_optioncCsn|j�|�}|dkr |j�|�}|dkr4td|��|jD]}|j|=q:|jD]}|j|=qN|jj�|�dS)Nzno such option %r)	rrorr>r�r�rr�r)rr.r,r�rrr�
remove_options



zOptionContainer.remove_optioncCs>|js
dSg}|jD]}|jtk	r|�|�|��qd�|�S�NrO)r�rmrr{rr4)r�	formatterr}r,rrr�format_option_helps

z"OptionContainer.format_option_helpcCs|�|���Sr)rjr�rrrrrrj(sz"OptionContainer.format_descriptioncCs:g}|jr|�|�|��|jr0|�|�|��d�|�S)Nrf)rir{rjr�rr4�rrr}rrr�format_help+szOptionContainer.format_helpN)rr(r)r%rr	rrrrrrrrrrrrjr rrrrrxs  			c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rNcCs$||_t�||j|j|�||_dSr)r8rr%rr�title)rr8r!rirrrr%6s�zOptionGroup.__init__cCsg|_|�|j�dSr)r�r	r8rrrrr<szOptionGroup._create_option_listcCs
||_dSr)r!)rr!rrr�	set_title@szOptionGroup.set_titlecCst�|�|`dSr)rrr�rrrrrCs
zOptionGroup.destroycCs0|�|j�}|��|t�||�7}|��|Sr)r`r!rWrr rXrrrrr Js
zOptionGroup.format_help)N)rr(r)r%rr"rr rrrrr4s

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
TcCsrt�||||�|�|�|	|_||_d|_d|_|dkr@t�}||_|j�	|�|
|_
|j||d�|��dS)NT)�add_help)
rr%�	set_usage�progr��allow_interspersed_args�process_default_valuesr
rrNrk�_populate_option_list�_init_parsing_state)rr]r�rr�rrirZadd_help_optionr%rkrrrr%�s(�
�zOptionParser.__init__cCs.t�|�|jD]}|��q|`|`|`dSr)rrr�r�r)rr�rrrr�s


zOptionParser.destroycCsg|_g|_|��dSr)r�r�rrrrrr�sz OptionParser._create_option_listcCs|jdddtd�d�dS)Nz-hz--helprmzshow this help message and exit�r�rm�rr0rrrr�_add_help_option�s�zOptionParser._add_help_optioncCs|jddtd�d�dS)Nz	--versionr�z&show program's version number and exitr*r+rrrr�_add_version_option�s�z OptionParser._add_version_optioncCs>|jr|�|j�|r |�|�|jr.|��|r:|��dSr)�standard_option_listrr�r-r,)rr�r#rrrr(�s
z"OptionParser._populate_option_listcCsd|_d|_d|_dSr)�rargs�largsr�rrrrr)�sz OptionParser._init_parsing_statecCsL|dkrtd�|_n4|tkr$d|_n$|���d�rB|dd�|_n||_dS)Nz%prog [options]zusage: �)r0r]rr�rr\rrrr$�szOptionParser.set_usagecCs
d|_dS)NT�r&rrrr�enable_interspersed_args�sz%OptionParser.enable_interspersed_argscCs
d|_dS)NFr2rrrr�disable_interspersed_argssz&OptionParser.disable_interspersed_argscCs
||_dSr)r')rr�rrr�set_process_default_valuessz'OptionParser.set_process_default_valuescCs||j|<dSr)rn)rrpr�rrr�set_defaultszOptionParser.set_defaultcKs|j�|�dSr)rnr�)rr�rrr�set_defaultsszOptionParser.set_defaultscCs*|jdd�}|jD]}|�|j�q|Sr)r�r�r|)rZoptionsr�rrr�_get_all_optionss
zOptionParser._get_all_optionscCs`|jst|j�S|j��}|��D]4}|�|j�}t|t�r"|�	�}|�
||�||j<q"t|�Sr)r'rrn�copyr8rorpr�r*r�r�)rrnr,r�r.rrr�get_default_valuess


zOptionParser.get_default_valuescOszt|dt�r t|f|�|�}nJt|�dkrb|sb|d}t|t�sNtd|��|j|k	rjtd��ntd��|j�|�|S)Nrr znot an OptionGroup instance: %rz"invalid OptionGroup (wrong parser)r)	r�r*rrzr�r8r>r�r{)rr�r�r�rrr�add_option_group+s


zOptionParser.add_option_groupcCs0|j�|�p|j�|�}|r,|j|k	r,|jSdSr)rrorr)rr.r,rrr�get_option_group;s
�zOptionParser.get_option_groupcCs&|dkrtjdd�S|dd�SdSr)r��argv)rr�rrr�	_get_argsEszOptionParser._get_argsc
Cs�|�|�}|dkr|��}||_g|_}||_z|�|||�}Wn4ttfk
rv}z|�t	|��W5d}~XYnX||}|�
||�Sr)r>r:r/r0r��
_process_argsrrr
r*�check_values)rr�r�r/r0�stop�errrrr�
parse_argsKs

 zOptionParser.parse_argscCs||fSrr)rr�r�rrrr@rszOptionParser.check_valuescCs�|r�|d}|dkr|d=dS|dd�dkr<|�||�q|dd�dkrft|�dkrf|�||�q|jr~|�|�|d=qdSqdS)Nrr�r6r r�)�_process_long_optrz�_process_short_optsr&r{)rr0r/r��argrrrr?s

zOptionParser._process_argscCst||j�Sr)�
_match_abbrevr)rr�rrr�_match_long_opt�szOptionParser._match_long_optc
Cs�|�d�}d|kr4|�dd�\}}|�d|�d}n|}d}|�|�}|j|}|��r�|j}t|�|kr�|�t	dd|�||d��q�|dkr�|�d�}	q�t
|d|��}	|d|�=n|r�|�td	�|�nd}	|�||	||�dS)
NrrTr TF�.%(option)s option requires %(number)d argument�/%(option)s option requires %(number)d arguments�r,Znumberz%s option does not take a value)
�popr��insertrHrr�r�rzr
rr�r0r�)
rr/r�rFr�Znext_argZhad_explicit_valuer,r�r�rrrrD�s6


��zOptionParser._process_long_optcCs�|�d�}d}d}|dd�D]�}d|}|j�|�}|d7}|sJt|��|��r�|t|�krv|�d||d��d}|j}	t|�|	kr�|�t	dd|	�||	d��q�|	dkr�|�d�}
q�t
|d|	��}
|d|	�=nd}
|�||
||�|rq�qdS)	NrFr r�TrIrJrK)rLrrorr�rzrMr�r
rr�r�)rr/r�rFrA�iZchr�r,r�r�rrrrE�s<
��z OptionParser._process_short_optscCs&|jdkrtj�tjd�S|jSdSr�)r%r;�path�basenamer�r=rrrr�
get_prog_names
zOptionParser.get_prog_namecCs|�d|���S)Nz%prog)rsrQ)r�srrr�expand_prog_nameszOptionParser.expand_prog_namecCs|�|j�Sr)rSrirrrrrszOptionParser.get_descriptionrcCs|rtj�|�t�|�dSr)r��stderr�writer�)rZstatusr#rrrr�szOptionParser.exitcCs(|�tj�|�dd|��|f�dS)Nr6z%s: error: %s
)�print_usager�rTr�rQr$rrrr
szOptionParser.errorcCs"|jr|j�|�|j��SdSdSr)r]rr^rSrrrr�	get_usage#s

�zOptionParser.get_usagecCs|jrt|��|d�dS�N)�file)r]�printrW�rrYrrrrV*s	zOptionParser.print_usagecCs|jr|�|j�SdSdSr)r�rSrrrr�get_version6szOptionParser.get_versioncCs|jrt|��|d�dSrX)r�rZr\r[rrrr�<szOptionParser.print_versioncCs�|dkr|j}|�|�g}|�|�td���|��|jrZ|�t�||��|�d�|j	D]}|�|�
|��|�d�q`|��d�|dd��S)NZOptionsrfrOry)
rr�r{r`r0rWr�rrr�r rXr4)rrr}r�rrrrGs


zOptionParser.format_option_helpcCs|�|j�Sr)rlrkrrrrrlXszOptionParser.format_epilogcCsn|dkr|j}g}|jr*|�|��d�|jrD|�|�|�d�|�|�|��|�|�|��d�|�Sre)	rr]r{rWrirjrrlr4rrrrr [szOptionParser.format_helpcCs |dkrtj}|�|���dSr)r��stdoutrUr r[rrrr�gszOptionParser.print_help)T)NN)rN)N)N)N)N)N)*rr(r)r.rr%rrr,r-r(r)r$r3r4r5r6r7r8r:r;r<r>rCr@r?rHrDrErQrSrr�r
rWrVr\r�rrlr r�rrrrrRs`F�
"

	

'
3	$)





csZ�|kr�S�fdd�|��D�}t|�dkr6|dS|sDt���n|��t�|��dS)Ncsg|]}|���r|�qSr)r)rvZword�rRrrrx�s
�z!_match_abbrev.<locals>.<listcomp>r r)r�rzr�sortr1)rRZwordmapr2rr^rrGts
rG)&�__version__�__all__Z
__copyright__r�r;rbrrr�ImportErrorr0�	Exceptionrr
rrrr1r	r
rr�r�r�r�r�r�rrqrrrrrrrrGrrrrr�<module>s�� 


P




�uA=&

?>