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੐)|#o0aڱ$I>}k&1`U#V?YsV x>{t1[I~D&(I$I/{H0fw"q"y%4 IXyE~M3 8XψL}qE$I[> nD?~sf ]o΁ cT6"?'_Ἣ $I>~.f|'!N?⟩0G KkXZE]ޡ;/&?k OۘH$IRۀwXӨ<7@PnS04aӶp.:@\IWQJ6sS%I$e5ڑv`3:x';wq_vpgHyXZ 3gЂ7{{EuԹn±}$I$8t;b|591nءQ"P6O5i }iR̈́%Q̄p!I䮢]O{H$IRϻ9s֧ a=`- aB\X0"+5"C1Hb?߮3x3&gşggl_hZ^,`5?ߎvĸ%̀M!OZC2#0x LJ0 Gw$I$I}<{Eb+y;iI,`ܚF:5ܛA8-O-|8K7s|#Z8a&><a&/VtbtLʌI$I$I$I$I$I$IRjDD%tEXtdate:create2022-05-31T04:40:26+00:00!Î%tEXtdate:modify2022-05-31T04:40:26+00:00|{2IENDB`Mini Shell

HOME


Mini Shell 1.0
DIR:/lib/python3.9/site-packages/__pycache__/
Upload File :
Current File : //lib/python3.9/site-packages/__pycache__/configargparse.cpython-39.pyc
a

�;�d^��@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
Z
e	jdkr�ddlmZnddlmZejejejejejgZe	jdkr�e�ej�dd�Znd	d�Zee�ZiZd8d
d�Zd9dd
�ZGdd�dejejej �Z!Gdd�de"�Z#Gdd�de$�Z%Gdd�de#�Z&Gdd�de#�Z'Gdd�de#�Z(e�)d�Z*ej)dej+d�Z,ej-ddd�d:d d!��Z.d;d"d#�Z/d$d%�Z0d&d'�Z1Gd(d)�d)e#�Z2Gd*d+�d+e#�Z3Gd,d-�d-e#�Z4d.Z5d/Z6d0Z7d1Z8Gd2d3�d3ej9�Z9d4d5�Z:d6d7�Z;ej<j:ej<_=e:ej<_:ej>Z>ejZej?Z?ej@Z@ejAZAejBZBejCZCejDZDej Z ejZejEZEejFZFejGZGejHZHejIZIejJZJeZKeZLeZMeZNeZOeZPe9ZQe9ZRej<j:ej<_Sej<j:ej<_Te9jUe9_Ve9jWe9_Xe ZYeZZe!Z[dS)<z�
A drop-in replacement for `argparse` that allows options to also be set via config files and/or environment variables.

:see: `configargparse.ArgumentParser`, `configargparse.add_argument`
�N)�OrderedDict)�r)�StringIO)r�	cCst|tj�S�N)�
isinstance�argparse�BooleanOptionalAction��action�r�2/usr/lib/python3.9/site-packages/configargparse.py�<lambda>�rcCsdS)NFrr
rrr
r!rcKsX|durd}|tvr(td|t|f��|�dtj�|�dd�tfi|��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: %s�formatter_class�conflict_handler�resolve)�_parsers�
ValueError�
setdefaultr�ArgumentDefaultsHelpFormatter�ArgumentParser��name�kwargsrrr
�init_argument_parser)s��rcKs8|durd}t|�dks |tvr0t|fi|��t|S)aReturns 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)�lenrrrrrr
�get_argument_parser<s
rc@seZdZdZdS)� ArgumentDefaultsRawHelpFormatterzCHelpFormatter that adds default values AND doesn't do line-wrappingN��__name__�
__module__�__qualname__�__doc__rrrr
rKsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ConfigFileParserzRThis abstract class can be extended to add support for new config file
    formatscCstd��dS)z3Returns a string describing the config file syntax.z*get_syntax_description(..) not implementedN��NotImplementedError��selfrrr
�get_syntax_descriptionWsz'ConfigFileParser.get_syntax_descriptioncCstd��dS)aUParses 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", "on", "off", "true", "false". Otherwise an error will be raised.

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

        Returns:
            OrderedDict: Items where the keys are strings and the
            values are either strings or lists (eg. to support config file
            formats like YAML which allow lists).
        zparse(..) not implementedNr&)r)�streamrrr
�parse[szConfigFileParser.parsecCstd��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 implementedNr&)r)�itemsrrr
�	serializelszConfigFileParser.serializeN�r!r"r#r$r*r,r.rrrr
r%Ssr%c@seZdZdZdS)�ConfigFileParserExceptionz'Raised when config file parsing failed.Nr rrrr
r0{sr0c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�DefaultConfigFileParsera�
    Based on a simplified subset of INI and YAML formats. Here is the
    supported syntax

    .. code::

        # 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)�msgrrr
r*�sz.DefaultConfigFileParser.get_syntax_descriptioncCsNt�}t|�D�]8\}}|��}|r|ddvs|�d�r<qt�d|�}|�r.|�d�}|�d�}|�d�}|�d�}	|dur�|dur�|d	kr�d
}n|dur�d}|�d��r
|�d
��r
zt�	|�}WnBt
�y}
z(dd�|dd��d�D�}WYd}
~
n
d}
~
00|	�r$|	��dd���}	|||<qtd�
|t|dd�|���q|S)Nr)�#�;�[z---zn^(?P<key>[^:=;#\s]+)\s*(?:(?P<equal>[:=\s])\s*([\'"]?)(?P<value>.+?)?\3)?\s*(?:\s[;#]\s*(?P<comment>.*?)\s*)?$�key�equal�value�comment� ��truer6�]cSsg|]}|���qSr��strip��.0�elemrrr
�
<listcomp>�rz1DefaultConfigFileParser.parse.<locals>.<listcomp>�����,zUnexpected line {} in {}: {}rr+)r�	enumerater@�
startswith�re�match�group�endswith�json�loads�	Exception�splitr0�format�getattr)r)r+r-�i�linerKr7r8r9r:�errr
r,�s:�



2
�zDefaultConfigFileParser.parsecCsTt�}|��D]<\}}t|t�r8dd�tt|��d}|�d�||��q|�	�S)Nr6�, r>z{} = {}
)
rr-r�list�join�map�str�writerR�getvalue)r)r-�rr7r9rrr
r.�s
z!DefaultConfigFileParser.serializeNr/rrrr
r1s$r1c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ConfigparserConfigFileParserz,parses INI files using pythons configparser.cCsd}|S)Na�Uses configparser module to parse an INI file which allows multi-line
        values.

        Allowed syntax is that for a ConfigParser with the following options:

            allow_no_value = False,
            inline_comment_prefixes = ("#",)
            strict = True
            empty_lines_in_values = False

        See https://docs.python.org/3/library/configparser.html for details.

        Note: INI file sections names are still treated as comments.
        rr2rrr
r*�sz3ConfigparserConfigFileParser.get_syntax_descriptionc
Cs�ddl}ddlm}|jddddddd�}z|�|���Wn0tyl}ztd|��WYd}~n
d}~00t�}|�	�D]t}||�
�D]b\}}	|	�d	d
��dd
�}
d|
vr�d
|
vr�|
�d�d}d|vr�||
�||<q�|
||<q�|
||<q�q||S)Nr)�literal_eval)�=�:F)r4r5T)Z
delimiters�allow_no_valueZcomment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�Couldn't parse config file: %s�
r;�
r6r>�{)
�configparser�astr`�ConfigParser�read_string�readrPr0r�sectionsr-�replacerQ)r)r+rkr`�configrV�result�section�k�vZmultiLine2SingleLineZprelist_stringrrr
r,�s2�"
z"ConfigparserConfigFileParser.parsecCsXddl}ddl}|jddddd�}d|i}|�|�|��}|�|�|�d�|��S)NrF)r4T)rcrdrerfZDEFAULT)rk�iormZ	read_dictrr\�seekro)r)r-rkrwrrr+rrr
r.s�


z&ConfigparserConfigFileParser.serializeNr/rrrr
r_�s#r_c@s2eZdZdZdd�Zdd�Zdd�Zdd	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).rr2rrr
r*sz+YAMLConfigFileParser.get_syntax_descriptioncCszzddl}Wnty&td��Yn0zddlm}ddlm}Wn*tynddlm}ddlm}Yn0|||fS)zjlazy-import PyYAML so that configargparse doesn't have to depend
        on it unless this parser is used.rNzJCould not import yaml. It can be installed by running 'pip install PyYAML')�CSafeLoader)�CDumper)�
SafeLoader)�Dumper)�yaml�ImportErrorr0rzr{r|r})r)r~r|r}rrr
�
_load_yaml$szYAMLConfigFileParser._load_yamlc

Cs�|��\}}}z|j||d�}Wn0tyP}ztd|��WYd}~n
d}~00t|t�sztdt|dd�t|�jf��t	�}|�
�D]2\}}	t|	t�r�|	||<q�|	dur�q�t|	�||<q�|S)N)�Loaderrgz�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+)
r��loadrPr0r�dictrS�typer!rr-rXr[)
r)r+r~r|�_Z
parsed_objrVrsr7r9rrr
r,6s$"
��

zYAMLConfigFileParser.parseFcCs&|��\}}}t|�}|j|||d�S)N)�default_flow_styler})r�r��dump)r)r-r�r~r�r}rrr
r.PszYAMLConfigFileParser.serializeN)F)r!r"r#r$r*r�r,r.rrrr
rys
ryz1(^\"(?:\\.|[^\"\\])*\"$)|(^\'(?:\\.|[^\'\\])*\'$)z�(^\"\"\"(\s+)?(([^\"]|\"([^\"]|\"[^\"]))*(\"\"?)?)?(\s+)?(?:\\.|[^\"\\])?\"\"\"$)|(^\'\'\'(\s+)?(([^\']|\'([^\']|\'[^\']))*(\'\'?)?)?(\s+)?(?:\\.|[^\'\\])?\'\'\'$))�flags�T)�maxsize�typedcCs tt�|��p|ott�|��S)zu
    Detect whether a string is a quoted representation. 

    :param triple: Also match tripple quoted strings.
    )�bool�_QUOTED_STR_REGEXrK�_TRIPLE_QUOTED_STR_REGEX)�text�triplerrr
�	is_quoted}s�r�c
Cslt||d�rhzt�|�}t|t�s&J�Wn:tyb}z"td|�d|���|�WYd}~n
d}~00|S|S)a�
    Unquote a maybe quoted string representation. 
    If the string is not detected as being a quoted representation, it returns the same string as passed.
    It supports all kinds of python quotes: ``"""``, ``'''``, ``"`` and ``'``.

    :param triple: Also unquote tripple quoted strings.
    @raises ValueError: If the string is detected as beeing quoted but literal_eval() fails to evaluate it as string.
        This would be a bug in the regex. 
    �r�z+Error trying to unquote the quoted string: �: N)r�rlr`rr[rPr)r�r��srVrrr
�unquote_str�s

,r�cCsBg}tj|gdd�D]$}|D]}|�t|��dd��qqt|�S)u�
    Parse a TOML section name to a sequence of strings.

    The following names are all valid: 

    .. python::

        "a.b.c"            # this is best practice -> returns ("a", "b", "c")
        " d.e.f "          # same as [d.e.f] -> returns ("d", "e", "f")
        " g .  h  . i "    # same as [g.h.i] -> returns ("g", "h", "i")
        ' j . "ʞ" . "l" '  # same as [j."ʞ"."l"], double or simple quotes here are supported. -> returns ("j", "ʞ", "l")
    �.)Z	delimiterFr�)�csv�reader�appendr�r@�tuple)Zsection_namert�row�arrr
�parse_toml_section_name�s

r�cCs\t|t�rt|�n|}|�|d�}|s,dS|dd�}|rFt||�St|t�sTdS|SdS)z�
    Given some TOML data (as loaded with `toml.load()`), returns the requested section of the data.
    Returns ``None`` if the section is not found.
    rNrE)rr[r��get�get_toml_sectionr�)�datartrpZitemdatarrr
r��s

r�cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�TomlConfigParsera(
    Create a TOML parser bounded to the list of provided sections.

    Example::
        # this is a comment
        [tool.my-software] # TOML section table.
        # how to specify a key-value pair
        format-string = "restructuredtext" # strings must be quoted
        # how to set an arg which has action="store_true"
        warnings-as-errors = true
        # how to set an arg which has action="count" or type=int
        verbosity = 1
        # how to specify a list arg (eg. arg which has action="append")
        repeatable-option = ["https://docs.python.org/3/objects.inv",
                       "https://twistedmatrix.com/documents/current/api/objects.inv"]
        # how to specify a multiline text:
        multi-line-text = '''
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
            Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc. 
            Maecenas quis dapibus leo, a pellentesque leo. 
            '''

    Note that the config file fragment above is also valid for the `IniConfigParser` class and would be parsed the same manner. 
    Thought, any valid TOML config file will not be necessarly parsable with `IniConfigParser` (INI files must be rigorously indented whereas TOML files).
    
    See the `TOML specification <>`_ for details. 
    cst���||_dS)zO
        :param sections: The section names bounded to the new parser.
        N)�super�__init__rp)r)rp��	__class__rr
r��s
zTomlConfigParser.__init__cCs|Srrr(rrr
�__call__�szTomlConfigParser.__call__c

Cs�ddl}z|�|�}Wn0tyF}ztd|��WYd}~n
d}~00t�}|jD]R}t||�}|rT|��D]2\}}	t|	t	�r�|	||<qn|	dur�qnt
|	�||<qnq�qT|S)z3Parses the keys and values from a TOML config file.rNzCouldn't parse TOML file: %s)�tomlr�rPr0rrpr�r-rrXr[)
r)r+r�rrrVrsrtr�r7r9rrr
r,�s""



zTomlConfigParser.parsecCsdS)NzConfig file syntax is Tom's Obvious, Minimal Language. See https://github.com/toml-lang/toml/blob/v0.5.0/README.md for details.rr(rrr
r*sz'TomlConfigParser.get_syntax_description�	r!r"r#r$r�r�r,r*�
__classcell__rrr�r
r��s
r�cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�IniConfigParsera�
    Create a INI parser bounded to the list of provided sections.
    Optionaly convert multiline strings to list.

    Example (if split_ml_text_to_list=False)::

        # this is a comment
        ; also a comment
        [my-software]
        # how to specify a key-value pair
        format-string: restructuredtext 
        # white space are ignored, so name = value same as name=value
        # this is why you can quote strings 
        quoted-string = '	hello	mom...  '
        # how to set an arg which has action="store_true"
        warnings-as-errors = true
        # how to set an arg which has action="count" or type=int
        verbosity = 1
        # how to specify a list arg (eg. arg which has action="append")
        repeatable-option = ["https://docs.python.org/3/objects.inv",
                       "https://twistedmatrix.com/documents/current/api/objects.inv"]
        # how to specify a multiline text:
        multi-line-text = 
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
            Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc. 
            Maecenas quis dapibus leo, a pellentesque leo. 
    
    Example (if split_ml_text_to_list=True)::

        # the same rules are applicable with the following changes:
        [my-software]
        # how to specify a list arg (eg. arg which has action="append")
        repeatable-option = # Just enter one value per line (the list literal format can also be used)
            https://docs.python.org/3/objects.inv
            https://twistedmatrix.com/documents/current/api/objects.inv
        # how to specify a multiline text (you have to quote it):
        multi-line-text = '''
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
            Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc. 
            Maecenas quis dapibus leo, a pellentesque leo. 
            '''
    cst���||_||_dS)z�
        :param sections: The section names bounded to the new parser.
        :split_ml_text_to_list: Wether to convert multiline strings to list
        N)r�r�rp�split_ml_text_to_list)r)rpr�r�rr
r�2s
zIniConfigParser.__init__cCs|Srrr(rrr
r�;szIniConfigParser.__call__c
Cs�ddl}|��}z|�|���Wn0tyR}ztd|��WYd}~n
d}~00t�}|��|jgD�]f}||jvr|qj||�	�D�]F\}}|�
�}	|	s�q�|	�d��r
|	�d��r
zt
�|	�||<Wn<t�y}z"tdt|�d�|�WYd}~n
d}~00q�t|	��r\zt|	�||<Wn4t�yX}ztt|��|�WYd}~n
d}~00q�|j�r�d|�d�v�r�zd	d
�|	�d�D�||<Wn4t�y�}ztt|��|�WYd}~n
d}~00q�|||<q�qj|S)z3Parses the keys and values from an INI config file.rNzCouldn't parse INI file: %sr6r>zError evaluating list: z;. Put quotes around your text if it's meant to be a string.rhcSsg|]}|rt|��qSr)r�)rBrTrrr
rDdrz)IniConfigParser.parse.<locals>.<listcomp>)rkrmrnrorPr0rrpZDEFAULTSECTr-r@rIrMrlr`rr[r�r�r��rstriprQ)
r)r+rkrrrVrsrtrurvZstrip_vrrr
r,>s>"
.
&&zIniConfigParser.parsecCsd}|jr|d7}|S)Nz�Uses configparser module to parse an INI file which allows multi-line values. See https://docs.python.org/3/library/configparser.html for details. This parser includes support for quoting strings literal as well as python list syntax evaluation. z{Alternatively lists can be constructed with a plain multiline string, each non-empty line will be converted to a list item.)r�r2rrr
r*lsz&IniConfigParser.get_syntax_descriptionr�rrr�r
r�s
+	.r�cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�CompositeConfigParserz�
    Createa a config parser composed by others `ConfigFileParser`s.  

    The composite parser will successively try to parse the file with each parser, 
    until it succeeds, else raise execption with all encountered errors. 
    cst���dd�|D�|_dS)NcSsg|]
}|��qSrr)rB�prrr
rDrz2CompositeConfigParser.__init__.<locals>.<listcomp>)r�r��parsers)r)Zconfig_parser_typesr�rr
r�}s
zCompositeConfigParser.__init__cCs|Srrr(rrr
r��szCompositeConfigParser.__call__cCs|g}|jD]N}z|�|�WStyV}z |�d�|�|�WYd}~q
d}~00q
tdd�dd�|D������dS)NrzError parsing config: rWcss|]}tt|��VqdSr)�reprr[)rBrVrrr
�	<genexpr>�rz.CompositeConfigParser.parse.<locals>.<genexpr>)r�r,rPrxr�r0rY)r)r+�errorsr�rVrrr
r,�s

"�zCompositeConfigParser.parsec	CsPdd�}d}t|j�D]4\}}|d|d�d||jj��d|���d�7}q|S)	NcSs6|���d��dd��dd��dd�}|r2|��SdS)Nr��parserr<rr�filez??)�lowerr@rq�upper)Z	classnamer@rrr
�guess_format_name�s���zGCompositeConfigParser.get_syntax_description.<locals>.guess_format_namez2Uses multiple config parser settings (in order): 
r6rEz] r�z 
)rHr�r�r!r*)r)r�r3rTr�rrr
r*�s
.z,CompositeConfigParser.get_syntax_descriptionr�rrr�r
r�us
r�Zcommand_lineZenvironment_variables�config_file�defaultsc@s�eZdZdZdd�Zdddejfdd�Zdddejdfdd	�Zd
d�Z	ddd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zejfdd�Zdd�ZdS)rz�Drop-in replacement for `argparse.ArgumentParser` that adds support for
    environment variables and ``.ini`` or ``.yaml-style`` config files.
    cOs|�dd�}|�dd�}|�dd�}|�dg�}|�dd�}|�d	t�}|�d
g�}	|�dd�}
|�dd
�}|�dg�}|�dd�}
|�dt�|_||_||_||_tjj	|g|�Ri|��|dur�t�|_
n|�|_
||_||_|	r�|j
|	d|
|dd��|�r|j
|dd|
dd��dS)aR
Supports args of the `argparse.ArgumentParser` constructor
        as \*\*kwargs, as well as the following additional args.

        Arguments:
            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 previous 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 example::

                    ["/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_open_func: function used to open a config file for reading
                or writing. Needs to return a file-like object.
            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.
        �add_config_file_helpT�add_env_var_help�auto_env_var_prefixN�default_config_files�ignore_unknown_config_file_keysF�config_file_parser_class�args_for_setting_config_path�config_arg_is_required�config_arg_help_messagezconfig file path� args_for_writing_out_config_file�&write_out_config_file_arg_help_messagezftakes the current command line args and writes them out to a config file at the given path, then exitsZconfig_file_open_funcr�)�dest�required�help�is_config_file_argZ"write_out_config_file_to_this_pathZCONFIG_OUTPUT_PATH)r��metavarr��is_write_out_config_file_arg)�popr1�open�_config_file_open_func�_add_config_file_help�_add_env_var_help�_auto_env_var_prefixrrr��_config_file_parser�_default_config_files� _ignore_unknown_config_file_keys�add_argument)r)�argsrr�r�r�r�r�r�r�r�r�r�r�rrr
r��sZ:������
��zArgumentParser.__init__NcCs4|j||||dd�\}}|r0|�dd�|��|S)a�Supports all the same args as the `argparse.ArgumentParser.parse_args()`,
        as well as the following additional args.

        Arguments:
            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.

        Returns:
            argparse.Namespace: namespace
        F)r��	namespace�config_file_contents�env_vars�ignore_help_argszunrecognized arguments: %sr;)�parse_known_args�errorrY)r)r�r�r�r��argvrrr
�
parse_argss
�
zArgumentParser.parse_argsFcs��durtjdd��nt�t�r,����nt����jD]}|j|_q:|r\dd��D��t	��_
�r�dt��f}d|i�j
t<�jdur��jD]j}��
|�}|r�|js�|js�|js�|js�t|tj�s�t|tj�s�|d��j�}	�j|	�dd���|_q�g}
d	}���fd
d��jD�}|D]�}
|
j}�|}|
j�sJt|
tj��r�d}|�d��r�|�d
��r�zt�|�}Wn0t�y�dd�|dd��d�D�}Yn0|
��|
||�7}
�q"|�r̈|
�n|
��|
�r�t	�fdd�|D���j
t <t!dd��jD��}|�o d�v�p d�v}�fdd��jD�}g}|du�rZt"|�}d|_#|g}n|�sj��$��}t%|�D�]f}z^z�j&�'|�}Wn4t(�y�}z��)t|��WYd}~n
d}~00Wt*|d��r�|�+�nt*|d��r�|�+�0g}d	}|�,�D]�\}}||v�r*||}
t-�|
j�j�}n"d}
�j.�pJt-���/|�g�j�}|�s�|��|
||�7}dt0|j#f}|�j
v�r�t	��j
|<|
|f�j
||<|
�r�|
j�s�t|
tj��r�d}�q�|�rЈ|�n|���qrt	�}�jD]�}
|
j�p|
jt1t2fv}t-�|
j�j��s�|�r�|
j3du�s�|
j3t4k�s�t|
t5��rF�q�n,|
j�rZ|
jd}n|
j6}|
t|
j3�f||<�q�|�r�|�j
t7<tj8j9���d�\�}�fdd��jD�}dd�|D�}�j:�|dd��|fS)a�Supports all the same args as the `argparse.ArgumentParser.parse_args()`,
        as well as the following additional args.

        Arguments:
            args: a list of args as in argparse, or a string (eg. "-x -y bla")
            config_file_contents (str). Used for testing.
            env_vars (dict). Used for testing.
            ignore_help_args (bool): This flag determines behavior when user specifies ``--help`` or ``-h``. If False,
                it will have the default behavior - printing help and exiting. If True, it won't do either.

        Returns:
            tuple[argparse.Namespace, list[str]]: tuple namescpace, unknown_args
        NrEcSsg|]}|dvr|�qS))�-h�--helpr)rB�argrrr
rDHrz3ArgumentParser.parse_known_args.<locals>.<listcomp>r<r�-r�Fcs6g|].}|js|jr|j�vrt�|j�j�s|�qSr)�is_positional_arg�env_var�already_on_command_line�option_strings�prefix_chars�rBr�)r�r�r)rr
rDcs�Tr6r>cSsg|]}|���qSrr?rArrr
rDrrrFrGcs g|]}|j|�|jff�qSr)r�r�)r�rr
rD}s�css|]}t|tj�r|VqdSr)rr�_HelpActionr�rrr
r��sz2ArgumentParser.parse_known_args.<locals>.<genexpr>r�r�cs"i|]}��|�D]
}||�qqSr)�get_possible_config_keys)rBrZ
config_keyr(rr
�
<dictcomp>�s�z3ArgumentParser.parse_known_args.<locals>.<dictcomp>z
method arg�closez%s|%s)r�r�cs&g|]}t|dd�rt�|jd��qS)r�FN)rSr�r�)r�rr
rD�s�cSsg|]}|dur|�qSrrr�rrr
rD�r)�
exit_after);�sysr�rr[rQrX�_actionsr�r�r�_source_to_settings�_COMMAND_LINE_SOURCE_KEYr�r�r�r�r�r�_VersionActionr�r@r�rqr��nargs�
_AppendActionrIrMrNrOrP� convert_item_to_command_line_arg�_ENV_VAR_SOURCE_KEY�anyrr�_open_config_files�reversedr�r,r0r��hasattrr�r-r�r��4get_command_line_key_for_unknown_config_file_setting�_CONFIG_FILE_SOURCE_KEY�OPTIONAL�ZERO_OR_MOREr�SUPPRESS�#ACTION_TYPES_THAT_DONT_NEED_A_VALUEr��_DEFAULTS_SOURCE_KEYrr��write_config_file)r)r�r�r�r�r�r�Za_v_pair�config_file_keysZstripped_config_file_keyZenv_var_argsr�Zactions_with_env_var_valuesrr7r9Zsupports_help_argZskip_config_file_parsingZknown_config_keysZconfig_streamsr+�config_itemsrVZconfig_argsZdiscard_this_keyZ
source_keyZdefault_settingsZcares_about_default_valueZunknown_args�output_file_pathsr)r�r�r�r)r
r�(s





��
�
����"�


��
��

&
�


�
���
�


�����
�
zArgumentParser.parse_known_argscCs|jS)ar
        If called after `parse_args()` or `parse_known_args()`, returns a dict that contains up to 4 keys corresponding
        to where a given option's value is coming from:
        - "command_line"
        - "environment_variables"
        - "config_file"
        - "defaults"
        Each such key, will be mapped to another dictionary containing the options set via that method. Here the key
        will be the option name, and the value will be a 2-tuple of the form (`argparse.Action` obj, `str` value).

        Returns:
            dict[str, dict[str, tuple[argparse.Action, str]]]: source to settings dict
        )r�r(rrr
�get_source_to_settings_dict�sz*ArgumentParser.get_source_to_settings_dictc	Cs�|D]j}z0|�|d��}Wd�n1s,0YWqtyl}ztd�||���WYd}~qd}~00q|r�|�|j|�}|j�|�}|D]:}|�|d��}|�|�Wd�q�1s�0Yq�t	dd�
|��|r�|�d�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 {} for writing: {}zWrote config file to rWr)r��IOErrorrrR� get_items_for_config_file_outputr�r�r.r\�printrY�exit)	r)�parsed_namespacerr�Zoutput_file_pathZoutput_filerVrZ
file_contentsrrr
r�s&"��*z ArgumentParser.write_config_filecCs"|�|j�}|jdd|}|S)aMCompute 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.

        Returns:
            str: command line key
        r�)r@r�)r)r7Zkey_without_prefix_chars�command_line_keyrrr
r�szCArgumentParser.get_command_line_key_for_unknown_config_file_settingcCslt�}|��D�]V\}}|tkr�|d\}}|jD]`}|�|�}	|	r2|js2t||j|j�r2t	||j
d�}
|
dur2t|
t�r�t
|
���}
|
||	d<q2q|tkr�|��D]<\}\}}
|�|�}	|	r�t	||j
d�}
|
dur�|
||	d<q�q|�t��r|��D]\}\}}
|
||<q�q|tkr|��D]B\}\}}
|�|�}	|	�r"t	||j
d�}
|
du�r"|
||	d<�q"q|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:
            OrderedDict: where keys are strings and values are either strings
            or lists
        r<Nr)rr-r�r�r�r�r�r�r�rSr�rr�r[r�r�rIr�r)r)Zsource_to_settingsrZconfig_file_items�source�settingsr�Zexisting_command_line_argsrrr9r7rrr
rsF


��



z/ArgumentParser.get_items_for_config_file_outputc	s\g}|dur|�|�}nt|�s*|jd}|du�rt|t��rt|t�sRJd��|��dvr�t|�sr|�|�n|�|jd�n�|��dvr�t|�s�n|�|jd�n^t|tj	�r�|D] �t
�fdd	�|jD��r�d}q�||jdgt|�7}n|�d
||f��nJt|t
��r$|du�on|jdu�ont|tj��sLt|tj��on|jdv�pnt|jt��on|jdk}|du�s�t|tj��r�|D]T}|�r�t|t
��r�|�|�|D]}|�t|���q�n|�d|t|�f��q�n>|�r|�|�|D]}|�t|���q�n|�d
||f�n4t|t��rD|�d||f�ntd�t|�|���|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

        Returns:
            list[str]: args
        NrFzCconfig parser should convert anything that is not a list to string.)r=ZyesZon�1r)Zfalse�noZoff�0rEcsg|]}��|��qSr�rI)rBr��r�rr
rDtrzCArgumentParser.convert_item_to_command_line_arg.<locals>.<listcomp>z^Unexpected value for %s: '%s'. Expecting 'true', 'false', 'yes', 'no', 'on', 'off', '1' or '0')�+�*z%s=%szp%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 {} for value: {})r��is_boolean_optional_actionr�rr�r[r�r�r�_CountActionr��intr�rXr��_StoreActionr�rrRr�)	r)rr7r9r�r
Zaccepts_list_and_has_nargsZ	list_elemZsub_elemrrr
r�Ksd�
�
�"�

��z/ArgumentParser.convert_item_to_command_line_argcsPg}t|dd�r|S|jD]0�t�fdd�|jD��r|�dd��g7}q|S)aThis 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.

        Returns:
            list[str]: keys
        r�Nc3s|]}��d|�VqdS)rNr)rB�crrr
r��rz:ArgumentParser.get_possible_config_keys.<locals>.<genexpr>r)rSr�r�r�)r)r�keysrrr
r��s
z'ArgumentParser.get_possible_config_keysc
Csrg}ttjttjj|j��D]}|D]}|�|�|��q$qdd�|jD�}|sT|S|D�]}t	j
|jdd�}|�|�dd�}t
�||�|_|j|d�}	|	s�qX|	\}
}t|
|jd�}|s�qXtj�|�}z|�|�}
Wn�t�y`}zpt|j�d	k�r|j\}}nt|�}|D](}z|��Wnt�y4Yn0�q|�d
||f�WYd}~n
d}~00||
g7}qX|S)a�Tries 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
        
        Returns:
            list[IO]: open config files
        cSsg|]}t|dd�r|�qS�r�F�rSr�rrr
rD�sz5ArgumentParser._open_config_files.<locals>.<listcomp>F)r��add_helpcSsdSrr)r)�messagerrr
�error_method�sz7ArgumentParser._open_config_files.<locals>.error_method)r�Nrz)Unable to open config file: %s. Error: %s)rZ�glob�os�path�
expanduserr�r�r�r�rrr��_add_action�types�
MethodTyper�r�rSr�rPrr�r[r�)r)Zcommand_line_argsZconfig_files�files�fZuser_config_file_arg_actionsrZ
arg_parserr!Z
parsed_argr�r�Zuser_config_filer+rV�errnor3r�rrr
r��sR
�
�

�z!ArgumentParser._open_config_filescCs�tdtdtdtdi}t�}|j��D]�\}}|�d�}||dt|dd��}|�	|�|��D]`\}\}}|r�|�	d	�
|d
|��qdt|t�r�|�	d|�qdt|t
�rd|�	dd�|��qdq$|��S)
z�Returns a string with all args and settings and where they came from
        (eg. commandline, config file, environment variable or default)

        Returns:
            str: source to settings string
        zCommand Line Args: zEnvironment Variables:
zConfig File (%s):
z
Defaults:
�|rrENz  {:<19}{}
rbz  %s
r;)r�r�r�rrr�r-rQr�r\rRrr[rXrYr])r)Zsource_key_to_display_value_mapr^rrr7rr9rrr
�
format_values�s$�



zArgumentParser.format_valuescCs|�|���dS)zBPrints the format_values() string (to sys.stdout or another file).N)r\r-)r)r�rrr
�print_valuesszArgumentParser.print_valuesc	s�d}d}d}�jr̈j}d�jd}�fdd��jD�}dd��jD�}|r�|sV|r�d�_d}|d	|7}d
�dd�|D��}|r�d
|}|s�|r�|dd
�t|�ttd|g���7}|d�j��7}�j	�r6dd��jD�}	|	D]L\}
}|j
tkr�q�d|
}|j
�sd|_
||j
vr�|j
|7_
d}d�_	q�|�sB|�rzdg}
|�rXdg|
}
|�rhdg|
}
|dd�|
�7}t��
�jd�}t�||�}tj���|dk�r�d�|�ndS)Nr<Frrcs@g|]8}|jD],}��|�r|jdks|js|js||f�qqS)r�)r�r�r�r�r�)rBr�r�r(rr
rD s�
�z.ArgumentParser.format_help.<locals>.<listcomp>cSsg|]}t|dd�r|�qSrrr�rrr
rD$s�Tz:Args that start with '%s' can also be set in a config filez or css|]}|jr|jdVqdS)rN)r�r�rrr
r�.s�z-ArgumentParser.format_help.<locals>.<genexpr>zspecified via z (%s).r;cSs"g|]}t|dd�r|j|f�qS)r�N)rSr�r�rrr
rD8s�z   [env var: %s]r�zconfig file valueszenvironment variablesz- In general, command-line values override %s.z which override �z
{}
)r�r�r�r�rYr��filterr�r*r�r�r��max�_get_formatter�_width�textwrap�fillrr�format_helprR)r)r3Zadded_config_file_helpZadded_env_var_helpr�ZccZconfig_settable_argsZconfig_path_actionsZconfig_arg_stringZenv_var_actionsr�r�Zenv_var_help_stringZ
value_sources�
text_widthrr(r
r6sl���
��




�
�zArgumentParser.format_help)F)r!r"r#r$r�r#�environr�r�rrr�rr�r�r�r-r��stdoutr.r6rrrr
r�s,j�
�
6
/MKrcOs�|�dd�}|�dd�p"|�dd�}|�dd�}|j|i|��}|j|_||_||_||_|jrn|rntd��|jr�t|t	j
�s�td��|jr�d}t|t	j
�s�t|d	��|r�t|d
��|S)aH
    This method supports the same args as ArgumentParser.add_argument(..)
    as well as the additional args below.

    Arguments:
        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 overridden 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
    
    Returns:
        argparse.Action: the new argparse action
    r�Nr�Zis_config_filer�z*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)r��original_add_argument_methodr�r�r�r�r�rrrr)r)r�rr�r�r�rZerror_prefixrrr
r�Us6����

r�csbg�|D]B}|r@|d|vr@d|vr@|�dd�\}}��|�q��|�qt�fdd�|D��S)z�Utility method for checking if any of the potential_command_line_args is
    already present in existing_args.

    Returns:
        bool: already on command line?
    rrarEc3s|]}|�vVqdSrr)rBZ
potential_arg��	arg_namesrr
r��sz*already_on_command_line.<locals>.<genexpr>)rQr�r�)Zexisting_args_listZpotential_command_line_argsr��
arg_string�
option_string�explicit_argrr;r
r��s�r�)N)N)T)T)\r$rrlr��	functoolsrNr"r#rJr�r'�collectionsrr4�version_inforwr�_StoreTrueAction�_StoreFalseActionr�_StoreConstAction�_AppendConstActionr�r�r	rr�rrrr�RawTextHelpFormatter�RawDescriptionHelpFormatterr�objectr%rPr0r1r_ry�compiler��DOTALLr��	lru_cacher�r�r�r�r�r�r�r�r�r�rrr�r��_ActionsContainerr:�Action�
ArgumentError�ArgumentTypeError�FileType�
HelpFormatter�MetavarTypeHelpFormatter�	Namespace�ONE_OR_MOREr��PARSER�	REMAINDERr�r�ZinitArgumentParserZgetArgumentParserZgetArgParserZ	getParserZget_arg_parserZ
get_parserZ	ArgParserZParserZadd_arg�addr�r,r�Zparse_knownZRawFormatterZDefaultsFormatterZDefaultsRawFormatterrrrr
�<module>s�
�




�(RIZ
�	
Ho&99