Hacked By AnonymousFox

Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/configparser.cpython-35.opt-1.pyc



��Yf���@s�dZddlmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddddd	d
ddd
ddddddddddddgZdZdZGdd�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�ZGd)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 object s 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 list 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)�OrderedDict�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@s7eZdZdZddd�Zdd�ZeZdS)�Errorz'Base class for ConfigParser exceptions.�cCs||_tj||�dS)N)�message�	Exception�__init__)�self�msg�r"�1/opt/alt/python35/lib64/python3.5/configparser.pyr�s	zError.__init__cCs|jS)N)r)r r"r"r#�__repr__�szError.__repr__N)�__name__�
__module__�__qualname__�__doc__rr$�__str__r"r"r"r#r�src@s"eZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs0tj|d|f�||_|f|_dS)NzNo section: %r)rr�section�args)r r*r"r"r#r�s	zNoSectionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@s(eZdZdZdddd�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	rudt|�g}|dk	rR|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
|||f|_dS)Nz already existszWhile reading from z [line {0:2d}]z
: section rzSection r)�repr�append�format�extend�insertrr�joinr*�source�linenor+)r r*r2r3r!rr"r"r#r�s

				zDuplicateSectionError.__init__)r%r&r'r(rr"r"r"r#r�sc@s(eZdZdZdddd�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	r�dt|�g}|dk	r^|jdj|��|jd�|j|�|}n|jdd�tj|dj|��||_||_	||_
||_||||f|_dS)	Nz in section z already existszWhile reading from z [line {0:2d}]z	: option rzOption r)
r,r-r.r/r0rrr1r*�optionr2r3r+)r r*r4r2r3r!rr"r"r#r�s 	

					zDuplicateOptionError.__init__)r%r&r'r(rr"r"r"r#r�sc@s"eZdZdZdd�ZdS)rz!A requested option was not found.cCs?tj|d||f�||_||_||f|_dS)NzNo option %r in section: %r)rrr4r*r+)r r4r*r"r"r#r�s
		zNoOptionError.__init__N)r%r&r'r(rr"r"r"r#r�sc@s"eZdZdZdd�ZdS)r	z0Base class for interpolation-related exceptions.cCs8tj||�||_||_|||f|_dS)N)rrr4r*r+)r r4r*r!r"r"r#r�s		zInterpolationError.__init__N)r%r&r'r(rr"r"r"r#r	�sc@s"eZdZdZdd�ZdS)rzAA string substitution required a setting which was not available.cCsPdj||||�}tj||||�||_||||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})r.r	r�	referencer+)r r4r*�rawvalr5r!r"r"r#r	s
	z(InterpolationMissingOptionError.__init__N)r%r&r'r(rr"r"r"r#rsc@seZdZdZdS)rz�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#rsc@s"eZdZdZdd�ZdS)r
z0Raised when substitutions are nested too deeply.cCsDdj||t|�}tj||||�|||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})r.rr	rr+)r r4r*r6r!r"r"r#rs
		z InterpolationDepthError.__init__N)r%r&r'r(rr"r"r"r#r
sc@s[eZdZdZdddd�Zedd��Zejdd��Zdd	�ZdS)
r
z>Raised when a configuration file does not follow legal syntax.NcCsz|r|rtd��n)|r8|r8td��n|rD|}tj|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)�
ValueErrorrrr2�errorsr+)r r2�filenamer"r"r#r*s		zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.�
stacklevel�)�warnings�warn�DeprecationWarningr2)r r"r"r#r99s
zParsingError.filenamecCs#tjdtdd�||_dS)zDeprecated, user `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r:r;N)r<r=r>r2)r �valuer"r"r#r9Cs
cCs3|jj||f�|jd||f7_dS)Nz
	[line %2d]: %s)r8r-r)r r3�liner"r"r#r-MszParsingError.append)	r%r&r'r(r�propertyr9�setterr-r"r"r"r#r
's


c@s"eZdZdZdd�ZdS)rz@Raised when a key-value pair is found before any section header.cCsNtj|d|||f�||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr2r3r@r+)r r9r3r@r"r"r#rUs			z"MissingSectionHeaderError.__init__N)r%r&r'r(rr"r"r"r#rRsc@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rzBDummy interpolation that passes the value through with no changes.cCs|S)Nr")r �parserr*r4r?�defaultsr"r"r#�
before_getiszInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#�
before_setlszInterpolation.before_setcCs|S)Nr")r rCr*r4r?r"r"r#�before_readoszInterpolation.before_readcCs|S)Nr")r rCr*r4r?r"r"r#�before_writerszInterpolation.before_writeN)r%r&r'r(rErFrGrHr"r"r"r#rfs
c@sIeZdZdZejd�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
%\(([^)]+)\)scCs2g}|j||||||d�dj|�S)N�r)�_interpolate_somer1)r rCr*r4r?rD�Lr"r"r#rE�szBasicInterpolation.before_getcCsV|jdd�}|jjd|�}d|krRtd||jd�f��|S)Nz%%r�%z1invalid interpolation syntax in %r at position %d)�replace�_KEYCRE�subr7�find)r rCr*r4r?�	tmp_valuer"r"r#rF�szBasicInterpolation.before_setcCs�|j||ddd|�}|tkr<t|||��x�|r�|jd�}	|	dkrq|j|�dS|	dkr�|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q?|
dkr�|jj|�}|dkr t||d	|��|j|j	d��}||j
�d�}y||}
Wn*tk
r�t||||�d�YnXd|
kr�|j
||||
|||d�q�|j|
�q?t||d
|f��q?WdS)N�rawT�fallbackrLrrIr;�(z'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr
rPr-rN�matchr�optionxform�group�end�KeyErrorrrJ)r rCr4�accum�restr*�map�depthr6�p�c�m�var�vr"r"r#rJ�sF	

	

z$BasicInterpolation._interpolate_someN)
r%r&r'r(�re�compilerNrErFrJr"r"r"r#rvs

c@sIeZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}cCs2g}|j||||||d�dj|�S)NrIr)rJr1)r rCr*r4r?rDrKr"r"r#rE�sz ExtendedInterpolation.before_getcCsV|jdd�}|jjd|�}d|krRtd||jd�f��|S)Nz$$r�$z1invalid interpolation syntax in %r at position %d)rMrNrOr7rP)r rCr*r4r?rQr"r"r#rF�sz ExtendedInterpolation.before_setcCs�|j||ddd|�}|tkr<t|||��xg|r�|jd�}	|	dkrq|j|�dS|	dkr�|j|d|	��||	d�}|dd�}
|
dkr�|jd�|dd�}q?|
dkr�|jj|�}|dkr t||d	|��|jd�j	d
�}||j
�d�}|}
|}y�t|�dkr�|j|d�}||}nct|�dkr�|d}
|j|d�}|j|
|dd�}nt||d|f��Wn<t
ttfk
r1t|||d
j|��d�YnXd|kry|j|||||
t|j|
dd��|d�q�|j|�q?t||d|f��q?WdS)
NrRTrSrfrrIr;�{z'bad interpolation variable reference %r�:zMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rUrr
rPr-rNrVrrX�splitrY�lenrWrZrrrr1rJ�dict�items)r rCr4r[r\r*r]r^r6r_r`ra�pathZsectZoptrcr"r"r#rJ�s^	

	


#z'ExtendedInterpolation._interpolate_someN)
r%r&r'r(rdrerNrErFrJr"r"r"r#r�s
c@sOeZdZdZejd�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}x�|r�|d8}|r�d|kr�tj|jd|�}|jj||�}y||}Wq�tk
r�}	z$t||||	jd�d�WYdd}	~	Xq�XqPqW|r�d|kr�t	|||��|S)NrIz%(rCr)
r�	functools�partial�_interpolation_replacerNrOrZrr+r
)
r rCr*r4r?�varsr6r^rM�er"r"r#rEs"	
	2zLegacyInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#rF"szLegacyInterpolation.before_setcCs:|jd�}|dkr%|j�Sd|j|�SdS)NrIz%%(%s)s)rXrW)rVrC�sr"r"r#rp%s
z*LegacyInterpolation._interpolation_replaceN)r%r&r'r(rdrerNrErF�staticmethodrpr"r"r"r#rs
cspeZdZdZdZdZdZe�Ze	j
ee	j�Ze	j
ej
dd�e	j�Ze	j
ej
dd�e	j�Ze	j
d�Zdd	d
d	dd	dd	d
dddddddiZdedddvddwdddd	dd	dedededd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zdd+d,�Zdd-d.�Zd/d0d1�Zd2d3d4�Zdd5d6�Zd7dd8dd9ed:d;�Z d<d=�Z!d7dd8dd9ed>d?�Z"d7dd8dd9ed@dA�Z#d7dd8dd9edBdC�Z$d7dd8dd9edDdE�Z%edd�fdFdG�Z&dHdI�Z'dJdK�Z(dLdM�Z)ddNdO�Z*d	dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhdi�Z7djdk�Z8dldm�Z9dndodpdodqdodrds�Z:e;dtdu��Z<�S)xrz,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
        �delimz=|:z\S�1T�yes�trueZon�0F�no�falseZoffN�
delimiters�=rh�comment_prefixes�#�;�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolation�
converterscCs�||_|j�|_|j�|_t|�|_|j�|_t||	�|j|	<|r�x0|j�D]"\}}
|
|j|j|�<qnWt	|�|_
|dkr�|r�|jn|j|_
nsdjdd�|D��}|rtj|jjd|�tj�|_
n'tj|jjd|�tj�|_
t	|pLf�|_t	|paf�|_||_||_||_|	|_|
|_|jtkr�|j|_|jdkr�t�|_|tk	r�|jj|�dS)Nr}rh�|css|]}tj|�VqdS)N)rd�escape)�.0�dr"r"r#�	<genexpr>ksz+RawConfigParser.__init__.<locals>.<genexpr>ru)r}rh) �_dict�	_sections�	_defaultsr�_converters�_proxiesrrlrW�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer1rdre�_OPT_NV_TMPLr.�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr�update)r rDZ	dict_typeZallow_no_valuer|r~r�r�r�r�r�r��keyr?r�r"r"r#rWs>						zRawConfigParser.__init__cCs|jS)N)r�)r r"r"r#rD�szRawConfigParser.defaultscCst|jj��S)z3Return a list of section names, excluding [DEFAULT])�listr��keys)r r"r"r#�sections�szRawConfigParser.sectionscCsg||jkrtd|��||jkr:t|��|j�|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�r7r�rr�rr�)r 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"r#�has_section�szRawConfigParser.has_sectioncCs[y|j|j�}Wn!tk
r:t|�d�YnX|j|j�t|j��S)z9Return a list of option names for the given section name.N)r��copyrZrr�r�r�r�)r r*Zoptsr"r"r#�options�s
zRawConfigParser.optionscCs�t|t�r|g}g}xc|D][}y0t|d|��}|j||�WdQRXWntk
rrw%YnX|j|�q%W|S)a�Read and parse a filename or a list of filenames.

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

        Return list of successfully read files.
        �encodingN)�
isinstance�str�open�_read�OSErrorr-)r �	filenamesr�Zread_okr9�fpr"r"r#�read�s	

zRawConfigParser.readcCsH|dkr4y
|j}Wntk
r3d}YnX|j||�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 �fr2r"r"r#�	read_file�s

zRawConfigParser.read_filez<string>cCs#tj|�}|j||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r �stringr2Zsfiler"r"r#�read_string�szRawConfigParser.read_stringz<dict>cCs$t�}x|j�D]\}}t|�}y|j|�Wn0ttfk
rq|jrm||krm�YnX|j|�x�|j�D]�\}}|jt|��}|dk	r�t|�}|jr�||f|kr�t	|||��|j||f�|j|||�q�WqWdS)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)
�setrlr�r�rr7r��addrWr)r Z
dictionaryr2�elements_addedr*r�r�r?r"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.r:r;r2N)r<r=r>r�)r r�r9r"r"r#�readfp�s
zRawConfigParser.readfprRrqrScCs�y|j||�}Wn(tk
r@|tkr8�n|SYnX|j|�}y||}Wn4tk
r�|tkr�t||��n|SYnX|s�|dkr�|S|jj|||||�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�rWrZrr�rE)r r*r4rRrqrSr�r?r"r"r#rU�s"
	
	zRawConfigParser.getcKs||j|||��S)N)rU)r r*�convr4�kwargsr"r"r#�_getszRawConfigParser._getcKsXy&|j|||d|d||�SWn+ttfk
rS|tkrK�|SYnXdS)NrRrq)r�rrr�)r r*r4r�rRrqrSr�r"r"r#�	_get_conv"szRawConfigParser._get_convcKs(|j||td|d|d||�S)NrRrqrS)r��int)r r*r4rRrqrSr�r"r"r#�getint-szRawConfigParser.getintcKs(|j||td|d|d||�S)NrRrqrS)r��float)r r*r4rRrqrSr�r"r"r#�getfloat2szRawConfigParser.getfloatcKs+|j|||jd|d|d||�S)NrRrqrS)r��_convert_to_boolean)r r*r4rRrqrSr�r"r"r#�
getboolean7szRawConfigParser.getbooleanc
s��tkrt�j�S�jj��y�j�j��Wn-tk
ro��jkrkt	���YnX|r�x-|j�D]\}}|��j
|�<q�W���fdd��|r��fdd���fdd��j�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 �jj��|�|��S)N)r�rE)r4)r�r*r r"r#�<lambda>Ssz'RawConfigParser.items.<locals>.<lambda>cs�|S)Nr")r4)r�r"r#r�Vscs"g|]}|�|�f�qSr"r")r�r4)�value_getterr"r#�
<listcomp>Ws	z)RawConfigParser.items.<locals>.<listcomp>)r��superrlr�r�r�r�rZr�rrWr�)r r*rRrqr�r?)�	__class__)r�r*r r�r#rl<s

zRawConfigParser.itemscCs9x,|j�D]}||}||=||fSWt�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�rZ)r r�r?r"r"r#�popitemYs

zRawConfigParser.popitemcCs
|j�S)N)�lower)r Z	optionstrr"r"r#rWfszRawConfigParser.optionxformcCsx|s||jkr2|j|�}||jkS||jkrEdS|j|�}||j|kps||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�rWr�r�)r r*r4r"r"r#�
has_optionis
zRawConfigParser.has_optioncCs�|r!|jj||||�}|s7||jkrC|j}n5y|j|}Wn!tk
rwt|�d�YnX|||j|�<dS)zSet an option.N)r�rFr�r�r�rZrrW)r r*r4r?�sectdictr"r"r#r�ws	
zRawConfigParser.setcCs�|rdj|jd�}n
|jd}|jrW|j||j|jj�|�x4|jD])}|j|||j|j�|�qaWdS)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)r.r�r��_write_sectionr�rlr�)r r�Zspace_around_delimitersr�r*r"r"r#�write�s
	zRawConfigParser.writecCs�|jdj|��x�|D]{\}}|jj||||�}|dk	sZ|jry|t|�jdd�}nd}|jdj||��qW|jd�dS)z-Write a single section to the specified `fp'.z[{}]
N�
z
	rz{}{}
)r�r.r�rHr�r�rM)r r�Zsection_nameZ
section_itemsZ	delimiterr�r?r"r"r#r��s	zRawConfigParser._write_sectioncCs�|s||jkr"|j}n5y|j|}Wn!tk
rVt|�d�YnX|j|�}||k}|r||=|S)zRemove an option.N)r�r�r�rZrrW)r r*r4r��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_sectioncCs6||jkr+|j|�r+t|��|j|S)N)r�r�rZr�)r r�r"r"r#�__getitem__�szRawConfigParser.__getitem__cCsV||jkr|jj�n ||jkr?|j|j�|j||i�dS)N)r�r��clearr�r�)r r�r?r"r"r#�__setitem__�s
zRawConfigParser.__setitem__cCsG||jkrtd��|j|�s6t|��|j|�dS)Nz"Cannot remove the default section.)r�r7r�rZr�)r r�r"r"r#�__delitem__�s
zRawConfigParser.__delitem__cCs||jkp|j|�S)N)r�r�)r r�r"r"r#�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrI)rjr�)r r"r"r#�__len__�szRawConfigParser.__len__cCstj|jf|jj��S)N)�	itertools�chainr�r�r�)r r"r"r#�__iter__�szRawConfigParser.__iter__cCsFt�}d}d}d}d}d}d}	x�t|dd�D]�\}}
tj}dd�|jD�}x�|tjkr|ri}
x�|j�D]v\}}|
j||d�}|dkr�q�||
|<|dks�|dkr�|
|dj�r�t||�}q�W|
}qnWx-|j	D]"}|
j
�j|�r$d}Pq$W|tjkr_d}|
d|�j
�}|s�|jr�|dkr�|dk	r�|r�||dk	r�||j
d�q@tj}q@|jj|
�}|r�|j�nd}|dk	r.|r.||kr.||j
|�q@|}|jj|�}|r|jd�}||jkr�|jr�||kr�t|||��|j|}|j|�nW||jkr�|j}n<|j�}||j|<t||�|j|<|j|�d}q@|dkr/t|||
��q@|jj|�}|r|jd	d
d�\}}}|s�|j|	|||
�}	|j |j!��}|jr�||f|kr�t"||||��|j||f�|dk	r|j
�}|g||<q(d||<q@|j|	|||
�}	q@W|j#�|	rB|	�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.
        Nr�startrIcSsi|]}d|�qS)rI���r")r�r_r"r"r#�
<dictcomp>�s	z)RawConfigParser._read.<locals>.<dictcomp>r�headerr4�vir?r�)$r��	enumerate�sys�maxsizer�rlrP�isspace�minr��strip�
startswithr�r-�NONSPACECRE�searchr��SECTCRErVrXr�r�rr�r�r�r�rr�rr��
_handle_errorrW�rstripr�_join_multiline_values)r r��fpnamer�ZcursectZsectnameZoptnamer3Zindent_levelrrr@Z
comment_startZinline_prefixesZ
next_prefixes�prefix�indexr?Zfirst_nonspaceZcur_indent_levelZmor�Zoptvalr"r"r#r��s�		
,
				


			

zRawConfigParser._readcCs�|j|jf}tj|f|jj��}xt|D]l\}}x]|j�D]O\}}t|t�r�dj|�j	�}|j
j||||�||<qPWq7WdS)Nr�)r�r�r�r�r�rlr�r�r1r�r�rG)r rDZall_sectionsr*r�r��valr"r"r#r�Vsz&RawConfigParser._join_multiline_valuescCs,|st|�}|j|t|��|S)N)r
r-r,)r �excr�r3r@r"r"r#r�bszRawConfigParser._handle_errorc
Cs�i}y|j|}Wn-tk
rF||jkrBt|��YnXi}|r�xE|j�D]7\}}|dk	r�t|�}|||j|�<q`Wt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rZr�rrlr�rW�	_ChainMapr�)r r*rqZsectiondictZvardictr�r?r"r"r#r�hs
zRawConfigParser._unify_valuescCs6|j�|jkr%td|��|j|j�S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr7)r r?r"r"r#r�|sz#RawConfigParser._convert_to_booleanr*rr4r?cCset|t�std��t|t�s6td��|jsF|rat|t�satd��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*r4r?r"r"r#�_validate_value_types�s
z%RawConfigParser._validate_value_typescCs|jS)N)r�)r r"r"r#r��szRawConfigParser.converters)r}rh)rr�)=r%r&r'r(Z
_SECT_TMPLr�r�rr�rdrer�r�r.r�r�r�r��
_default_dictrr�rrDr�r�r�r�r�r�r�r�r�rUr�r�r�r�r�rlr�rWr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rAr�r"r")r�r#r.sv		!!$		%


zcsFeZdZdZe�Zd�fdd�Z�fdd�Z�S)rz(ConfigParser implementing interpolation.Ncs0|jd|d|�t�j|||�dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.r4r?N)r�r�r�)r r*r4r?)r�r"r#r��szConfigParser.setcs$|jd|�t�j|�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#r��szConfigParser.add_section)r%r&r'r(rr�r�r�r"r")r�r#r�s	cs(eZdZdZ�fdd�Z�S)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.r:r;)r�rr<r=r>)r r+r�)r�r"r#r�szSafeConfigParser.__init__)r%r&r'r(rr"r")r�r#r�sc	@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zddddddddd�ZdS)rz+A proxy for a single section from a parser.cCse||_||_xL|jD]A}d|}tj|jdt||��}t|||�qWdS)z@Creates a view on a section of the specified `name` in `parser`.rU�_implN)�_parser�_namer�rnrorU�getattr�setattr)r rCr�r�r��getterr"r"r#r�s		
!zSectionProxy.__init__cCsdj|j�S)Nz
<Section: {}>)r.r)r r"r"r#r$�szSectionProxy.__repr__cCs:|jj|j|�s$t|��|jj|j|�S)N)rr�rrZrU)r r�r"r"r#r��szSectionProxy.__getitem__cCs2|jjd|d|�|jj|j||�S)Nr4r?)rr�r�r)r r�r?r"r"r#r��szSectionProxy.__setitem__cCs@|jj|j|�o-|jj|j|�s<t|��dS)N)rr�rr�rZ)r r�r"r"r#r��szSectionProxy.__delitem__cCs|jj|j|�S)N)rr�r)r r�r"r"r#r��szSectionProxy.__contains__cCst|j��S)N)rj�_options)r r"r"r#r��szSectionProxy.__len__cCs|j�j�S)N)rr�)r r"r"r#r��szSectionProxy.__iter__cCs9|j|jjkr(|jj|j�S|jj�SdS)N)rrr�r�rD)r r"r"r#r�szSectionProxy._optionscCs|jS)N)r)r r"r"r#rC�szSectionProxy.parsercCs|jS)N)r)r r"r"r#r��szSectionProxy.nameNrRFrqr�c
Ks7|s|jj}||j|d|d|d||�S)z�Get an option value.

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

        rRrqrS)rrUr)r r4rSrRrqr�r�r"r"r#rU�s
zSectionProxy.get)r%r&r'r(rr$r�r�r�r�r�r�rrArCr�rUr"r"r"r#r�s	c@smeZdZdZejd�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>.+)$cCs{||_i|_xbt|j�D]Q}|jj|�}|s"tt|j|��r]q"d|j|jd�<q"WdS)Nr�)r�_data�dir�	GETTERCRErV�callablerrX)r rCrrar"r"r#r
s		 zConverterMapping.__init__cCs|j|S)N)r)r r�r"r"r#r�szConverterMapping.__getitem__c
Cs�yd|}Wn0tk
r@tdj|t|����YnX|dkrYtd��||j|<tj|jjd|�}||_	t
|j||�x?|jj�D].}tj|jd|�}t
|||�q�WdS)NrUzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a namer�r�)
r�r7r.�typerrnrorr�Z	converterr�valuesrU)r r�r?�k�func�proxyrr"r"r#r�s
	
	zConverterMapping.__setitem__cCs�yd|pd}Wntk
r4t|��YnX|j|=xRtj|jf|jj��D]/}yt||�Wqatk
r�waYqaXqaWdS)NrU)	r�rZrr�r�rr�delattrr�)r r�rZinstr"r"r#r�)s

(
zConverterMapping.__delitem__cCs
t|j�S)N)�iterr)r r"r"r#r�7szConverterMapping.__iter__cCs
t|j�S)N)rjr)r r"r"r#r�:szConverterMapping.__len__N)
r%r&r'r(rdrerrr�r�r�r�r�r"r"r"r#rs	)(r(�collections.abcr�collectionsrr�rr�rnr�r�rdr�r<�__all__rrrrrrrrr	rrr
r
r�objectr�rrrrrrrrrr"r"r"r#�<module>�sR					
	

+	HJ&��q
F

Hacked By AnonymousFox1.0, Coded By AnonymousFox