ok

Mini Shell

Direktori : /lib/python3.6/site-packages/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/__pycache__/configargparse.cpython-36.pyc

3

�`;\֠�@s�ddlZddlZddlZddlZddlZddlZejdkrHddlmZnddlmZejd krlddl	m
Z
nddlm
Z
ejej
ejejejfZiZd!dd�Zd"d	d
�ZGdd�dejejej�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdZdZ dZ!dZ"Gdd�dej#�Z#dd�Z$dd�Z%ej&j$ej&_'e$ej&_$ej(Z(ejZejZejZej)Z)ej*Z*ej+Z+ej,Z,ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2eZ3eZ4eZ5eZ6eZ7eZ8e#Z9e#Z:ej&j$ej&_;ej&j$ej&_<e#j=e#_>e#j?e#_@eZAeZBeZCdS)#�N�)�StringIO��)�OrderedDictcKsT|dkrd}|tkr(td|t|f��|jdtj�|jdd�tf|�t|<dS)z�Creates a global ArgumentParser instance with the given name,
    passing any args other than "name" to the ArgumentParser constructor.
    This instance can then be retrieved using get_argument_parser(..)
    N�defaultzbkwargs besides 'name' can only be passed in the first time. '%s' ArgumentParser already exists: %sZformatter_classZconflict_handlerZresolve)�_parsers�
ValueError�
setdefault�argparse�ArgumentDefaultsHelpFormatter�ArgumentParser)�name�kwargs�r�$/usr/lib/python3.6/configargparse.py�init_argument_parsersrcKs4|dkrd}t|�dks |tkr,t|f|�t|S)aReturns the global ArgumentParser instance with the given name. The 1st
    time this function is called, a new ArgumentParser instance will be created
    for the given name, and any args other than "name" will be passed on to the
    ArgumentParser constructor.
    Nrr)�lenrr)rrrrr�get_argument_parser.s
rc@seZdZdZdS)� ArgumentDefaultsRawHelpFormatterzCHelpFormatter that adds default values AND doesn't do line-wrappingN)�__name__�
__module__�__qualname__�__doc__rrrrr=src@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ConfigFileParserzRThis abstract class can be extended to add support for new config file
    formatscCstd��dS)z3Returns a string describing the config file syntax.z*get_syntax_description(..) not implementedN)�NotImplementedError)�selfrrr�get_syntax_descriptionIsz'ConfigFileParser.get_syntax_descriptioncCstd��dS)aNParses the keys and values from a config file.

        NOTE: For keys that were specified to configargparse as
        action="store_true" or "store_false", the config file value must be
        one of: "yes", "no", "true", "false". Otherwise an error will be raised.

        Args:
            stream: A config file input stream (such as an open file object).

        Returns:
            OrderedDict of items where the keys have type string and the
            values have type either string or list (eg. to support config file
            formats like YAML which allow lists).
        zparse(..) not implementedN)r)r�streamrrr�parseMszConfigFileParser.parsecCstd��dS)a�Does the inverse of config parsing by taking parsed values and
        converting them back to a string representing config file contents.

        Args:
            items: an OrderedDict of items to be converted to the config file
            format. Keys should be strings, and values should be either strings
            or lists.

        Returns:
            Contents of config file as a string
        zserialize(..) not implementedN)r)r�itemsrrr�	serialize^szConfigFileParser.serializeN)rrrrrrr!rrrrrEsrc@seZdZdZdS)�ConfigFileParserExceptionz'Raised when config file parsing failed.N)rrrrrrrrr"msr"c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�DefaultConfigFileParsera�Based on a simplified subset of INI and YAML formats. Here is the
    supported syntax:


        # this is a comment
        ; this is also a comment (.ini style)
        ---            # lines that start with --- are ignored (yaml style)
        -------------------
        [section]      # .ini-style section names are treated as comments

        # how to specify a key-value pair (all of these are equivalent):
        name value     # key is case sensitive: "Name" isn't "name"
        name = value   # (.ini style)  (white space is ignored, so name = value same as name=value)
        name: value    # (yaml style)
        --name value   # (argparse style)

        # how to set a flag arg (eg. arg which has action="store_true")
        --name
        name
        name = True    # "True" and "true" are the same

        # how to specify a list arg (eg. arg which has action="append")
        fruit = [apple, orange, lemon]
        indexes = [1, 12, 35 , 40]

    cCsd}|S)NzrConfig file syntax allows: key=value, flag=true, stuff=[a,b,c] (for details, see syntax at https://goo.gl/R74nmi).r)r�msgrrrr�sz.DefaultConfigFileParser.get_syntax_descriptioncCs&t�}�xt|�D�]
\}}|j�}|s|ddks|jd�rBqd}d}|d|d	}|d
}tjd||d|�}	|	r�|	jd
�}d||<qtjd|||d|�}
|
�r|
jd
�}|
jd�}|jd�o�|jd��r�dd�|dd�jd�D�}|||<qt	d|t
|dd�|f��qW|S)z,Parses the keys + values from a config file.r�#�;�[z---z\s*z(?P<key>[^:=;#\s]+?)z[:=\s]z(?P<value>.+?)z(?P<comment>\s[;#].*)?�^�$�key�true�value�]cSsg|]}|j��qSr)�strip)�.0�elemrrr�
<listcomp>�sz1DefaultConfigFileParser.parse.<locals>.<listcomp>��,zUnexpected line %s in %s: %srr)r%r&r'���)r�	enumerater.�
startswith�re�match�group�endswith�splitr"�getattr)rrr �i�lineZwhite_spacer*r,ZcommentZkey_only_matchZkey_value_matchrrrr�s2


zDefaultConfigFileParser.parsecCsXt�}xH|j�D]<\}}t|t�r:ddjtt|��d}|jd||f�qW|j�S)z�Does the inverse of config parsing by taking parsed values and
        converting them back to a string representing config file contents.
        r'z, r-z%s = %s
)	rr �
isinstance�list�join�map�str�write�getvalue)rr �rr*r,rrrr!�s
z!DefaultConfigFileParser.serializeN)rrrrrrr!rrrrr#qs#r#c@s2eZdZdZdd�Zdd�Zdd�Zdd	d
�ZdS)
�YAMLConfigFileParserzdParses YAML config files. Depends on the PyYAML module.
    https://pypi.python.org/pypi/PyYAML
    cCsd}|S)NzThe config file uses YAML syntax and must represent a YAML 'mapping' (for details, see http://learn.getgrav.org/advanced/yaml).r)rr$rrrr�sz+YAMLConfigFileParser.get_syntax_descriptioncCs.yddl}Wntk
r(td��YnX|S)zmlazy-import PyYAML so that configargparse doesn't have to dependend
        on it unless this parser is used.rNzJCould not import yaml. It can be installed by running 'pip install PyYAML')�yaml�ImportErrorr")rrHrrr�
_load_yaml�s
zYAMLConfigFileParser._load_yamlcCs�|j�}y|j|�}Wn.tk
rD}ztd|��WYdd}~XnXt|t�sntdt|dd�t|�jf��t	�}x4|j
�D](\}}t|t�r�|||<q~t|�||<q~W|S)z.Parses the keys and values from a config file.zCouldn't parse config file: %sNz�The config file doesn't appear to contain 'key: value' pairs (aka. a YAML mapping). yaml.load('%s') returned type '%s' instead of 'dict'.rr)
rJZ	safe_load�	Exceptionr"r?�dictr<�typerrr r@rC)rrrHZ
parsed_obj�e�resultr*r,rrrr�s


zYAMLConfigFileParser.parseFcCs|j�}t|�}|j||d�S)z�Does the inverse of config parsing by taking parsed values and
        converting them back to a string representing config file contents.

        Args:
            default_flow_style: defines serialization format (see PyYAML docs)
        )�default_flow_style)rJrL�dump)rr rPrHrrrr!�s	zYAMLConfigFileParser.serializeN)F)rrrrrrJrr!rrrrrG�s
rGZcommand_lineZenvironment_variables�config_file�defaultsc@s�eZdZdZdddgdegddgdfdd�Zdddejfd	d
�Zdddejfdd�Z	dd
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zejfdd�Zdd�ZdS) r
z�Drop-in replacement for argparse.ArgumentParser that adds support for
    environment variables and .ini or .yaml-style config files.
    TNFzconfig file pathzftakes the current command line args and writes them out to a config file at the given path, then exitsc
Ks�||_||_||_tjj|f|�|dkr4t�|_n|�|_||_||_	|rb|j
|d||	dd��|
r||j
|
dd|dd��dS)a�Supports args of the argparse.ArgumentParser constructor
        as **kwargs, as well as the following additional args.

        Additional Args:
            add_config_file_help: Whether to add a description of config file
                syntax to the help message.
            add_env_var_help: Whether to add something to the help message for
                args that can be set through environment variables.
            auto_env_var_prefix: If set to a string instead of None, all config-
                file-settable options will become also settable via environment
                variables whose names are this prefix followed by the config
                file key, all in upper case. (eg. setting this to "foo_" will
                allow an arg like "--my-arg" to also be set via the FOO_MY_ARG
                environment variable)
            default_config_files: When specified, this list of config files will
                be parsed in order, with the values from each config file
                taking precedence over pervious ones. This allows an application
                to look for config files in multiple standard locations such as
                the install directory, home directory, and current directory.
                Also, shell * syntax can be used to specify all conf files in a
                directory. For exmaple:
                ["/etc/conf/app_config.ini",
                 "/etc/conf/conf-enabled/*.ini",
                "~/.my_app_config.ini",
                "./app_config.txt"]
            ignore_unknown_config_file_keys: If true, settings that are found
                in a config file but don't correspond to any defined
                configargparse args will be ignored. If false, they will be
                processed and appended to the commandline like other args, and
                can be retrieved using parse_known_args() instead of parse_args()
            config_file_parser_class: configargparse.ConfigFileParser subclass
                which determines the config file format. configargparse comes
                with DefaultConfigFileParser and YAMLConfigFileParser.
            args_for_setting_config_path: A list of one or more command line
                args to be used for specifying the config file path
                (eg. ["-c", "--config-file"]). Default: []
            config_arg_is_required: When args_for_setting_config_path is set,
                set this to True to always require users to provide a config path.
            config_arg_help_message: the help message to use for the
                args listed in args_for_setting_config_path.
            args_for_writing_out_config_file: A list of one or more command line
                args to use for specifying a config file output path. If
                provided, these args cause configargparse to write out a config
                file with settings based on the other provided commandline args,
                environment variants and defaults, and then to exit.
                (eg. ["-w", "--write-out-config-file"]). Default: []
            write_out_config_file_arg_help_message: The help message to use for
                the args in args_for_writing_out_config_file.
        NrRT)�destZrequired�help�is_config_file_argZ"write_out_config_file_to_this_pathZCONFIG_OUTPUT_PATH)rT�metavarrU�is_write_out_config_file_arg)�_add_config_file_help�_add_env_var_help�_auto_env_var_prefixrr
�__init__r#�_config_file_parser�_default_config_files� _ignore_unknown_config_file_keys�add_argument)
rZadd_config_file_helpZadd_env_var_helpZauto_env_var_prefix�default_config_filesZignore_unknown_config_file_keysZconfig_file_parser_classZargs_for_setting_config_pathZconfig_arg_is_requiredZconfig_arg_help_messageZ args_for_writing_out_config_fileZ&write_out_config_file_arg_help_messagerrrrr\s&B

zArgumentParser.__init__cCs2|j||||d�\}}|r.|jddj|��|S)aTSupports all the same args as the ArgumentParser.parse_args(..),
        as well as the following additional args.

        Additional Args:
            args: a list of args as in argparse, or a string (eg. "-x -y bla")
            config_file_contents: String. Used for testing.
            env_vars: Dictionary. Used for testing.
        )�args�	namespace�config_file_contents�env_varszunrecognized arguments: %s� )�parse_known_args�errorrA)rrbrcrdre�argvrrr�
parse_argshs
zArgumentParser.parse_argscs��dkrtjdd��nt�t�r,�j��nt���t�}xV�D]N}|r�|d�jkr�d|kr�|jdd�\}}|j|�|j|�q@|j|�q@W|�x�jD]}	|	j	|	_
q�Wt��_�r�dt��f}
d|
i�jt
<�jdk	�rdx��jD]v}	�j|	�}|r�|	j�p4|	j
�p4|	j�p4|	j�p4t|	tj��p4t|	tj�r�|dj�j�}�j|jdd�j�|	_q�Wg}
��fdd	��jD�}xp|D]h}|j}�|}|j�s�t|tj��r�tjd
|�}|�r�dd	�|jd�jd�D�}|
�j|||�7}
�q�W�|
�|
�rt�fd
d	�|D���jt<t dd��jD��}|�oDd�k�pDd�k}t!�fdd��jD��}g}|dk	�r�t"|�}d|_#|g}n|�s��j$��}�x"t%|�D�]}zDy�j&j'|�}Wn.t(k
�r�}z�j)|�WYdd}~XnXWdt*|d��r�|j+�Xg}x�|j,�D]�\}}||k�r6||}t-�|j	�}nd}�j.�pRt-��j/|�g�}|�s|�j|||�7}dt0|j#f}|�jk�r�t��j|<||f�j||<�qW�|��q�Wt�}x��jD]�}|j
�p�|jt1t2gk}t-�|j	��s�|�s�|j3dk�s�|j3t4k�s�t|t5��r"�q�n,|j	�r6|j	d}n|j6}|t|j3�f||<�q�W|�rd|�jt7<tj8j9���d�\�}�fdd	��jD�}dd	�|D�}�j:�|dd��|fS)aTSupports all the same args as the ArgumentParser.parse_args(..),
        as well as the following additional args.

        Additional Args:
            args: a list of args as in argparse, or a string (eg. "-x -y bla")
            config_file_contents: String. Used for testing.
            env_vars: Dictionary. Used for testing.
        Nr2r�=��-�_cs6g|].}|jr|jr|j�krt�|j�r|�qSr)�is_positional_arg�env_var�already_on_command_line�option_strings)r/�a)rbrerrr1�sz3ArgumentParser.parse_known_args.<locals>.<listcomp>z\[(.*)\]cSsg|]}|j�r|j��qSr)r.)r/�valrrrr1�sr3cs g|]}|j|�|jff�qSr)rp)r/rs)rerrr1�scss|]}t|tj�r|VqdS)N)r?r�_HelpAction)r/rsrrr�	<genexpr>�sz2ArgumentParser.parse_known_args.<locals>.<genexpr>z-hz--helpc3s&|]}�j|�D]}||fVqqdS)N)�get_possible_config_keys)r/�actionZ
config_key)rrrrv�sz
method arg�closez%s|%s)rbrccs&g|]}t|dd�rt�|jd��qS)rXFN)r<rT)r/rs)rcrrr1scSsg|]}|dk	r|�qS)Nr)r/rsrrrr1sT)�
exit_afterr4);�sysrir?rCr;r@�prefix_chars�append�_actionsrrror�_source_to_settings�_COMMAND_LINE_SOURCE_KEYr[rwrprVrXrZ_VersionActionrur.�replace�upper�nargs�
_AppendActionr7r8r9� convert_item_to_command_line_arg�_ENV_VAR_SOURCE_KEY�anyrLrr�_open_config_files�reversedr]rr"rh�hasattrryr rqr_�4get_command_line_key_for_unknown_config_file_setting�_CONFIG_FILE_SOURCE_KEY�OPTIONAL�ZERO_OR_MOREr�SUPPRESS�#ACTION_TYPES_THAT_DONT_NEED_A_VALUErT�_DEFAULTS_SOURCE_KEYr
rg�write_config_file)rrbrcrdreZnormalized_args�argr*r,rsZa_v_pair�config_file_keysZstripped_config_file_keyZenv_var_argsZactions_with_env_var_valuesrxZelement_captureZsupports_help_argZskip_config_file_parsingZknown_config_keysZconfig_streamsr�config_itemsrNZconfig_argsZdiscard_this_keyZ
source_keyZdefault_settingsZcares_about_default_valueZunknown_args�output_file_pathsr)rbrercrrrg{s�









 



zArgumentParser.parse_known_argsc
Cs�xZ|D]R}yt|d��}WdQRXWqtk
rV}ztd||f��WYdd}~XqXqW|r�|j|j|�}|jj|�}x,|D]$}t|d��}|j|�WdQRXq�Wddj|�}	|r�|j	d|	�nt
|	�dS)a4Write the given settings to output files.

        Args:
            parsed_namespace: namespace object created within parse_known_args()
            output_file_paths: any number of file paths to write the config to
            exit_after: whether to exit the program after writing the config files
        �wNz Couldn't open %s for writing: %szWrote config file to z, r)�open�IOErrorr	� get_items_for_config_file_outputrr]r!rDrA�exit�print)
r�parsed_namespacer�rzZoutput_file_pathZoutput_filerNr�Z
file_contents�messagerrrr�s$
"

z ArgumentParser.write_config_filecCs"|j|j�}|jdd|}|S)aCompute a commandline arg key to be used for a config file setting
        that doesn't correspond to any defined configargparse arg (and so
        doesn't have a user-specified commandline arg key).

        Args:
            key: The config file key that was being set.
        rr)r.r|)rr*Zkey_without_prefix_chars�command_line_keyrrrr�=szCArgumentParser.get_command_line_key_for_unknown_config_file_settingcCs�t�}�xt|j�D�]f\}}|tkr�|d\}}xh|jD]^}|j|�}	|	r8|jr8t||j�r8t||j	d�}
|
dk	r8t
|
t�r�t|
�j
�}
|
||	d<q8Wq|tkr�x�|j�D]<\}\}}
|j|�}	|	r�t||j	d�}
|
dk	r�|
||	d<q�Wq|jt��r"x||j�D]\}\}}
|
||<�qWq|tkrxN|j�D]B\}\}}
|j|�}	|	�r4t||j	d�}
|
dk	�r4|
||	d<�q4WqW|S)a�Converts the given settings back to a dictionary that can be passed
        to ConfigFormatParser.serialize(..).

        Args:
            source_to_settings: the dictionary described in parse_known_args()
            parsed_namespace: namespace object created within parse_known_args()
        Returns:
            an OrderedDict where keys are strings and values are either strings
            or lists
        rlNr)rr r�r~rwrorqrrr<rTr?�boolrC�lowerr�r6r�r�)rZsource_to_settingsr�Zconfig_file_items�source�settingsrnZexisting_command_line_argsrxr�r,r*rrrr�Js@




z/ArgumentParser.get_items_for_config_file_outputcCs\g}|dkr|j|�}n
|jd}|dk	rnt|t�rn|j�dkrL|j|�n |j�dkrZn|jd	||f�n�t|t��r"|dks�t|tj	�r�x�|D]}|j|�|jt
|��q�Wnjt|tj�r�|jdks�t|jt
�o�|jdk�r|j|�x0|D]}|jt
|���q�Wn|jd||f�n6t|t
��rD|j|�|j|�ntd
t|�|f��|S)a�Converts a config file or env var key + value to a list of
        commandline args to append to the commandline.

        Args:
            action: The argparse Action object for this setting, or None if this
                config file setting doesn't correspond to any defined
                configargparse arg.
            key: string (config file key or env var name)
            value: parsed value of type string or list
        Nr2r+�yes�1�false�no�0zQUnexpected value for %s: '%s'. Expecting 'true', 'false', 'yes', 'no', '1' or '0'�+�*zp%s can't be set to a list '%s' unless its action type is changed to 'append' or nargs is set to '*', '+', or > 1z&Unexpected value type %s for value: %sr4)r+r�r�)r�r�r�)r�r�)r�rrr?r�r�r}rhr@rr�rC�_StoreActionr��intr	rM)rrxr*r,rbr�Z	list_elemrrrr�xs:





z/ArgumentParser.convert_item_to_command_line_argcsTg}t|dd�r|Sx:|jD]0�t�fdd�|jD��r|�dd��g7}qW|S)z�This method decides which actions can be set in a config file and
        what their keys will be. It returns a list of 0 or more config keys that
        can be used to set the given action's value in a config file.
        rXNcsg|]}�jd|��qS)r)r6)r/�c)r�rrr1�sz;ArgumentParser.get_possible_config_keys.<locals>.<listcomp>r)r<rrr�r|)rrx�keysr)r�rrw�sz'ArgumentParser.get_possible_config_keyscCs�dd�ttjttjj|j��D�}dd�|jD�}|s:|Sx�|D]�}tj|j	dd�}|j
|�dd�}tj||�|_
|j|d�}|s�q@|\}}	t||jd	�}
|
s�q@tjj|
�}
tjj|
�s�|j
d
|
�|t|
�g7}q@W|S)ajTries to parse config file path(s) from within command_line_args.
        Returns a list of opened config files, including files specified on the
        commandline as well as any default_config_files specified in the
        constructor that are present on disk.

        Args:
            command_line_args: List of all args (already split on spaces)
        cSsg|]}|D]}t|��qqSr)r�)r/�files�frrrr1�sz5ArgumentParser._open_config_files.<locals>.<listcomp>cSsg|]}t|dd�r|�qS)rVF)r<)r/rsrrrr1�sF)r|Zadd_helpcSsdS)Nr)rr�rrr�error_method�sz7ArgumentParser._open_config_files.<locals>.error_method)rbNzFile not found: %s)rB�glob�os�path�
expanduserr^r~rr
r|Z_add_action�types�
MethodTyperhrgr<rT�isfiler�)rZcommand_line_argsZconfig_filesZuser_config_file_arg_actionsrxZ
arg_parserr�Z
parsed_argrcrnZuser_config_filerrrr��s.
"

z!ArgumentParser._open_config_filescCs�tdtdtdtdi}t�}x�|jj�D]�\}}|jd�}||dt|dd��}|j	|�xl|j�D]`\}\}}|r�|j	d	|d
|f�qht
|t�r�|j	d|�qht
|t�rh|j	ddj
|��qhWq&W|j�S)
z�Returns a string with all args and settings and where they came from
        (eg. commandline, config file, enviroment variable or default)
        zCommand Line Args: zEnvironment Variables:
zConfig File (%s):
z
Defaults:
�|rr2Nz
  %-19s%s
�:z  %s
rf)r�r�r�r�rrr r;�tuplerDr?rCr@rArE)rZsource_key_to_display_value_maprFr�r�r*rxr,rrr�
format_values�s"



zArgumentParser.format_valuescCs|j|j��dS)zBPrints the format_values() string (to sys.stdout or another file).N)rDr�)r�filerrr�print_valuesszArgumentParser.print_valuescs�d}d}d}�jr؈j}d�jd}�fdd��jD�}dd��jD�}|r�|sV|r�d�_d}|d	||ddf7}d
jdd�|D��}|r�d
|}|s�|r�|dd
jt|�ttd|g���7}|d�jj�7}�j	�r:dd��jD�}	xH|	D]@\}
}d|
}|j
�sd|_
||j
kr�|j
|7_
d}d�_	q�W|�sF|�r~dg}
|�r\dg|
}
|�rldg|
}
|ddj|
�7}|�r��j�p�dd|�_tj
j��S)NrlFrrcsBg|]:}|jD].}�j|�r|jdkp0|jp0|jr||f�qqS)rU)rrrwrTrVrX)r/rsr�)rrrr1sz.ArgumentParser.format_help.<locals>.<listcomp>cSsg|]}t|dd�r|�qS)rVF)r<)r/rsrrrr1sTzCArgs that start with '%s' (eg. %s) can also be set in a config filez or css|]}|jr|jdVqdS)rN)rr)r/rsrrrrv(sz-ArgumentParser.format_help.<locals>.<genexpr>zspecified via z (%s).rfcSs"g|]}t|dd�r|j|f�qS)rpN)r<rp)r/rsrrrr12sz   [env var: %s]rSzconfig file valueszenvironment variableszT If an arg is specified in more than one place, then commandline values override %s.z which override )rYr^r|r~rAr��filterr]rrZrU�descriptionrr
�format_help)rr$Zadded_config_file_helpZadded_env_var_helpraZccZconfig_settable_argsZconfig_path_actionsZconfig_arg_stringZenv_var_actionsrprsZenv_var_help_stringZ
value_sourcesr)rrr�sX






zArgumentParser.format_help)F)rrrrr#r\r��environrjrgr�r�r�r�rwr�r�r{�stdoutr�r�rrrrr
s4Q#

.37r
cOs�|jdd�}|jdd�p"|jdd�}|jdd�}|j||�}|j|_||_||_||_|jrj|rjtd��|jr�t|t	j
�r�td��|jr�d}t|t	j
�s�t|d	��|r�t|d
��|S)a

    This method supports the same args as ArgumentParser.add_argument(..)
    as well as the additional args below.

    Additional Args:
        env_var: If set, the value of this environment variable will override
            any config file or default values for this arg (but can itself
            be overriden on the commandline). Also, if auto_env_var_prefix is
            set in the constructor, this env var name will be used instead of
            the automatic name.
        is_config_file_arg: If True, this arg is treated as a config file path
            This provides an alternative way to specify config files in place of
            the ArgumentParser(fromfile_prefix_chars=..) mechanism.
            Default: False
        is_write_out_config_file_arg: If True, this arg will be treated as a
            config file path, and, when it is specified, will cause
            configargparse to write all current commandline args to this file
            as config options and then exit.
            Default: False
    rpNrVZis_config_filerXz*env_var can't be set for a positional arg.z9arg with is_config_file_arg=True must have action='store'z+arg with is_write_out_config_file_arg=True zmust have action='store'z'can't also have is_config_file_arg=True)�pop�original_add_argument_methodrrrorprVrXr	r?rr�)rrbrrprVrXrxZerror_prefixrrrr`Ls,

r`cst�fdd�|D��S)zsUtility method for checking if any of the potential_command_line_args is
    already present in existing_args.
    c3s|]}|�kVqdS)Nr)r/Z
potential_arg)�existing_args_listrrrv�sz*already_on_command_line.<locals>.<genexpr>)r�)r�Zpotential_command_line_argsr)r�rrq�srq)rr)rr)N)N)Drr�r�r7r{r��version_info�iorZordereddictr�collectionsZ_StoreTrueActionZ_StoreFalseActionZ_CountActionZ_StoreConstActionZ_AppendConstActionr�rrrrZRawTextHelpFormatterZRawDescriptionHelpFormatterr�objectrrKr"r#rGr�r�r�r�r
r`rqZ_ActionsContainerr�Z
HelpFormatterZ
ArgumentErrorZArgumentTypeErrorZActionZFileTypeZ	NamespaceZONE_OR_MOREr�Z	REMAINDERr�r�ZinitArgumentParserZgetArgumentParserZgetArgParserZ	getParserZget_arg_parserZ
get_parserZ	ArgParserZParserZadd_arg�addrjrrgZparse_knownZRawFormatterZDefaultsFormatterZDefaultsRawFormatterrrrr�<module>s�




(Q?I6


Zerion Mini Shell 1.0