Hacked By AnonymousFox

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

U

i�ff��@s�dZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddddd	d
ddd
ddddddddddddgZ
eZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGd d�de�ZGd!d�de�ZGd"d	�d	e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�ZGd&d
�d
e�ZGd'd�de�Ze�ZGd(d�d�Z Gd)d�de �Z!Gd*d�de �Z"Gd+d�de �Z#Gd,d�de�Z$Gd-d�de$�Z%Gd.d�de%�Z&Gd/d�de�Z'Gd0d�de�Z(dS)1a�Configuration file parser.

A configuration file consists of sections, lead by a "[section]" header,
and followed by "name: value" entries, with continuations and such in
the style of RFC 822.

Intrinsic defaults can be specified by passing them into the
ConfigParser constructor as a dictionary.

class:

ConfigParser -- responsible for parsing a list of
                    configuration files, and managing the parsed database.

    methods:

    __init__(defaults=None, dict_type=_default_dict, allow_no_value=False,
             delimiters=('=', ':'), comment_prefixes=('#', ';'),
             inline_comment_prefixes=None, strict=True,
             empty_lines_in_values=True, default_section='DEFAULT',
             interpolation=<unset>, converters=<unset>):
        Create the parser. When `defaults' is given, it is initialized into the
        dictionary or intrinsic defaults. The keys must be strings, the values
        must be appropriate for %()s string interpolation.

        When `dict_type' is given, it will be used to create the dictionary
        objects for the list of sections, for the options within a section, and
        for the default values.

        When `delimiters' is given, it will be used as the set of substrings
        that divide keys from values.

        When `comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in empty lines. Comments can be
        indented.

        When `inline_comment_prefixes' is given, it will be used as the set of
        substrings that prefix comments in non-empty lines.

        When `strict` is True, the parser won't allow for any section or option
        duplicates while reading from a single source (file, string or
        dictionary). Default is True.

        When `empty_lines_in_values' is False (default: True), each empty line
        marks the end of an option. Otherwise, internal empty lines of
        a multiline option are kept as part of the value.

        When `allow_no_value' is True (default: False), options without
        values are accepted; the value presented for these is None.

        When `default_section' is given, the name of the special section is
        named accordingly. By default it is called ``"DEFAULT"`` but this can
        be customized to point to any other valid section name. Its current
        value can be retrieved using the ``parser_instance.default_section``
        attribute and may be modified at runtime.

        When `interpolation` is given, it should be an Interpolation subclass
        instance. It will be used as the handler for option value
        pre-processing when using getters. RawConfigParser objects don't do
        any sort of interpolation, whereas ConfigParser uses an instance of
        BasicInterpolation. The library also provides a ``zc.buildbot``
        inspired ExtendedInterpolation implementation.

        When `converters` is given, it should be a dictionary where each key
        represents the name of a type converter and each value is a callable
        implementing the conversion from string to the desired datatype. Every
        converter gets its corresponding get*() method on the parser object and
        section proxies.

    sections()
        Return all the configuration section names, sans DEFAULT.

    has_section(section)
        Return whether the given section exists.

    has_option(section, option)
        Return whether the given option exists in the given section.

    options(section)
        Return list of configuration options for the named section.

    read(filenames, encoding=None)
        Read and parse the iterable of named configuration files, given by
        name.  A single filename is also allowed.  Non-existing files
        are ignored.  Return list of successfully read files.

    read_file(f, filename=None)
        Read and parse one configuration file, given as a file object.
        The filename defaults to f.name; it is only used in error
        messages (if f has no `name' attribute, the string `<???>' is used).

    read_string(string)
        Read configuration from a given string.

    read_dict(dictionary)
        Read configuration from a dictionary. Keys are section names,
        values are dictionaries with keys and values that should be present
        in the section. If the used dictionary type preserves order, sections
        and their keys will be added in order. Values are automatically
        converted to strings.

    get(section, option, raw=False, vars=None, fallback=_UNSET)
        Return a string value for the named option.  All % interpolations are
        expanded in the return values, based on the defaults passed into the
        constructor and the DEFAULT section.  Additional substitutions may be
        provided using the `vars' argument, which must be a dictionary whose
        contents override any pre-existing defaults. If `option' is a key in
        `vars', the value from `vars' is used.

    getint(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to an integer.

    getfloat(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a float.

    getboolean(section, options, raw=False, vars=None, fallback=_UNSET)
        Like get(), but convert value to a boolean (currently case
        insensitively defined as 0, false, no, off for False, and 1, true,
        yes, on for True).  Returns False or True.

    items(section=_UNSET, raw=False, vars=None)
        If section is given, return a list of tuples with (name, value) for
        each option in the section. Otherwise, return a list of tuples with
        (section_name, section_proxy) for each section, including DEFAULTSECT.

    remove_section(section)
        Remove the given file section and all its options.

    remove_option(section, option)
        Remove the given option from the given section.

    set(section, option, value)
        Set the given option.

    write(fp, space_around_delimiters=True)
        Write the configuration state in .ini format. If
        `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
�)�MutableMapping)�ChainMapN�NoSectionError�DuplicateOptionError�DuplicateSectionError�
NoOptionError�InterpolationError�InterpolationDepthError�InterpolationMissingOptionError�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�
Interpolation�BasicInterpolation�ExtendedInterpolation�LegacyInterpolation�SectionProxy�ConverterMapping�DEFAULTSECT�MAX_INTERPOLATION_DEPTHZDEFAULT�
c@s&eZdZdZddd�Zdd�ZeZdS)	�Errorz'Base class for ConfigParser exceptions.�cCs||_t�||�dS�N)�message�	Exception�__init__)�self�msg�r"�1/opt/alt/python38/lib64/python3.8/configparser.pyr�szError.__init__cCs|jSr)r�r r"r"r#�__repr__�szError.__repr__N)r)�__name__�
__module__�__qualname__�__doc__rr%�__str__r"r"r"r#r�s
rc@seZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs$t�|d|f�||_|f|_dS)NzNo section: %r)rr�section�args�r r+r"r"r#r�szNoSectionError.__init__N�r&r'r(r)rr"r"r"r#r�sc@seZdZdZddd�ZdS)raRaised when a section is repeated in an input source.

    Possible repetitions that raise this exception are: multiple creation
    using the API or in strict parsers when a section is found more than once
    in a single input file, string or dictionary.
    NcCs�t|�dg}|dk	rRdt|�g}|dk	r8|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
|||f|_dS)N� already exists�While reading from � [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr+�source�linenor,)r r+r8r9r!rr"r"r#r�s

zDuplicateSectionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZddd�ZdS)rz�Raised by strict parsers when an option is repeated in an input source.

    Current implementation raises this exception only when an option is found
    more than once in a single file, string or dictionary.
    NcCs�t|�dt|�dg}|dk	rZdt|�g}|dk	r@|�d�|��|�d�|�|�|}n|�dd�t�|d�|��||_||_	||_
||_||||f|_dS)	Nz in section r/r0r1z	: option rzOption r)
r2r3r4r5r6rrr7r+�optionr8r9r,)r r+r:r8r9r!rr"r"r#r�s"�

zDuplicateOptionError.__init__)NNr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz!A requested option was not found.cCs.t�|d||f�||_||_||f|_dS)NzNo option %r in section: %r�rrr:r+r,)r r:r+r"r"r#r�s�zNoOptionError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)rz0Base class for interpolation-related exceptions.cCs(t�||�||_||_|||f|_dSrr;)r r:r+r!r"r"r#rszInterpolationError.__init__Nr.r"r"r"r#r�sc@seZdZdZdd�ZdS)r
zAA string substitution required a setting which was not available.cCs8d�||||�}t�||||�||_||||f|_dS)Nz�Bad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r4rr�	referencer,)r r:r+�rawvalr<r!r"r"r#rs�z(InterpolationMissingOptionError.__init__Nr.r"r"r"r#r
sc@seZdZdZdS)rz�Raised when the source text contains invalid syntax.

    Current implementation raises this exception when the source text into
    which substitutions are made does not conform to the required syntax.
    N)r&r'r(r)r"r"r"r#rsc@seZdZdZdd�ZdS)r	z0Raised when substitutions are nested too deeply.cCs0d�||t|�}t�||||�|||f|_dS)Nz�Recursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r4rrrr,)r r:r+r=r!r"r"r#rs�z InterpolationDepthError.__init__Nr.r"r"r"r#r	sc@s<eZdZdZd
dd�Zedd��Zejdd��Zdd	�ZdS)rz>Raised when a configuration file does not follow legal syntax.NcCsT|r|rtd��n|s$|s$td��n|r,|}t�|d|�||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r)�
ValueErrorrrr8�errorsr,)r r8�filenamer"r"r#r,s

zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.�SThe 'filename' attribute will be removed in future versions.  Use 'source' instead.���
stacklevel��warnings�warn�DeprecationWarningr8r$r"r"r#r@;s�zParsingError.filenamecCstjdtdd�||_dS)zDeprecated, user `source'.rArBrCNrE�r �valuer"r"r#r@Es�cCs*|j�||f�|jd||f7_dS)Nz
	[line %2d]: %s)r?r3r)r r9�liner"r"r#r3OszParsingError.append)NN)	r&r'r(r)r�propertyr@�setterr3r"r"r"r#r)s

	
	c@seZdZdZdd�ZdS)r
z@Raised when a key-value pair is found before any section header.cCs8t�|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr8r9rKr,)r r@r9rKr"r"r#rWs��z"MissingSectionHeaderError.__init__Nr.r"r"r"r#r
Tsc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|Srr")r �parserr+r:rJ�defaultsr"r"r#�
before_getkszInterpolation.before_getcCs|Srr"�r rNr+r:rJr"r"r#�
before_setnszInterpolation.before_setcCs|Srr"rQr"r"r#�before_readqszInterpolation.before_readcCs|Srr"rQr"r"r#�before_writetszInterpolation.before_writeN)r&r'r(r)rPrRrSrTr"r"r"r#rhs
c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
ra!Interpolation as implemented in the classic ConfigParser.

    The option values can contain format strings which refer to other values in
    the same section, or values in the special default section.

    For example:

        something: %(dir)s/whatever

    would resolve the "%(dir)s" to the value of dir.  All reference
    expansions are done late, on demand. If a user needs to use a bare % in
    a configuration file, she can escape it by writing %%. Other % usage
    is considered a user error and raises `InterpolationSyntaxError'.z
%\(([^)]+)\)sc	Cs$g}|�||||||d�d�|�S�N�r��_interpolate_somer7�r rNr+r:rJrO�Lr"r"r#rP�szBasicInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz%%r�%�1invalid interpolation syntax in %r at position %d��replace�_KEYCRE�subr>�find�r rNr+r:rJZ	tmp_valuer"r"r#rR�s�zBasicInterpolation.before_setc
Csj|j||d|d�}|tkr&t|||��|�rf|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�rR|j�|�}|dkr�t||d|��|�|�	d��}||�
�d�}z||}
Wn&tk
�rt||||�d�YnXd|
k�rF|�
||||
|||d�n
|�|
�q&t||d	|f��q&dS)
NT��raw�fallbackr[rrVrB�(�'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr	rar3r_�matchr�optionxform�group�end�KeyErrorr
rX)r rNr:�accum�restr+�map�depthr=�p�c�m�var�vr"r"r#rX�s`



���
���z$BasicInterpolation._interpolate_someN�
r&r'r(r)�re�compiler_rPrRrXr"r"r"r#rxs

c@s2eZdZdZe�d�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}c	Cs$g}|�||||||d�d�|�SrUrWrYr"r"r#rP�sz ExtendedInterpolation.before_getcCs<|�dd�}|j�d|�}d|kr8td||�d�f��|S)Nz$$r�$r\r]rbr"r"r#rR�s�z ExtendedInterpolation.before_setcCs�|j||d|d�}|tkr&t|||��|�r�|�d�}	|	dkrL|�|�dS|	dkrr|�|d|	��||	d�}|dd�}
|
dkr�|�d�|dd�}q&|
dk�r�|j�|�}|dkr�t||d|��|�d��	d	�}||�
�d�}|}
|}zrt|�dk�r|�|d�}||}nHt|�dk�rR|d}
|�|d�}|j|
|dd
�}nt||d|f��Wn2t
ttfk
�r�t|||d	�|��d�YnXd|k�r�|�|||||
t|j|
dd
��|d�n
|�|�q&t||d|f��q&dS)
NTrcrzrrVrB�{rg�:)rdzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rhrr	rar3r_rirrk�splitrl�lenrjrmrrr
r7rX�dict�items)r rNr:rnror+rprqr=rrrsrt�pathZsect�optrvr"r"r#rX�sx



�
���
���z'ExtendedInterpolation._interpolate_someNrwr"r"r"r#r�s

c@s6eZdZdZe�d�Zdd�Zdd�Ze	dd��Z
d	S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c

Cs�|}t}|r�|d8}|r�d|kr�tj|j|d�}|j�||�}z||}Wq�tk
r�}	zt||||	jd�d�W5d}	~	XYq�Xqq�q|r�d|kr�t	|||��|S)NrVz%()rNr)
r�	functools�partial�_interpolation_replacer_r`rmr
r,r	)
r rNr+r:rJ�varsr=rqr^�er"r"r#rPs0���zLegacyInterpolation.before_getcCs|Srr"rQr"r"r#rR$szLegacyInterpolation.before_setcCs,|�d�}|dkr|��Sd|�|�SdS)NrVz%%(%s)s)rkrj)rirN�sr"r"r#r�'s
z*LegacyInterpolation._interpolation_replaceN)r&r'r(r)rxryr_rPrR�staticmethodr�r"r"r"r#r
s
c
s6eZdZdZdZdZdZe�Ze	�
ee	j�Ze	�
ej
dd�e	j�Ze	�
ej
dd�e	j�Ze	�
d�Zddddd	d	d	d	d
�Zded	fdd
dddeeed�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdddd�Zdedd�Zdfd d!�Zdgd#d$�Zdhd%d&�Zd	ded'�d(d)�Z d*d+�Z!d	ded'�d,d-�Z"d	ded'�d.d/�Z#d	ded'�d0d1�Z$d	ded'�d2d3�Z%ed	df�fd4d5�	Z&d6d7�Z'd8d9�Z(d:d;�Z)did<d=�Z*djd>d?�Z+d@dA�Z,dBdC�Z-dDdE�Z.dFdG�Z/dHdI�Z0dJdK�Z1dLdM�Z2dNdO�Z3dPdQ�Z4dRdS�Z5dTdU�Z6dVdW�Z7dXdY�Z8dZd[�Z9d\d]�Z:d^d^d^d_�d`da�Z;e<dbdc��Z=�Z>S)krz,ConfigParser that does not do interpolation.z�
        \[                                 # [
        (?P<header>[^]]+)                  # very permissive!
        \]                                 # ]
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?P<vi>{delim})\s*              # any number of space/tab,
                                           # followed by any of the
                                           # allowed delimiters,
                                           # followed by any space/tab
        (?P<value>.*)$                     # everything up to eol
        a�
        (?P<option>.*?)                    # very permissive!
        \s*(?:                             # any number of space/tab,
        (?P<vi>{delim})\s*                 # optionally followed by
                                           # any of the allowed
                                           # delimiters, followed by any
                                           # space/tab
        (?P<value>.*))?$                   # everything up to eol
        z=|:�Zdelimz\STF)�1Zyes�trueZon�0ZnoZfalseZoffN��=r|)�#�;)�
delimiters�comment_prefixes�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
convertersc
Cs<||_|��|_|��|_t|�|_|��|_t||	�|j|	<t|�|_|dkrd|rZ|j	n|j
|_nNd�dd�|D��}|r�t
�|jj|d�t
j�|_nt
�|jj|d�t
j�|_t|p�d�|_t|p�d�|_||_||_||_|	|_|
|_|jtkr�|j|_|jdk�rt�|_|tk	�r(|j�|�|�r8|�|�dS)Nr��|css|]}t�|�VqdSr)rx�escape)�.0�dr"r"r#�	<genexpr>jsz+RawConfigParser.__init__.<locals>.<genexpr>r�r")�_dict�	_sections�	_defaultsr�_converters�_proxiesr�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer7rxry�_OPT_NV_TMPLr4�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update�_read_defaults)
r rOZ	dict_typeZallow_no_valuer�r�r�r�r�r�r�r�r�r"r"r#rYs@




��

zRawConfigParser.__init__cCs|jSr)r�r$r"r"r#rO�szRawConfigParser.defaultscCst|j���S)z3Return a list of section names, excluding [DEFAULT])�listr��keysr$r"r"r#�sections�szRawConfigParser.sectionscCsJ||jkrtd|��||jkr(t|��|��|j|<t||�|j|<dS)z�Create a new section in the configuration.

        Raise DuplicateSectionError if a section by the specified name
        already exists. Raise ValueError if name is DEFAULT.
        zInvalid section name: %rN)r�r>r�rr�rr�r-r"r"r#�add_section�s

zRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�r-r"r"r#�has_section�szRawConfigParser.has_sectioncCsJz|j|��}Wntk
r0t|�d�YnX|�|j�t|���S)z9Return a list of option names for the given section name.N)r��copyrmrr�r�r�r�)r r+Zoptsr"r"r#�options�szRawConfigParser.optionsc
Cs�t|tttjf�r|g}g}|D]f}z(t||d��}|�||�W5QRXWntk
rdYq YnXt|tj�r|t�|�}|�	|�q |S)a�Read and parse a filename or an iterable of filenames.

        Files that cannot be opened are silently ignored; this is
        designed so that you can specify an iterable of potential
        configuration file locations (e.g. current directory, user's
        home directory, systemwide directory), and all existing
        configuration files in the iterable will be read.  A single
        filename may also be given.

        Return list of successfully read files.
        )�encoding)
�
isinstance�str�bytes�os�PathLike�open�_read�OSError�fspathr3)r �	filenamesr�Zread_okr@�fpr"r"r#�read�s

zRawConfigParser.readcCs<|dkr,z
|j}Wntk
r*d}YnX|�||�dS)aPLike read() but the argument must be a file-like object.

        The `f' argument must be iterable, returning one line at a time.
        Optional second argument is the `source' specifying the name of the
        file being read. If not given, it is taken from f.name. If `f' has no
        `name' attribute, `<???>' is used.
        Nz<???>)�name�AttributeErrorr�)r �fr8r"r"r#�	read_file�s

zRawConfigParser.read_file�<string>cCst�|�}|�||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr8Zsfiler"r"r#�read_string�s
zRawConfigParser.read_string�<dict>c
Cs�t�}|��D]�\}}t|�}z|�|�Wn(ttfk
rT|jrP||krP�YnX|�|�|��D]`\}}|�t|��}|dk	r�t|�}|jr�||f|kr�t	|||��|�||f�|�|||�qhqdS)aRead configuration from a dictionary.

        Keys are section names, values are dictionaries with keys and values
        that should be present in the section. If the used dictionary type
        preserves order, sections and their keys will be added in order.

        All types held in the dictionary are converted to strings during
        reading, including section names, option names and keys.

        Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
�setr�r�r�rr>r��addrjr)r Z
dictionaryr8�elements_addedr+r��keyrJr"r"r#�	read_dict�s"

zRawConfigParser.read_dictcCs"tjdtdd�|j||d�dS)z"Deprecated, use read_file instead.zRThis method will be removed in future versions.  Use 'parser.read_file()' instead.rBrC)r8N)rFrGrHr�)r r�r@r"r"r#�readfp�s�zRawConfigParser.readfp�rdr�recCs�z|�||�}Wn(tk
r8|tkr,�n|YSYnX|�|�}z||}Wn0tk
r�|tkrtt||��n|YSYnX|s�|dkr�|S|j�|||||�SdS)a]Get an option value for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        N)�
_unify_valuesrr�rjrmrr�rP)r r+r:rdr�rer�rJr"r"r#rh�s$
�zRawConfigParser.getcKs||j||f|��Sr)rh)r r+�convr:�kwargsr"r"r#�_get"szRawConfigParser._getc	KsJz|j|||f||d�|��WSttfk
rD|tkr<�|YSXdS)N)rdr�)r�rrr�)r r+r:r�rdr�rer�r"r"r#�	_get_conv%s�zRawConfigParser._get_convcKs|j||tf|||d�|��S�Nr�)r��int�r r+r:rdr�rer�r"r"r#�getint0s
��zRawConfigParser.getintcKs|j||tf|||d�|��Sr�)r��floatr�r"r"r#�getfloat5s
��zRawConfigParser.getfloatcKs |j|||jf|||d�|��Sr�)r��_convert_to_booleanr�r"r"r#�
getboolean:s��zRawConfigParser.getbooleancs��tkrt���S�j���z���j��Wn&tk
rV��jkrRt	���YnXt
����}|r�|��D]\}}|���|�<qp���fdd��|r��fdd���fdd�|D�S)a�Return a list of (name, value) tuples for each option in a section.

        All % interpolations are expanded in the return values, based on the
        defaults passed into the constructor, unless the optional argument
        `raw' is true.  Additional substitutions may be provided using the
        `vars' argument, which must be a dictionary whose contents overrides
        any pre-existing defaults.

        The section DEFAULT is special.
        cs�j���|�|��Sr)r�rP�r:)r�r+r r"r#�<lambda>Ws
�z'RawConfigParser.items.<locals>.<lambda>cs�|Srr"r�)r�r"r#r�Z�csg|]}|�|�f�qSr"r")r�r:)�value_getterr"r#�
<listcomp>[sz)RawConfigParser.items.<locals>.<listcomp>)
r��superr�r�r�r�r�rmr�rr�r�rj)r r+rdr�Z	orig_keysr�rJ��	__class__)r�r+r r�r#r�?s 


zRawConfigParser.itemscCs.|��D]}||}||=||fSt�dS)z�Remove a section from the parser and return it as
        a (section_name, section_proxy) tuple. If no section is present, raise
        KeyError.

        The section DEFAULT is never returned because it cannot be removed.
        N)r�rm�r r�rJr"r"r#�popitem]s
zRawConfigParser.popitemcCs|��Sr)�lower)r Z	optionstrr"r"r#rjjszRawConfigParser.optionxformcCsV|r||jkr"|�|�}||jkS||jkr0dS|�|�}||j|kpP||jkSdS)z�Check for the existence of a given option in a given section.
        If the specified `section' is None or an empty string, DEFAULT is
        assumed. If the specified `section' does not exist, returns False.FN)r�rjr�r�)r r+r:r"r"r#�
has_optionms



�zRawConfigParser.has_optioncCsl|r|j�||||�}|r$||jkr,|j}n.z|j|}Wntk
rXt|�d�YnX|||�|�<dS)zSet an option.N)r�rRr�r�r�rmrrj)r r+r:rJ�sectdictr"r"r#r�{s�zRawConfigParser.setcCsh|rd�|jd�}n
|jd}|jr>|�||j|j��|�|jD]}|�|||j|��|�qDdS)z�Write an .ini-format representation of the configuration state.

        If `space_around_delimiters' is True (the default), delimiters
        between keys and values are surrounded by spaces.
        z {} rN)r4r�r��_write_sectionr�r�r�)r r�Zspace_around_delimitersr�r+r"r"r#�write�s

�
�zRawConfigParser.writecCsx|�d�|��|D]T\}}|j�||||�}|dk	s<|jsR|t|��dd�}nd}|�d�||��q|�d�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r4r�rTr�r�r^)r r�Zsection_nameZ
section_itemsZ	delimiterr�rJr"r"r#r��s�zRawConfigParser._write_sectioncCsd|r||jkr|j}n.z|j|}Wntk
rBt|�d�YnX|�|�}||k}|r`||=|S)zRemove an option.N)r�r�r�rmrrj)r r+r:r��existedr"r"r#�
remove_option�s
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)r�r�)r r+r�r"r"r#�remove_section�s

zRawConfigParser.remove_sectioncCs&||jkr|�|�st|��|j|Sr)r�r�rmr��r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCsX||kr|||krdS||jkr.|j��n||jkrF|j|��|�||i�dSr)r�r��clearr�r�r�r"r"r#�__setitem__�s

zRawConfigParser.__setitem__cCs2||jkrtd��|�|�s$t|��|�|�dS)Nz"Cannot remove the default section.)r�r>r�rmr�r�r"r"r#�__delitem__�s


zRawConfigParser.__delitem__cCs||jkp|�|�Sr)r�r�r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrV)r~r�r$r"r"r#�__len__�szRawConfigParser.__len__cCst�|jf|j���Sr)�	itertools�chainr�r�r�r$r"r"r#�__iter__�szRawConfigParser.__iter__cCs t�}d}d}d}d}d}d}	t|dd�D�]�\}}
tj}dd�|jD�}|tjkr�|r�i}
|��D]T\}}|
�||d�}|dkr�qd||
|<|dks�|dkrd|
|d��rdt||�}qd|
}qJ|j	D]}|
�
��|�r�d}q�q�|tjkr�d}|
d|��
�}|�sN|j�rF|dk�rL|dk	�rL|�rL||dk	�rL||�
d�q*tj}q*|j�|
�}|�rh|��nd}|dk	�r�|�r�||k�r�||�
|�q*|}|j�|�}|�r<|�d	�}||jk�r�|j�r�||k�r�t|||��|j|}|�|�n@||jk�r
|j}n,|��}||j|<t||�|j|<|�|�d}q*|dk�rTt|||
��q*|j�|�}|�r�|�d
dd�\}}}|�s�|�|	|||
�}	|� |�!��}|j�r�||f|k�r�t"||||��|�||f�|dk	�r�|�
�}|g||<nd||<q*|�|	|||
�}	q*|�#�|	�r|	�dS)
aParse a sectioned configuration file.

        Each section in a configuration file contains a header, indicated by
        a name in square brackets (`[]'), plus key/value options, indicated by
        `name' and `value' delimited with a specific substring (`=' or `:' by
        default).

        Values can span multiple lines, as long as they are indented deeper
        than the first line of the value. Depending on the parser's mode, blank
        lines may be treated as parts of multiline values or ignored.

        Configuration files may include comments, prefixed by specific
        characters (`#' and `;' by default). Comments may appear on their own
        in an otherwise empty line or may be entered in lines holding values or
        section names.
        NrrV)�startcSsi|]
}|d�qS)���r")r�rrr"r"r#�
<dictcomp>�sz)RawConfigParser._read.<locals>.<dictcomp>rr�headerr:�virJ)$r��	enumerate�sys�maxsizer�r�ra�isspace�minr��strip�
startswithr�r3�NONSPACECRE�searchr�SECTCRErirkr�r�rr�r�r�r�rr�r
r��
_handle_errorrj�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer9Zindent_levelr�rKZ
comment_startZinline_prefixesZ
next_prefixes�prefix�indexrJZfirst_nonspaceZcur_indent_levelZmor	Zoptvalr"r"r#r��s� 


��
��
�




��

zRawConfigParser._readcCsr|j|jf}t�|f|j���}|D]H\}}|��D]6\}}t|t�rTd�|��	�}|j
�||||�||<q4q$dS)Nr�)r�r�rrr�r�r�r�r7rr�rS)r rOZall_sectionsr+r�r��valr"r"r#r[s�
�z&RawConfigParser._join_multiline_valuescCs&|��D]\}}||j|�|�<qdS)zTRead the defaults passed in the initializer.
        Note: values can be non-string.N)r�r�rj)r rOr�rJr"r"r#r�gszRawConfigParser._read_defaultscCs |st|�}|�|t|��|Sr)rr3r2)r �excrr9rKr"r"r#rmszRawConfigParser._handle_errorcCs�i}z|j|}Wn(tk
r:||jkr6t|�d�YnXi}|rt|��D]&\}}|dk	rdt|�}|||�|�<qLt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rmr�rr�r�rj�	_ChainMapr�)r r+r�ZsectiondictZvardictr�rJr"r"r#r�ss
zRawConfigParser._unify_valuescCs(|��|jkrtd|��|j|��S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr>rIr"r"r#r��sz#RawConfigParser._convert_to_booleanr)r+r:rJcCsDt|t�std��t|t�s$td��|jr.|r@t|t�s@td��dS)a�Raises a TypeError for non-string values.

        The only legal non-string value if we allow valueless
        options is None, so we need to check if the value is a
        string if:
        - we do not allow valueless options, or
        - we allow valueless options but the value is not None

        For compatibility reasons this method is not used in classic set()
        for RawConfigParsers. It is invoked in every case for mapping protocol
        access and in ConfigParser.set().
        zsection names must be stringszoption keys must be stringszoption values must be stringsN)r�r��	TypeErrorr��r r+r:rJr"r"r#�_validate_value_types�s



z%RawConfigParser._validate_value_typescCs|jSr)r�r$r"r"r#r��szRawConfigParser.converters)N)N)r�)r�)N)N)T)?r&r'r(r)Z
_SECT_TMPLr�r�rr�rxryr�rr4r�r�rr�
_default_dictrr�rrOr�r�r�r�r�r�r�r�r�rhr�r�r�r�r�r�r�rjr�r�r�r�r�r�r�r�r�rrrr�rr�rr�r�r rLr��
__classcell__r"r"r�r#r0s�

���(	




	%����




zcs<eZdZdZe�Zd	�fdd�	Z�fdd�Zdd�Z�Z	S)
rz(ConfigParser implementing interpolation.Ncs"|j||d�t��|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.�r:rJN)r r�r�rr�r"r#r��szConfigParser.setcs|j|d�t��|�dS)z�Create a new section in the configuration.  Extends
        RawConfigParser.add_section by validating if the section name is
        a string.)r+N)r r�r�r-r�r"r#r��szConfigParser.add_sectioncCs0z"|j}t�|_|�|j|i�W5||_XdS)z�Reads the defaults passed in the initializer, implicitly converting
        values to strings like the rest of the API.

        Does not perform interpolation for backwards compatibility.
        N)r�rr�r�)r rOZhold_interpolationr"r"r#r��s
zConfigParser._read_defaults)N)
r&r'r(r)rr�r�r�r�r"r"r"r�r#r�s
cs eZdZdZ�fdd�Z�ZS)rz8ConfigParser alias for backwards compatibility purposes.cs"t�j||�tjdtdd�dS)Nz�The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.rBrC)r�rrFrGrH)r r,r�r�r"r#r�s�zSafeConfigParser.__init__)r&r'r(r)rr"r"r"r�r#r�sc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddd�dd�ZdS)rz+A proxy for a single section from a parser.cCsF||_||_|jD].}d|}tj|jt||�d�}t|||�qdS)z@Creates a view on a section of the specified `name` in `parser`.rh��_implN)�_parser�_namer�r�r�rh�getattr�setattr)r rNr�r�r��getterr"r"r#r�s
zSectionProxy.__init__cCsd�|j�S)Nz
<Section: {}>)r4r'r$r"r"r#r%�szSectionProxy.__repr__cCs(|j�|j|�st|��|j�|j|�Sr)r&r�r'rmrhr�r"r"r#r��szSectionProxy.__getitem__cCs"|jj||d�|j�|j||�S)Nr#)r&r r�r'r�r"r"r#r��szSectionProxy.__setitem__cCs,|j�|j|�r |j�|j|�s(t|��dSr)r&r�r'r�rmr�r"r"r#r��s�zSectionProxy.__delitem__cCs|j�|j|�Sr)r&r�r'r�r"r"r#r�szSectionProxy.__contains__cCst|���Sr)r~�_optionsr$r"r"r#r�szSectionProxy.__len__cCs|����Sr)r+rr$r"r"r#r�szSectionProxy.__iter__cCs*|j|jjkr|j�|j�S|j��SdSr)r'r&r�r�rOr$r"r"r#r+�szSectionProxy._optionscCs|jSr)r&r$r"r"r#rNszSectionProxy.parsercCs|jSr)r'r$r"r"r#r�szSectionProxy.nameNF)rdr�r%cKs(|s|jj}||j|f|||d�|��S)z�Get an option value.

        Unless `fallback` is provided, `None` will be returned if the option
        is not found.

        r�)r&rhr')r r:rerdr�r%r�r"r"r#rhs
��zSectionProxy.get)N)r&r'r(r)rr%r�r�r�rrrr+rLrNr�rhr"r"r"r#r�s"	

�c@sJeZdZdZe�d�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)ra/Enables reuse of get*() methods between the parser and section proxies.

    If a parser class implements a getter directly, the value for the given
    key will be ``None``. The presence of the converter name here enables
    section proxies to find and use the implementation on the parser class.
    z^get(?P<name>.+)$cCsR||_i|_t|j�D]6}|j�|�}|rtt|j|��s<qd|j|�d�<qdS)Nr�)r&�_data�dir�	GETTERCREri�callabler(rk)r rNr*rtr"r"r#r%szConverterMapping.__init__cCs
|j|Sr)r,r�r"r"r#r�.szConverterMapping.__getitem__c	Cs�zd|}Wn(tk
r4td�|t|����YnX|dkrFtd��||j|<tj|jj|d�}||_	t
|j||�|j��D] }tj|j|d�}t
|||�q�dS)NrhzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r�r$)
rr>r4�typer,r�r�r&r�Z	converterr)�valuesrh)r r�rJ�k�func�proxyr*r"r"r#r�1s �
zConverterMapping.__setitem__c	Cs~zd|p
d}Wntk
r,t|��YnX|j|=t�|jf|j���D],}zt||�WqLtk
rvYqLYqLXqLdS)Nrh)	rrmr,rrr&r1�delattrr�)r r�r2�instr"r"r#r�AszConverterMapping.__delitem__cCs
t|j�Sr)�iterr,r$r"r"r#rOszConverterMapping.__iter__cCs
t|j�Sr)r~r,r$r"r"r#rRszConverterMapping.__len__N)
r&r'r(r)rxryr.rr�r�r�rrr"r"r"r#rs
	))r)Zcollections.abcr�collectionsrrr�r�rr�rxrrF�__all__rr!rrrrrrrrrr
rr	rr
�objectr�rrrrrrrrrr"r"r"r#�<module>st
�	
	

+HJ&| 
F

Hacked By AnonymousFox1.0, Coded By AnonymousFox