%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/lib/python3.8/__pycache__/argparse.cpython-38.pyc

U

k�]e7x�@sRdZdZdddddddd	d
ddd
dddddgZddlZddlZddlZzddl	m	Z
mZWn$ek
r~dd�Z
dd�ZYnXdZ
dZdZdZdZdZd ZGd!d"�d"e�Zd#d$�ZGd%d�de�ZGd&d�de�ZGd'd	�d	e�ZGd(d�de�ZGd)d
�d
e�Zd*d+�ZGd,d�de�ZGd-d�de�ZGd.d�de�Z Gd/d0�d0e �Z!Gd1d2�d2e �Z"Gd3d4�d4e"�Z#Gd5d6�d6e"�Z$Gd7d8�d8e �Z%Gd9d:�d:e �Z&Gd;d<�d<e �Z'Gd=d>�d>e �Z(Gd?d@�d@e �Z)GdAdB�dBe �Z*GdCdD�dDe%�Z+GdEd�de�Z,GdFd�de�Z-GdGdH�dHe�Z.GdIdJ�dJe.�Z/GdKdL�dLe/�Z0GdMd�dee.�Z1dS)Na�
Command-line parsing library

This module is an optparse-inspired command-line parsing library that:

    - handles both optional and positional arguments
    - produces highly informative usage messages
    - supports parsers that dispatch to sub-parsers

The following is a simple usage example that sums integers from the
command-line and writes the result to a file::

    parser = argparse.ArgumentParser(
        description='sum the integers at the command line')
    parser.add_argument(
        'integers', metavar='int', nargs='+', type=int,
        help='an integer to be summed')
    parser.add_argument(
        '--log', default=sys.stdout, type=argparse.FileType('w'),
        help='the file where the sum should be written')
    args = parser.parse_args()
    args.log.write('%s' % sum(args.integers))
    args.log.close()

The module contains the following public classes:

    - ArgumentParser -- The main entry point for command-line parsing. As the
        example above shows, the add_argument() method is used to populate
        the parser with actions for optional and positional arguments. Then
        the parse_args() method is invoked to convert the args at the
        command-line into an object with attributes.

    - ArgumentError -- The exception raised by ArgumentParser objects when
        there are errors with the parser's actions. Errors raised while
        parsing the command-line are caught by ArgumentParser and emitted
        as command-line messages.

    - FileType -- A factory for defining types of files to be created. As the
        example above shows, instances of FileType are typically passed as
        the type= argument of add_argument() calls.

    - Action -- The base class for parser actions. Typically actions are
        selected by passing strings like 'store_true' or 'append_const' to
        the action= argument of add_argument(). However, for greater
        customization of ArgumentParser actions, subclasses of Action may
        be defined and passed as the action= argument.

    - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
        ArgumentDefaultsHelpFormatter -- Formatter classes which
        may be passed as the formatter_class= argument to the
        ArgumentParser constructor. HelpFormatter is the default,
        RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
        not to change the formatting for help text, and
        ArgumentDefaultsHelpFormatter adds information about argument defaults
        to the help.

All other classes in this module are considered implementation details.
(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
considered public as object names -- the API of the formatter objects is
still considered an implementation detail.)
z1.1�ArgumentParser�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�ArgumentDefaultsHelpFormatter�RawDescriptionHelpFormatter�RawTextHelpFormatter�MetavarTypeHelpFormatter�	Namespace�Action�ONE_OR_MORE�OPTIONAL�PARSER�	REMAINDER�SUPPRESS�ZERO_OR_MORE�N)�gettext�ngettextcCs|S�N�)�messagerr�/usr/lib/python3.8/argparse.py�_^srcCs|dkr|S|SdS�N�r)ZsingularZplural�nrrrr`srz==SUPPRESS==�?�*�+zA...�...Z_unrecognized_argsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AttributeHolderaAbstract base class that provides __repr__.

    The __repr__ method returns a string in the format::
        ClassName(attr=name, attr=name, ...)
    The attributes are determined either by a class-level attribute,
    '_kwarg_names', or by inspecting the instance __dict__.
    cCs�t|�j}g}i}|��D]}|�t|��q|��D],\}}|��rZ|�d||f�q6|||<q6|rz|�dt|��d|d�|�fS)N�%s=%rz**%s�%s(%s)�, )�type�__name__�	_get_args�append�repr�_get_kwargs�isidentifier�join)�selfZ	type_name�arg_stringsZ	star_args�arg�name�valuerrr�__repr__|s

z_AttributeHolder.__repr__cCst|j���Sr)�sorted�__dict__�items�r-rrrr*�sz_AttributeHolder._get_kwargscCsgSrrr6rrrr'�sz_AttributeHolder._get_argsN)r&�
__module__�__qualname__�__doc__r2r*r'rrrrr!ssr!cCs6|dkrgSt|�tkr$|dd�Sddl}|�|�S)Nr)r%�list�copy)r5r;rrr�_copy_items�sr<c@s�eZdZdZd;dd�Zdd�Zd	d
�ZGdd�de�Zd
d�Z	dd�Z
dd�Zdd�Zd<dd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdS)=rz�Formatter for generating usage messages and argument help strings.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    ��NcCs�|dkr@zddl}|��j}|d8}Wntk
r>d}YnX||_||_t|t|d|d��|_||_	d|_
d|_d|_|�
|d�|_|j|_t�dtj�|_t�d�|_dS)Nrr=�F�z\s+z\n\n\n+)Zshutil�get_terminal_size�columns�ImportError�_prog�_indent_increment�min�max�_max_help_position�_width�_current_indent�_level�_action_max_length�_Section�
_root_section�_current_section�_re�compile�ASCII�_whitespace_matcher�_long_break_matcher)r-�progZindent_incrementZmax_help_position�widthZ_shutilrrr�__init__�s(

�zHelpFormatter.__init__cCs"|j|j7_|jd7_dSr)rJrErKr6rrr�_indent�szHelpFormatter._indentcCs4|j|j8_|jdks"td��|jd8_dS)NrzIndent decreased below 0.r)rJrE�AssertionErrorrKr6rrr�_dedent�szHelpFormatter._dedentc@seZdZddd�Zdd�ZdS)zHelpFormatter._SectionNcCs||_||_||_g|_dSr)�	formatter�parent�headingr5)r-r[r\r]rrrrW�szHelpFormatter._Section.__init__cCs�|jdk	r|j��|jj}|dd�|jD��}|jdk	rD|j��|sLdS|jtk	rz|jdk	rz|jj}d|d|jf}nd}|d||dg�S)NcSsg|]\}}||��qSrr)�.0�func�argsrrr�
<listcomp>�sz6HelpFormatter._Section.format_help.<locals>.<listcomp>�z%*s%s:
�
)	r\r[rX�_join_partsr5rZr]rrJ)r-r,Z	item_helpZcurrent_indentr]rrr�format_help�s



z"HelpFormatter._Section.format_help)N)r&r7r8rWrerrrrrM�s
rMcCs|jj�||f�dSr)rOr5r()r-r_r`rrr�	_add_item�szHelpFormatter._add_itemcCs0|��|�||j|�}|�|jg�||_dSr)rXrMrOrfre)r-r]Zsectionrrr�
start_section�szHelpFormatter.start_sectioncCs|jj|_|��dSr)rOr\rZr6rrr�end_section�s
zHelpFormatter.end_sectioncCs$|tk	r |dk	r |�|j|g�dSr)rrf�_format_text)r-�textrrr�add_textszHelpFormatter.add_textcCs&|tk	r"||||f}|�|j|�dSr)rrf�
_format_usage)r-�usage�actions�groups�prefixr`rrr�	add_usageszHelpFormatter.add_usagecCsv|jtk	rr|j}||�g}|�|�D]}|�||��q$tdd�|D��}||j}t|j|�|_|�|j	|g�dS)NcSsg|]}t|��qSr��len�r^�srrrrasz.HelpFormatter.add_argument.<locals>.<listcomp>)
�helpr�_format_action_invocation�_iter_indented_subactionsr(rGrJrLrf�_format_action)r-�actionZget_invocationZinvocations�	subactionZinvocation_lengthZ
action_lengthrrr�add_arguments


�zHelpFormatter.add_argumentcCs|D]}|�|�qdSr)r|)r-rnrzrrr�
add_argumentsszHelpFormatter.add_argumentscCs.|j��}|r*|j�d|�}|�d�d}|S)N�

rc)rNrerT�sub�strip)r-rvrrrre%s

zHelpFormatter.format_helpcCsd�dd�|D��S)NrbcSsg|]}|r|tk	r|�qSr)r)r^�partrrrra-s�z-HelpFormatter._join_parts.<locals>.<listcomp>)r,)r-Zpart_stringsrrrrd,s
�zHelpFormatter._join_partscs6|dkrtd�}|dk	r,|t|jd�}�n�|dkrL|sLdt|jd�}�n�|dk�r*dt|jd�}g}g}|D] }|jr�|�|�qr|�|�qr|j}	|	|||�}
d�dd�||
fD��}|j|j�t	|�t	|��k�r*d}|	||�}|	||�}
t
�||�}t
�||
�}d�|�|k�s&t�d�|�|
k�s:t�d�fdd	�	}t	|�t	|�d
�k�r�dt	|�t	|�d}|�r�||g|||�}|�
|||��n |�r�||g|||�}n|g}nZdt	|�}||}|||�}t	|�dk�rg}|�
|||��|�
|||��|g|}d�|�}d
||fS)Nzusage: �rUz%(prog)s� cSsg|]}|r|�qSrrrtrrrraMsz/HelpFormatter._format_usage.<locals>.<listcomp>z%\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+cs�g}g}|dk	rt|�d}nt|�d}|D]Z}|dt|��krn|rn|�|d�|��g}t|�d}|�|�|t|�d7}q.|r�|�|d�|��|dk	r�|dt|�d�|d<|S)Nrr�r)rsr(r,)�parts�indentrp�lines�lineZline_lenr���
text_widthrr�	get_linesas"
z.HelpFormatter._format_usage.<locals>.get_linesg�?rrcz%s%s

)N)r�dictrD�option_stringsr(�_format_actions_usager,rIrJrsrP�findallrY�extend)r-rmrnrorprU�	optionals�positionalsrz�formatZaction_usageZpart_regexpZ	opt_usageZ	pos_usageZ	opt_partsZ	pos_partsr�r�r�r�rr�rrl1s\
�




zHelpFormatter._format_usagec	Cs�t�}i}|D�]}z|�|jd�}Wntk
r@YqYqX|t|j�}|||�|jkr|jD]}|�|�qh|js�||kr�||d7<nd||<||kr�||d7<nd||<nF||kr�||d7<nd||<||k�r||d7<nd||<t|d|�D]}	d	||	<�qqg}
t|�D�]"\}	}|j	t
k�r�|
�d�|�|	�d	k�rr|�
|	�n"|�|	d�d	k�rX|�
|	d�n�|j�s�|�|�}|�||�}||k�r�|ddk�r�|d
dk�r�|dd
�}|
�|�nf|jd}
|jdk�rd|
}n"|�|�}|�||�}d|
|f}|j�sN||k�rNd
|}|
�|��q6t|dd�D]}	||	g|
|	|	�<�qhd�dd�|
D��}d}d}t�d|d|�}t�d|d|�}t�d||fd|�}t�dd|�}|��}|S)Nrz [�[�]z (�(�)r�|����%s�%s %s�[%s]T)�reverser�cSsg|]}|dk	r|�qSrr)r^�itemrrrra�sz7HelpFormatter._format_actions_usage.<locals>.<listcomp>z[\[(]z[\])]z(%s) z\1� (%s)z%s *%srbz\(([^|]*)\))�set�index�_group_actions�
ValueErrorrs�add�required�range�	enumeratervrr(�get�popr��#_get_default_metavar_for_positional�_format_args�nargs�!_get_default_metavar_for_optionalr3r,rPrr�)r-rnro�
group_actionsZinserts�group�start�endrz�ir��defaultr��
option_string�args_stringrj�open�closerrrr��sz










z#HelpFormatter._format_actions_usagecCsFd|kr|t|jd�}t|j|jd�}d|j}|�|||�dS)Nz%(prog)r��r�r~)r�rDrGrIrJ�
_fill_text)r-rjr�r�rrrri�s

zHelpFormatter._format_textc
Cs:t|jd|j�}t|j|d�}||jd}|�|�}|jsV|jd|f}d|}n@t|�|kr~|jd||f}d|}d}n|jd|f}d|}|}|g}|jr�|�	|�}	|�
|	|�}
|�d|d|
df�|
dd�D]}|�d|d|f�q�n|�d��s|�d�|�
|�D]}|�|�|���q|�|�S)	Nr=r�rbz%*s%s
z	%*s%-*s  rrrc)rFrLrHrGrIrJrwrvrs�_expand_help�_split_linesr(�endswithrxryrd)
r-rzZ
help_positionZ
help_widthZaction_widthZ
action_header�tupZindent_firstr�Z	help_textZ
help_linesr�r{rrrry�s8
�



zHelpFormatter._format_actioncCs�|js&|�|�}|�||�d�\}|Sg}|jdkrB|�|j�n4|�|�}|�||�}|jD]}|�d||f�q^d�|�SdS)Nrrr�r$)	r�r��_metavar_formatterr�r�r�r�r(r,)r-rzr��metavarr�r�r�rrrrw.s



z'HelpFormatter._format_action_invocationcsP|jdk	r|j�n.|jdk	r<dd�|jD�}dd�|��n|��fdd�}|S)NcSsg|]}t|��qSr��str)r^ZchoicerrrraJsz4HelpFormatter._metavar_formatter.<locals>.<listcomp>z{%s}�,cst�t�r�S�f|SdSr)�
isinstance�tuple)Z
tuple_size��resultrrr�Os
z0HelpFormatter._metavar_formatter.<locals>.format)r��choicesr,)r-rz�default_metavarZchoice_strsr�rr�rr�Fs

z HelpFormatter._metavar_formattercCs�|�||�}|jdkr$d|d�}n�|jtkr<d|d�}n�|jtkrTd|d�}n�|jtkrld|d�}n�|jtkr|d}nt|jtkr�d|d�}n\|jtkr�d	}nLzd
d�t|j�D�}Wnt	k
r�t
d�d�YnXd
�|�||j�}|S)Nr�rr�z
[%s [%s ...]]r=z%s [%s ...]r z%s ...rbcSsg|]}d�qS)r�r)r^rrrrrahsz.HelpFormatter._format_args.<locals>.<listcomp>zinvalid nargs valuer�)r�r�r
rrrrrr��	TypeErrorr�r,)r-rzr�Zget_metavarr�Zformatsrrrr�Vs*






zHelpFormatter._format_argscCs�tt|�|jd�}t|�D]}||tkr||=qt|�D] }t||d�r:||j||<q:|�d�dk	r�d�dd�|dD��}||d<|�	|�|S)Nr�r&r�r$cSsg|]}t|��qSrr�)r^�crrrrawsz.HelpFormatter._expand_help.<locals>.<listcomp>)
r��varsrDr:r�hasattrr&r�r,�_get_help_string)r-rzZparamsr0Zchoices_strrrrr�nszHelpFormatter._expand_helpccs@z
|j}Wntk
rYnX|��|�EdH|��dSr)�_get_subactions�AttributeErrorrXrZ)r-rzZget_subactionsrrrrx{s
z'HelpFormatter._iter_indented_subactionscCs&|j�d|���}ddl}|�||�S)Nr�r)rSrr��textwrapZwrap)r-rjrVr�rrrr��szHelpFormatter._split_linescCs,|j�d|���}ddl}|j||||d�S)Nr�r)Zinitial_indentZsubsequent_indent)rSrr�r�Zfill)r-rjrVr�r�rrrr��s�zHelpFormatter._fill_textcCs|jSr)rv�r-rzrrrr��szHelpFormatter._get_help_stringcCs
|j��Sr)�dest�upperr�rrrr��sz/HelpFormatter._get_default_metavar_for_optionalcCs|jSr)r�r�rrrr��sz1HelpFormatter._get_default_metavar_for_positional)r=r>N)N) r&r7r8r9rWrXrZ�objectrMrfrgrhrkrqr|r}rerdrlr�riryrwr�r�r�rxr�r�r�r�r�rrrrr�s>�
"
`g/

c@seZdZdZdd�ZdS)rz�Help message formatter which retains any formatting in descriptions.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cs d��fdd�|jdd�D��S)Nrbc3s|]}�|VqdSrr)r^r��r�rr�	<genexpr>�sz9RawDescriptionHelpFormatter._fill_text.<locals>.<genexpr>T)�keepends)r,�
splitlines)r-rjrVr�rr�rr��sz&RawDescriptionHelpFormatter._fill_textN)r&r7r8r9r�rrrrr�sc@seZdZdZdd�ZdS)rz�Help message formatter which retains formatting of all help text.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|��Sr)r�)r-rjrVrrrr��sz!RawTextHelpFormatter._split_linesN)r&r7r8r9r�rrrrr�sc@seZdZdZdd�ZdS)rz�Help message formatter which adds default values to argument help.

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs>|j}d|jkr:|jtk	r:ttg}|js2|j|kr:|d7}|S)Nz
%(default)z (default: %(default)s))rvr�rr
rr�r�)r-rzrvZdefaulting_nargsrrrr��s

z.ArgumentDefaultsHelpFormatter._get_help_stringN)r&r7r8r9r�rrrrr�sc@s eZdZdZdd�Zdd�ZdS)r	aHelp message formatter which uses the argument 'type' as the default
    metavar value (instead of the argument 'dest')

    Only the name of this class is considered a public API. All the methods
    provided by the class are considered an implementation detail.
    cCs|jjSr�r%r&r�rrrr��sz:MetavarTypeHelpFormatter._get_default_metavar_for_optionalcCs|jjSrr�r�rrrr��sz<MetavarTypeHelpFormatter._get_default_metavar_for_positionalN)r&r7r8r9r�r�rrrrr	�scCsN|dkrdS|jrd�|j�S|jdtfkr2|jS|jdtfkrF|jSdSdS)N�/)r�r,r�rr�)�argumentrrr�_get_action_name�sr�c@s eZdZdZdd�Zdd�ZdS)rz�An error from creating or using an argument (optional or positional).

    The string value of this exception is the message, augmented with
    information about the argument that caused it.
    cCst|�|_||_dSr)r��
argument_namer)r-r�rrrrrW�s
zArgumentError.__init__cCs(|jdkrd}nd}|t|j|jd�S)Nz%(message)sz'argument %(argument_name)s: %(message)s)rr�)r�r�r)r-r�rrr�__str__�s
�zArgumentError.__str__N)r&r7r8r9rWr�rrrrr�sc@seZdZdZdS)rz@An error from trying to convert a command line string to a type.N)r&r7r8r9rrrrr�sc@s,eZdZdZd
dd�Zdd�Zddd	�ZdS)ra\	Information about how to convert command line strings to Python objects.

    Action objects are used by an ArgumentParser to represent the information
    needed to parse a single argument from one or more strings from the
    command line. The keyword arguments to the Action constructor are also
    all attributes of Action instances.

    Keyword Arguments:

        - option_strings -- A list of command-line option strings which
            should be associated with this action.

        - dest -- The name of the attribute to hold the created object(s)

        - nargs -- The number of command-line arguments that should be
            consumed. By default, one argument will be consumed and a single
            value will be produced.  Other values include:
                - N (an integer) consumes N arguments (and produces a list)
                - '?' consumes zero or one arguments
                - '*' consumes zero or more arguments (and produces a list)
                - '+' consumes one or more arguments (and produces a list)
            Note that the difference between the default and nargs=1 is that
            with the default, a single value will be produced, while with
            nargs=1, a list containing a single value will be produced.

        - const -- The value to be produced if the option is specified and the
            option uses an action that takes no values.

        - default -- The value to be produced if the option is not specified.

        - type -- A callable that accepts a single string argument, and
            returns the converted value.  The standard Python types str, int,
            float, and complex are useful examples of such callables.  If None,
            str is used.

        - choices -- A container of values that should be allowed. If not None,
            after a command-line argument has been converted to the appropriate
            type, an exception will be raised if it is not a member of this
            collection.

        - required -- True if the action must always be specified at the
            command line. This is only meaningful for optional command-line
            arguments.

        - help -- The help string describing the argument.

        - metavar -- The name to be used for the option's argument with the
            help string. If None, the 'dest' value will be used as the name.
    NFcCs@||_||_||_||_||_||_||_||_|	|_|
|_	dSr�
r�r�r��constr�r%r�r�rvr��r-r�r�r�r�r�r%r�r�rvr�rrrrW5szAction.__init__c	s(ddddddddd	g	}�fd
d�|D�S)Nr�r�r�r�r�r%r�rvr�csg|]}|t�|�f�qSr��getattr�r^r0r6rrraWsz&Action._get_kwargs.<locals>.<listcomp>r�r-�namesrr6rr*Ks�zAction._get_kwargscCsttd���dS)Nz.__call__() not defined)�NotImplementedErrorr�r-�parser�	namespace�valuesr�rrr�__call__YszAction.__call__)NNNNNFNN)N)r&r7r8r9rWr*r�rrrrrs5�
cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for store actions must be != 0; if you have nothing to store, actions such as store true or store const may be more appropriate� nargs must be %r to supply constr�)r�r
�superr�rWr���	__class__rrrW_s 
�z_StoreAction.__init__cCst||j|�dSr)�setattrr�r�rrrr�|sz_StoreAction.__call__)NNNNNFNN)N�r&r7r8rWr��
__classcell__rrr�rr�]s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_StoreConstActionNFc	s"tt|�j||d||||d�dS)Nr)r�r�r�r�r�r�rv)r�r�rW�r-r�r�r�r�r�rvr�r�rrrW�s
�z_StoreConstAction.__init__cCst||j|j�dSr)r�r�r�r�rrrr��sz_StoreConstAction.__call__)NFNN)Nr�rrr�rr��s�r�cseZdZd�fdd�	Z�ZS)�_StoreTrueActionFNcs tt|�j||d|||d�dS)NT�r�r�r�r�r�rv)r�r�rW�r-r�r�r�r�rvr�rrrW�s
�z_StoreTrueAction.__init__)FFN�r&r7r8rWr�rrr�rr��s�r�cseZdZd�fdd�	Z�ZS)�_StoreFalseActionTFNcs tt|�j||d|||d�dS)NFr�)r�r�rWr�r�rrrW�s
�z_StoreFalseAction.__init__)TFNr�rrr�rr��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�
_AppendActionNFcsT|dkrtd��|dk	r,|tkr,tdt��tt|�j|||||||||	|
d�
dS)Nrz�nargs for append actions must be != 0; if arg strings are not supplying the value to append, the append const action may be more appropriater�r�)r�r
r�r�rWr�r�rrrW�s 
�z_AppendAction.__init__cCs2t||jd�}t|�}|�|�t||j|�dSr)r�r�r<r(r��r-r�r�r�r�r5rrrr��s
z_AppendAction.__call__)NNNNNFNN)Nr�rrr�rr��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_AppendConstActionNFc
s$tt|�j||d|||||d�dS)Nr)r�r�r�r�r�r�rvr�)r�r�rWr�r�rrrW�s
�z_AppendConstAction.__init__cCs4t||jd�}t|�}|�|j�t||j|�dSr)r�r�r<r(r�r�r�rrrr��sz_AppendConstAction.__call__)NFNN)Nr�rrr�rr��s�r�cs(eZdZd�fdd�	Zddd�Z�ZS)	�_CountActionNFcs tt|�j||d|||d�dS)Nr)r�r�r�r�r�rv)r�r�rWr�r�rrrW�s
�z_CountAction.__init__cCs0t||jd�}|dkrd}t||j|d�dS�Nrr)r�r�r�)r-r�r�r�r��countrrrr�
sz_CountAction.__call__)NFN)Nr�rrr�rr��s
�r�cs.eZdZeedf�fdd�	Zddd�Z�ZS)�_HelpActionNcstt|�j|||d|d�dS�Nr)r�r�r�r�rv)r�rrW)r-r�r�r�rvr�rrrWs
�z_HelpAction.__init__cCs|��|��dSr)�
print_help�exitr�rrrr�sz_HelpAction.__call__)N�r&r7r8rrWr�r�rrr�rrs
�rcs0eZdZdeedf�fdd�	Zddd�Z�ZS)�_VersionActionNz&show program's version number and exitcs$tt|�j|||d|d�||_dSr)r�rrW�version)r-r�rr�r�rvr�rrrW&s
�z_VersionAction.__init__cCsD|j}|dkr|j}|��}|�|�|�|��tj�|��dSr)r�_get_formatterrk�_print_messagere�_sys�stdoutr)r-r�r�r�r�rr[rrrr�4s
z_VersionAction.__call__)Nrrrr�rr$s�rcsPeZdZGdd�de�Zedddf�fdd�	Zdd�Zd	d
�Zd
dd�Z	�Z
S)�_SubParsersActioncseZdZ�fdd�Z�ZS)z&_SubParsersAction._ChoicesPseudoActioncs@|}}|r|dd�|�7}ttj|�}|jg|||d�dS)Nr�r$)r�r�rvr�)r,r�r�_ChoicesPseudoActionrW)r-r0�aliasesrvr�r�Zsupr�rrrWBs
�z/_SubParsersAction._ChoicesPseudoAction.__init__r�rrr�rr
@sr
FNc	s<||_||_i|_g|_tt|�j||t|j|||d�dS)N)r�r�r�r�r�rvr�)�_prog_prefix�
_parser_class�_name_parser_map�_choices_actionsr�rrWr)r-r�rU�parser_classr�r�rvr�r�rrrWJs	
�z_SubParsersAction.__init__cKs�|�d�dkr d|j|f|d<|�dd�}d|krX|�d�}|�|||�}|j�|�|jf|�}||j|<|D]}||j|<qr|S)NrUr�rrrv)r�rr�r
rr(rr)r-r0�kwargsrrvZ
choice_actionr��aliasrrr�
add_parseras

z_SubParsersAction.add_parsercCs|jSr)rr6rrrr�xsz!_SubParsersAction._get_subactionscCs�|d}|dd�}|jtk	r,t||j|�z|j|}Wn<tk
rv|d�|j�d�}td�|}t||��YnX|�|d�\}	}t	|	��
�D]\}
}t||
|�q�|r�t	|��tg�t
|t��|�dS)Nrrr$)�parser_namer�z5unknown parser %(parser_name)r (choices: %(choices)s))r�rr�r�KeyErrorr,rr�parse_known_argsr�r5�
setdefault�_UNRECOGNIZED_ARGS_ATTRr�r�)r-r�r�r�r�rr.r`�msgZsubnamespace�keyr1rrrr�{s$

�	z_SubParsersAction.__call__)N)r&r7r8rr
rrWrr�r�r�rrr�rr>s�rc@seZdZddd�ZdS)�
_ExtendActionNcCs2t||jd�}t|�}|�|�t||j|�dSr)r�r�r<r�r�r�rrrr��s
z_ExtendAction.__call__)N)r&r7r8r�rrrrr�src@s*eZdZdZddd�Zdd�Zd	d
�ZdS)ra�Factory for creating file object types

    Instances of FileType are typically passed as type= arguments to the
    ArgumentParser add_argument() method.

    Keyword Arguments:
        - mode -- A string indicating how the file is to be opened. Accepts the
            same values as the builtin open() function.
        - bufsize -- The file's desired buffer size. Accepts the same values as
            the builtin open() function.
        - encoding -- The file's encoding. Accepts the same values as the
            builtin open() function.
        - errors -- A string indicating how encoding and decoding errors are to
            be handled. Accepts the same value as the builtin open() function.
    �rr�NcCs||_||_||_||_dSr)�_mode�_bufsize�	_encoding�_errors)r-�mode�bufsize�encoding�errorsrrrrW�szFileType.__init__c
Cs�|dkr>d|jkrtjSd|jkr(tjStd�|j}t|��zt||j|j|j|j	�WSt
k
r�}z"||d�}td�}t||��W5d}~XYnXdS)N�-r�wzargument "-" with mode %r)�filename�errorz$can't open '%(filename)s': %(error)s)r r
�stdinrrr�r�r!r"r#�OSErrorr)r-�stringr�er`rrrrr��s

�
zFileType.__call__cCsT|j|jf}d|jfd|jfg}d�dd�|D�dd�|D��}dt|�j|fS)Nr&r'r$cSsg|]}|dkrt|��qS)r�)r))r^r/rrrra�sz%FileType.__repr__.<locals>.<listcomp>cSs$g|]\}}|dk	rd||f�qS)Nr"r)r^�kwr/rrrra�s�r#)r r!r"r#r,r%r&)r-r`rZargs_strrrrr2�s�zFileType.__repr__)rr�NN)r&r7r8r9rWr�r2rrrrr�s
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r
z�Simple object for storing attributes.

    Implements equality by attribute names and values, and provides a simple
    string representation.
    cKs|D]}t||||�qdSr)r�)r-rr0rrrrW�szNamespace.__init__cCst|t�stSt|�t|�kSr)r�r
�NotImplementedr�)r-�otherrrr�__eq__�s
zNamespace.__eq__cCs
||jkSr)r4)r-rrrr�__contains__�szNamespace.__contains__N)r&r7r8r9rWr3r4rrrrr
�scs�eZdZ�fdd�Zdd�Zd&dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd'dd�Zdd�Zd d!�Zd"d#�Zd$d%�Z�ZS)(�_ActionsContainercstt|���||_||_||_||_i|_|�ddt	�|�ddt	�|�ddt
�|�ddt�|�ddt�|�ddt
�|�ddt�|�ddt�|�dd	t�|�dd
t�|�ddt�|�ddt�|��g|_i|_g|_g|_i|_t�d
�|_g|_dS)NrzZstoreZstore_const�
store_trueZstore_falser(Zappend_constrrvr�parsersr�z^-\d+$|^-\d*\.\d+$)r�r5rW�description�argument_default�prefix_chars�conflict_handler�_registries�registerr�r�r�r�r�r�r�rrrr�_get_handler�_actions�_option_string_actions�_action_groups�_mutually_exclusive_groups�	_defaultsrPrQ�_negative_number_matcher�_has_negative_number_optionals)r-r8r:r9r;r�rrrW�s4z_ActionsContainer.__init__cCs|j�|i�}|||<dSr)r<r)r-�
registry_namer1r��registryrrrr=(sz_ActionsContainer.registerNcCs|j|�||�Sr)r<r�)r-rFr1r�rrr�
_registry_get,sz_ActionsContainer._registry_getcKs2|j�|�|jD]}|j|kr||j|_qdSr)rC�updater?r�r�)r-rrzrrr�set_defaults2s

z_ActionsContainer.set_defaultscCs8|jD]"}|j|kr|jdk	r|jSq|j�|d�Sr)r?r�r�rCr�)r-r�rzrrr�get_default;s
z_ActionsContainer.get_defaultcOsD|j}|r&t|�dkrH|dd|krH|r:d|kr:td��|j||�}n|j||�}d|kr�|d}||jkr~|j||d<n|jdk	r�|j|d<|�|�}t|�s�td|f��|f|�}|�	d|j
|j
�}t|�s�td	|f��|tkr�td
|f��t|d��r:z|�
��|d�Wntk
�r8td��YnX|�|�S)
z�
        add_argument(dest, ..., name=value, ...)
        add_argument(option_string, option_string, ..., name=value, ...)
        rrr�z+dest supplied twice for positional argumentr�Nzunknown action "%s"r%�%r is not callablez<%r is a FileType class object, instance of it must be passedrz,length of metavar tuple does not match nargs)r:rsr��_get_positional_kwargs�_get_optional_kwargsrCr9�_pop_action_class�callablerHr%rr�rr�r��_add_action)r-r`r�charsr�Zaction_classrz�	type_funcrrrr|Es:	 




�z_ActionsContainer.add_argumentcOs t|f|�|�}|j�|�|Sr)�_ArgumentGrouprAr()r-r`rr�rrr�add_argument_groupxsz$_ActionsContainer.add_argument_groupcKst|f|�}|j�|�|Sr)�_MutuallyExclusiveGrouprBr()r-rr�rrr�add_mutually_exclusive_group}sz._ActionsContainer.add_mutually_exclusive_groupcCs`|�|�|j�|�||_|jD]}||j|<q"|jD]"}|j�|�r8|js8|j�d�q8|S)NT)	�_check_conflictr?r(�	containerr�r@rD�matchrE)r-rzr�rrrrQ�s


z_ActionsContainer._add_actioncCs|j�|�dSr)r?�remover�rrr�_remove_action�sz _ActionsContainer._remove_actioncCs�i}|jD].}|j|kr.td�}t||j��|||j<q
i}|jD]D}|j|krn|j|j|j|jd�||j<|jD]}||j||<qtqD|jD]&}|j	|j
d�}|jD]}|||<q�q�|jD]}|�||��
|�q�dS)Nz.cannot merge actions - two groups are named %r)�titler8r;)r�)rAr]rr�rUr8r;r�rBrWr�r?r�rQ)r-rYZtitle_group_mapr�rZ	group_maprz�mutex_grouprrr�_add_container_actions�s0



�

�

z(_ActionsContainer._add_container_actionscKs^d|krtd�}t|��|�d�ttfkr2d|d<|�d�tkrPd|krPd|d<t||gd�S)Nr�z1'required' is an invalid argument for positionalsr�Tr��r�r�)rr�r�r
rr�)r-r�rrrrrrM�sz(_ActionsContainer._get_positional_kwargsc	Os�g}g}|D]n}|d|jkr>||jd�}td�}t||��|�|�|d|jkrt|�dkr|d|jkr|�|�q|�dd�}|dkr�|r�|d}n|d}|�|j�}|s�td�}t||��|�dd�}t|||d	�S)
Nr)�optionr:zNinvalid option string %(option)r: must start with a character %(prefix_chars)rrr�z%dest= is required for options like %rr(rr`)	r:rr�r(rsr��lstrip�replacer�)	r-r`rr�Zlong_option_stringsr�rr�Zdest_option_stringrrrrN�s2�

z&_ActionsContainer._get_optional_kwargscCs|�d|�}|�d||�S)Nrz)r�rH)r-rr�rzrrrrO�sz#_ActionsContainer._pop_action_classcCsFd|j}zt||�WStk
r@td�}t||j��YnXdS)Nz_handle_conflict_%sz%invalid conflict_resolution value: %r)r;r�r�rr�)r-Zhandler_func_namerrrrr>�s
z_ActionsContainer._get_handlercCsLg}|jD]&}||jkr
|j|}|�||f�q
|rH|��}|||�dSr)r�r@r(r>)r-rzZconfl_optionalsr�Zconfl_optionalr;rrrrXs


z!_ActionsContainer._check_conflictcCs6tddt|��}d�dd�|D��}t|||��dS)Nzconflicting option string: %szconflicting option strings: %sr$cSsg|]\}}|�qSrr)r^r�rzrrrras�z<_ActionsContainer._handle_conflict_error.<locals>.<listcomp>)rrsr,r)r-rz�conflicting_actionsrZconflict_stringrrr�_handle_conflict_errors�
�z(_ActionsContainer._handle_conflict_errorcCs>|D]4\}}|j�|�|j�|d�|js|j�|�qdSr)r�r[r@r�rYr\)r-rzrdr�rrr�_handle_conflict_resolves
z*_ActionsContainer._handle_conflict_resolve)N)N)r&r7r8rWr=rHrJrKr|rUrWrQr\r_rMrNrOr>rXrerfr�rrr�rr5�s$5
	
3($
		r5cs6eZdZd�fdd�	Z�fdd�Z�fdd�Z�ZS)	rTNcs�|j}|d|j�|d|j�|d|j�tt|�j}|fd|i|��||_g|_|j	|_	|j
|_
|j|_|j|_|j
|_
|j|_dS)Nr;r:r9r8)rr;r:r9r�rTrWr]r�r<r?r@rCrErB)r-rYr]r8rrIZ
super_initr�rrrW+s�z_ArgumentGroup.__init__cs tt|��|�}|j�|�|Sr)r�rTrQr�r(r�r�rrrQAsz_ArgumentGroup._add_actioncs tt|��|�|j�|�dSr)r�rTr\r�r[r�r�rrr\Fsz_ArgumentGroup._remove_action)NN�r&r7r8rWrQr\r�rrr�rrT)srTcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	rVFcs tt|��|�||_||_dSr)r�rVrWr��
_container)r-rYr�r�rrrWMsz _MutuallyExclusiveGroup.__init__cCs2|jrtd�}t|��|j�|�}|j�|�|S)Nz-mutually exclusive arguments must be optional)r�rr�rhrQr�r()r-rzrrrrrQRsz#_MutuallyExclusiveGroup._add_actioncCs|j�|�|j�|�dSr)rhr\r�r[r�rrrr\Zsz&_MutuallyExclusiveGroup._remove_action)Frgrrr�rrVKsrVcs*eZdZdZddddgeddddddf�fdd�	Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dAdd�ZdBdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdCd&d'�ZdDd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdEd6d7�ZdFd8d9�ZdGd:d;�ZdHd=d>�Z d?d@�Z!�Z"S)Ira�Object for parsing command line strings into Python objects.

    Keyword Arguments:
        - prog -- The name of the program (default: sys.argv[0])
        - usage -- A usage message (default: auto-generated from arguments)
        - description -- A description of what the program does
        - epilog -- Text following the argument descriptions
        - parents -- Parsers whose arguments should be copied into this one
        - formatter_class -- HelpFormatter class for printing help messages
        - prefix_chars -- Characters that prefix optional arguments
        - fromfile_prefix_chars -- Characters that prefix files containing
            additional arguments
        - argument_default -- The default value for all arguments
        - conflict_handler -- String indicating how to handle conflicts
        - add_help -- Add a -h/-help option
        - allow_abbrev -- Allow long options to be abbreviated unambiguously
    Nr(r+Tc
	s"tt|�j}
|
|||	|
d�|dkr6tj�tjd�}||_||_	||_
||_||_||_
||_|j}|td��|_|td��|_d|_dd�}|�dd|�d|kr�dn|d}|j
r�|j|d	|d
ddttd�d
�|D]<}|�|�z
|j}Wntk
�rYq�X|j�|�q�dS)N)r8r:r9r;rzpositional argumentszoptional argumentscSs|Srr)r.rrr�identity�sz)ArgumentParser.__init__.<locals>.identityr%r(�hr=rvzshow this help message and exit)rzr�rv)r�rrW�_os�path�basenamer
�argvrUrm�epilog�formatter_class�fromfile_prefix_chars�add_help�allow_abbrevrUr�_positionals�
_optionals�_subparsersr=r|rr_rCr�rI)r-rUrmr8ro�parentsrpr:rqr9r;rrrsZ	superinitZ	add_groupriZdefault_prefixr\�defaultsr�rrrWrsJ�
�

zArgumentParser.__init__cs"ddddddg}�fdd�|D�S)	NrUrmr8rpr;rrcsg|]}|t�|�f�qSrr�r�r6rrra�sz.ArgumentParser._get_kwargs.<locals>.<listcomp>rr�rr6rr*�s�zArgumentParser._get_kwargsc	Ks�|jdk	r|�td��|�dt|��d|ks8d|krht|�dd��}t|�dd��}|�||�|_n|j|_|�d�dkr�|�	�}|�
�}|j}|�|j
||d�|����|d<|�|d�}|fd	gi|��}|j�|�|S)
Nz(cannot have multiple subparser argumentsrr]r8ZsubcommandsrUrbr7r�)rvr+rrr%r�rUrtr�r�_get_positional_actionsrBrqrmrer�rOrQ)	r-rr]r8r[r�roZ
parsers_classrzrrr�add_subparsers�s$
zArgumentParser.add_subparserscCs$|jr|j�|�n|j�|�|Sr)r�rurQrtr�rrrrQ�szArgumentParser._add_actioncCsdd�|jD�S)NcSsg|]}|jr|�qSr�r��r^rzrrrra�s�z8ArgumentParser._get_optional_actions.<locals>.<listcomp>�r?r6rrr�_get_optional_actions�s�z$ArgumentParser._get_optional_actionscCsdd�|jD�S)NcSsg|]}|js|�qSrr{r|rrrra�s�z:ArgumentParser._get_positional_actions.<locals>.<listcomp>r}r6rrrry�s�z&ArgumentParser._get_positional_actionscCs4|�||�\}}|r0td�}|�|d�|��|S�Nzunrecognized arguments: %sr�)rrr+r,�r-r`r�rnrrrr�
parse_args�s
zArgumentParser.parse_argscCs|dkrtjdd�}nt|�}|dkr.t�}|jD]4}|jtk	r4t||j�s4|jtk	r4t	||j|j�q4|j
D] }t||�spt	|||j
|�qpz>|�||�\}}t|t�r�|�
t|t��t|t�||fWStk
�rt��d}|�t|��YnXdSr)r
rnr:r
r?r�rr�r�r�rC�_parse_known_argsrr�r��delattrr�exc_infor+r�)r-r`r�rzr��errrrrr�s,







zArgumentParser.parse_known_argscs�	jdk	r�	����i��	jD]R}|j}t|j�D]<\}}��|g�}|�|d|��|�||dd��q2qi�g}t��}	t|	�D]^\}}
|
dkr�|�d�|	D]}
|�d�q�q��	�	|
�}|dkr�d}n|�|<d}|�|�q�d�
|��t��t��d�����	fdd�	������	�fd	d
�}
�	�������	�fdd�}g�d
�
��r`t
��}nd}�
|k�r�t�
fdd��D��}�
|k�r�|�
�}|�
k�r�|�
�qdn|�
�
�k�r҈�
|�}��|�|�
|
�
��
�qd|�
�}���|d��g}�	jD]|}|�k�r|j�r(|�t|��nT|jdk	�rt|jt��rt�|j��r|jt�|j�k�rt�|j�	�||j���q|�r��	�td�d�
|���	jD]X}|j�r�|jD]}|�k�r��q��q�dd�|jD�}td�}�	�|d�
|���q���fS)Nr�--r(�A�Orbcs|��|���||�}||jk	rb��|���|g�D]*}|�kr6td�}t|�}t|||��q6|tk	rx|��||�dS)Nznot allowed with argument %s)r��_get_valuesr�r�rr�rr)rzZargument_stringsr�Zargument_valuesZconflict_actionrZaction_name)�action_conflictsr��seen_actions�seen_non_default_actionsr-rr�take_actionLs


z5ArgumentParser._parse_known_args.<locals>.take_actioncs��|}|\}}}�j}g}|dkr:���|�|dS|dk	�r||d�}�j}|dkr�|d|kr�|�|g|f�|d}	|	|d}|dd�p�d}
�j}||kr�||}|
}ntd�}t|||��nB|dkr�|d}
|g}|�|||f��q\ntd�}t|||��q|d}�|d�}|||�}||}
�||
�}|�|||f��q\q|�sft�|D]\}}}�|||��qj|
S)Nrr�rzignored explicit argument %r)�_match_argumentr(r:r@rrrY)�start_index�option_tuplerzr��explicit_argZmatch_argumentZ
action_tuples�	arg_countrR�charZnew_explicit_argZ
optionals_mapr�stopr`r�Zselected_patterns)r.�arg_strings_pattern�extras�option_string_indicesr-r�rr�consume_optionalasN




z:ArgumentParser._parse_known_args.<locals>.consume_optionalcsn�j}�|d�}|�|�}t�|�D]*\}}�|||�}||7}�||�q&�t|�d��dd�<|Sr)�_match_arguments_partial�ziprs)r�Z
match_partialZselected_patternZ
arg_countsrzr�r`)r.r�r�r-r�rr�consume_positionals�s
z=ArgumentParser._parse_known_args.<locals>.consume_positionalsrr�csg|]}|�kr|�qSrr)r^r�)r�rrra�s�z4ArgumentParser._parse_known_args.<locals>.<listcomp>z(the following arguments are required: %sr$cSsg|]}|jtk	rt|��qSr)rvrr�r|rrrra
s
�z#one of the arguments %s is requiredr�)N)rq�_read_args_from_filesrBr�r�rr��iterr(�_parse_optionalr,r�ryrGrFr?r�r�r�r�r�r�r�r�r��
_get_valuer+r)r-r.r�r^r�r�Zmutex_actionZ	conflictsZarg_string_pattern_partsZarg_strings_iter�
arg_stringr��patternr�r�Zmax_option_string_indexZnext_option_string_indexZpositionals_end_indexZstringsZ
stop_indexZrequired_actionsrzr�r�rr)r�r.r�r�r�r�r�r�r�r-r�r�rr�s�





J

�






�
���
�



�z ArgumentParser._parse_known_argsc
Cs�g}|D]�}|r|d|jkr*|�|�qzdt|dd���J}g}|����D]}|�|�D]}|�|�q\qN|�|�}|�|�W5QRXWqtk
r�t	�
�d}|�t|��YqXq|Sr�)
rqr(r��readr��convert_arg_line_to_argsr�r�r-r
r�r+r�)r-r.Znew_arg_stringsr�Z	args_file�arg_liner/r�rrrr�s 
z$ArgumentParser._read_args_from_filescCs|gSrr)r-r�rrrr�-sz'ArgumentParser.convert_arg_line_to_argscCsz|�|�}t�||�}|dkrldtd�ttd�ttd�i}|�|j�}|dkrbtdd|j�|j}t	||��t
|�d��S)Nzexpected one argumentzexpected at most one argumentzexpected at least one argumentzexpected %s argumentzexpected %s argumentsr)�_get_nargs_patternrPrZrr
rr�r�rrrsr�)r-rzr��
nargs_patternrZZnargs_errorsrrrrr�0s(
���
zArgumentParser._match_argumentcsrg}tt|�dd�D]X}|d|�}d��fdd�|D��}t�||�}|dk	r|�dd�|��D��qnq|S)Nrr�rbcsg|]}��|��qSr)r�r|r6rrraLs�z;ArgumentParser._match_arguments_partial.<locals>.<listcomp>cSsg|]}t|��qSrrr)r^r.rrrraPs)r�rsr,rPrZr�ro)r-rnr�r�r�Z
actions_slicer�rZrr6rr�Fs�z'ArgumentParser._match_arguments_partialc
Cs|sdS|d|jkrdS||jkr8|j|}||dfSt|�dkrHdSd|kr~|�dd�\}}||jkr~|j|}|||fS|�|�}t|�dkr�d�dd�|D��}||d�}td�}|�||�nt|�dkr�|\}	|	S|j�	|�r�|j
s�dSd	|k�rdSd|dfS)
Nrr�=r$cSsg|]\}}}|�qSrr)r^rzr�r�rrrraus�z2ArgumentParser._parse_optional.<locals>.<listcomp>)raZmatchesz4ambiguous option: %(option)s could match %(matches)sr�)r:r@rs�split�_get_option_tuplesr,rr+rDrZrE)
r-r�rzr�r�Z
option_tuplesZoptionsr`rr�rrrr�Vs>







�

zArgumentParser._parse_optionalc
Cs0g}|j}|d|kr�|d|kr�|jr~d|krB|�dd�\}}n|}d}|jD],}|�|�rP|j|}|||f}|�|�qPn�|d|k�r|d|k�r|}d}|dd�}|dd�}	|jD]T}||kr�|j|}|||	f}|�|�q�|�|�r�|j|}|||f}|�|�q�n|�td�|�|S)Nrrr�r=zunexpected option string: %s)r:rsr�r@�
startswithr(r+r)
r-r�r�rRZ
option_prefixr�rzr�Zshort_option_prefixZshort_explicit_argrrrr��s:









z!ArgumentParser._get_option_tuplescCs�|j}|dkrd}nf|tkr"d}nX|tkr0d}nJ|tkr>d}n<|tkrLd}n.|tkrZd}n |tkrhd}ndd	�d
|�}|jr�|�	d	d�}|�	dd�}|S)
Nz(-*A-*)z(-*A?-*)z	(-*[A-]*)z
(-*A[A-]*)z([-AO]*)z(-*A[-AO]*)z(-*-*)z(-*%s-*)z-*r�rbr()
r�r
rrrrrr,r�rc)r-rzr�r�rrrr��s(z!ArgumentParser._get_nargs_patterncCs4|�||�\}}|r0td�}|�|d�|��|Sr)�parse_known_intermixed_argsrr+r,r�rrr�parse_intermixed_args�s
z$ArgumentParser.parse_intermixed_argsc	s�|���dd��D�}|r,td|dj���fdd�|jD�rHtd���zN|j}z�|jdkrp|��dd�|_�D] }|j|_t	|_|j|_t	|_qt|�
||�\}}�D]J}t||j�r�t
||j�gkr�ddlm}|d	|j|f�t||j�q�W5�D]}|j|_|j|_q�X|��}zJ|D]}|j|_d
|_�q$|jD]}	|	j|	_d
|	_�q@|�
||�\}}
W5|D]}|j|_�qn|jD]}	|	j|	_�q�XW5||_X||
fS)NcSsg|]}|jttfkr|�qSr)r�rrr|rrrra	s�z>ArgumentParser.parse_known_intermixed_args.<locals>.<listcomp>z3parse_intermixed_args: positional arg with nargs=%srcs&g|]}|jD]}|�kr|j�qqSr)r�r�)r^r�rz�r�rrra		s
�z;parse_intermixed_args: positional in mutuallyExclusiveGroup�)�warnzDo not expect %s in %sF)ryr�r�rBrmZ
save_nargsZsave_defaultr��format_usagerrr�r�r��warningsr�r�r~Z
save_requiredr�)r-r`r��aZ
save_usagerzZremaining_argsr�r�r�r�rr�rr��s`
�
��


�
z*ArgumentParser.parse_known_intermixed_argscs��jttfkr2z|�d�Wntk
r0YnX|sz�jtkrz�jrN�j}n�j}t	|t
�rv���|�}���|��n|s��jt
kr��js��jdk	r��j}n|}���|�n�t|�dkr�jdtfkr�|\}���|�}���|�n��jtk�r��fdd�|D�}np�jtk�r@��fdd�|D�}���|d�n>�jtk�rRt}n,��fdd�|D�}|D]}���|��qj|S)Nr�rcsg|]}���|��qSr�r��r^�v�rzr-rrraf	sz.ArgumentParser._get_values.<locals>.<listcomp>csg|]}���|��qSrr�r�r�rrraj	srcsg|]}���|��qSrr�r�r�rrras	s)r�rrr[r�r
r�r�r�r�r�r��_check_valuerrsr)r-rzr.r1r�r�rr�rr�B	sD
�
zArgumentParser._get_valuesc	Cs�|�d|j|j�}t|�s0td�}t|||��z||�}Wn�tk
r~t|jdt|j��}tt	�
�d�}t||��YnLttfk
r�t|jdt|j��}||d�}td�}t|||��YnX|S)Nr%rLr&r)r%r1z!invalid %(type)s value: %(value)r)
rHr%rPrrrr�r)r�r
r�r�r�)r-rzr�rSrr�r0r`rrrr�z	s 
zArgumentParser._get_valuecCsF|jdk	rB||jkrB|d�tt|j��d�}td�}t|||��dS)Nr$)r1r�z3invalid choice: %(value)r (choose from %(choices)s))r�r,�mapr)rr)r-rzr1r`rrrrr��	s�zArgumentParser._check_valuecCs$|��}|�|j|j|j�|��Sr)rrqrmr?rBre)r-r[rrrr��	s
�zArgumentParser.format_usagecCst|��}|�|j|j|j�|�|j�|jD]0}|�|j	�|�|j�|�
|j�|��q.|�|j
�|��Sr)rrqrmr?rBrkr8rArgr]r}r�rhrore)r-r[Zaction_grouprrrre�	s�

zArgumentParser.format_helpcCs|j|jd�S)Nr�)rprUr6rrrr�	szArgumentParser._get_formattercCs"|dkrtj}|�|��|�dSr)r
rr	r��r-�filerrr�print_usage�	szArgumentParser.print_usagecCs"|dkrtj}|�|��|�dSr)r
rr	rer�rrrr�	szArgumentParser.print_helpcCs |r|dkrtj}|�|�dSr)r
�stderr�write)r-rr�rrrr	�	szArgumentParser._print_messagercCs |r|�|tj�t�|�dSr)r	r
r�r)r-Zstatusrrrrr�	szArgumentParser.exitcCs0|�tj�|j|d�}|�dtd�|�dS)z�error(message: string)

        Prints a usage message incorporating the message to stderr and
        exits.

        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        )rUrr=z%(prog)s: error: %(message)s
N)r�r
r�rUrr)r-rr`rrrr+�	s	zArgumentParser.error)NN)NN)NN)NN)N)N)N)rN)#r&r7r8r9rrWr*rzrQr~ryr�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�rerr�rr	rr+r�rrr�rr_sV�@

#w:-1

M8


	
)2r9�__version__�__all__�osrk�rerP�sysr
rrrrCrr
rrrrrr�r!r<rrrrr	r��	Exceptionrrrr�r�r�r�r�r�r�rrrrrr
r5rTrVrrrrr�<module>s�=�~
	[#&]7:"

Zerion Mini Shell 1.0