ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/__pycache__/configparser.cpython-34.pyc

�
e f"��@s\dZddlmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddddd	d
ddd
dddddgZdZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd	�d	e�ZGdd�de�ZGdd�de�ZGdd
�d
e�ZGd d�de�ZGd!d
�d
e�Ze�ZGd"d#�d#�ZGd$d%�d%e�Z Gd&d'�d'e�Z!Gd(d)�d)e�Z"Gd*d�de�Z#Gd+d�de#�Z$Gd,d�de$�Z%Gd-d.�d.e�Z&dS)/a�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):
        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.

    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�InterpolationSyntaxError�ParsingError�MissingSectionHeaderError�ConfigParser�SafeConfigParser�RawConfigParser�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/python34/lib64/python3.4/configparser.pyr�s	zError.__init__cCs|jS)N)r)rrrr�__repr__�szError.__repr__N)�__name__�
__module__�__qualname__�__doc__rr�__str__rrrrr�src@s"eZdZdZdd�ZdS)rz2Raised when no section matches a requested option.cCs0tj|d|f�||_|f|_dS)NzNo section: %r)rr�section�args)rr#rrrr�s	zNoSectionError.__init__N)rrr r!rrrrrr�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	rxdt|�g}|dk	rU|jdj|��n|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$)rr#r+r,rrrrrr�s

				zDuplicateSectionError.__init__)rrr r!rrrrrr�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	ra|jdj|��n|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(r)rrr*r#�optionr+r,r$)rr#r-r+r,rrrrrr�s 	

					zDuplicateOptionError.__init__)rrr r!rrrrrr�sc@s"eZdZdZdd�ZdS)rz!A requested option was not found.cCs?tj|d||f�||_||_||f|_dS)NzNo option %r in section: %r)rrr-r#r$)rr-r#rrrr�s
		zNoOptionError.__init__N)rrr r!rrrrrr�sc@s"eZdZdZdd�ZdS)r	z0Base class for interpolation-related exceptions.cCs8tj||�||_||_|||f|_dS)N)rrr-r#r$)rr-r#rrrrr�s		zInterpolationError.__init__N)rrr r!rrrrrr	�sc@s"eZdZdZdd�ZdS)�InterpolationMissingOptionErrorzAA 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$)rr-r#�rawvalr/rrrrr�s
	z(InterpolationMissingOptionError.__init__N)rrr r!rrrrrr.�sr.c@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)rrr r!rrrrr�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$)rr-r#r0rrrrrs
		z InterpolationDepthError.__init__N)rrr r!rrrrrr
sc@s[eZdZdZdddd�Zedd��Zejdd��Zdd	�ZdS)
rz>Raised when a configuration file does not follow legal syntax.NcCs}|r|rtd��n,|r8|r8td��n|rG|}ntj|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)�
ValueErrorrrr+�errorsr$)rr+�filenamerrrrs			zParsingError.__init__cCstjdtdd�|jS)zDeprecated, use `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.�
stacklevel�)�warnings�warn�DeprecationWarningr+)rrrrr3#s
zParsingError.filenamecCs#tjdtdd�||_dS)zDeprecated, user `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r4r5N)r6r7r8r+)r�valuerrrr3-s
cCs3|jj||f�|jd||f7_dS)Nz
	[line %2d]: %s)r2r&r)rr,�linerrrr&7szParsingError.append)	rrr r!r�propertyr3�setterr&rrrrrs


c@s"eZdZdZdd�ZdS)r
z@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)rrr+r,r:r$)rr3r,r:rrrr?s			z"MissingSectionHeaderError.__init__N)rrr r!rrrrrr
<sc@sFeZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
InterpolationzBDummy interpolation that passes the value through with no changes.cCs|S)Nr)r�parserr#r-r9�defaultsrrr�
before_getSszInterpolation.before_getcCs|S)Nr)rr>r#r-r9rrr�
before_setVszInterpolation.before_setcCs|S)Nr)rr>r#r-r9rrr�before_readYszInterpolation.before_readcCs|S)Nr)rr>r#r-r9rrr�before_write\szInterpolation.before_writeN)rrr r!r@rArBrCrrrrr=Ps
r=c@sIeZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
�BasicInterpolationa!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_somer*)rr>r#r-r9r?�Lrrrr@qszBasicInterpolation.before_getcCsY|jdd�}|jjd|�}d|krUtd||jd�f��n|S)Nz%%r�%z1invalid interpolation syntax in %r at position %d)�replace�_KEYCRE�subr1�find)rr>r#r-r9�	tmp_valuerrrrAvszBasicInterpolation.before_setcCs�|j||ddd|�}|tkr?t|||��nx�|r�|jd�}	|	dkrt|j|�dS|	dkr�|j|d|	��||	d�}n|dd�}
|
dkr�|jd�|dd�}qB|
dkr�|jj|�}|dkr)t||d	|��n|j|j	d��}||j
�d�}y||}
Wn'tk
r�t||||��YnXd|
kr�|j
||||
|||d�q�|j|
�qBt||d
|f��qBWdS)N�rawT�fallbackrHrrEr5�(z'bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)�getrr
rLr&rJ�matchr�optionxform�group�end�KeyErrorr.rF)rr>r-�accum�restr#�map�depthr0�p�c�m�var�vrrrrF~sF	

	
z$BasicInterpolation._interpolate_someN)
rrr r!�re�compilerJr@rArFrrrrrD`s

rDc@sIeZdZdZejd�Zdd�Zdd�Zdd�Z	d	S)
�ExtendedInterpolationzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'. Enables interpolation between sections.z
\$\{([^}]+)\}cCs2g}|j||||||d�dj|�S)NrEr)rFr*)rr>r#r-r9r?rGrrrr@�sz ExtendedInterpolation.before_getcCsY|jdd�}|jjd|�}d|krUtd||jd�f��n|S)Nz$$r�$z1invalid interpolation syntax in %r at position %d)rIrJrKr1rL)rr>r#r-r9rMrrrrA�sz ExtendedInterpolation.before_setcCs�|j||ddd|�}|tkr?t|||��nxj|r�|jd�}	|	dkrt|j|�dS|	dkr�|j|d|	��||	d�}n|dd�}
|
dkr�|jd�|dd�}qB|
dkr�|jj|�}|dkr)t||d	|��n|jd�j	d
�}||j
�d�}|}
|}y�t|�dkr�|j|d�}||}nct|�dkr�|d}
|j|d�}|j|
|dd�}nt||d|f��Wn9t
ttfk
r7t|||d
j|���YnXd|kr|j|||||
t|j|
dd��|d�q�|j|�qBt||d|f��qBWdS)
NrNTrOrcrrEr5�{z'bad interpolation variable reference %r�:zMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rQrr
rLr&rJrRrrT�splitrU�lenrSrVrrr.r*rF�dict�items)rr>r-rWrXr#rYrZr0r[r\r]�pathZsectZoptr_rrrrF�s^	

	

 z'ExtendedInterpolation._interpolate_someN)
rrr r!r`rarJr@rArFrrrrrb�s
rbc@sOeZdZdZejd�Zdd�Zdd�Ze	dd��Z
d	S)
�LegacyInterpolationz{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��WYdd}	~	Xq�XqPqW|r�d|kr�t	|||��n|S)NrEz%(r>r)
r�	functools�partial�_interpolation_replacerJrKrVr.r$r
)
rr>r#r-r9�varsr0rZrI�errrr@�s"	
	/zLegacyInterpolation.before_getcCs|S)Nr)rr>r#r-r9rrrrAszLegacyInterpolation.before_setcCs:|jd�}|dkr%|j�Sd|j|�SdS)NrEz%%(%s)s)rTrS)rRr>�srrrrns
z*LegacyInterpolation._interpolation_replaceN)rrr r!r`rarJr@rA�staticmethodrnrrrrrk�s
rkcsBeZdZdZdZdZdZe�Ze	j
ee	j�Ze	j
ej
dd�e	j�Ze	j
ej
dd�e	j�Ze	j
d�Zidd	6dd
6dd6dd6d
d6d
d6d
d6d
d6Zded
ddqddrdddddddededd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zdd*d+�Zdd,d-�Zd.d/d0�Zd1d2d3�Zdd4d5�Zd6d
d7dd8ed9d:�Z d;d<�Z!d6d
d7dd8ed=d>�Z"d6d
d7dd8ed?d@�Z#d6d
d7dd8edAdB�Z$ed
d�fdCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(ddKdL�Z)ddMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdldmdldndldodp�Z9�S)srz,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\ST�1�yes�trueZonF�0�noZfalseZoffN�
delimiters�=re�comment_prefixes�#�;�inline_comment_prefixes�strict�empty_lines_in_values�default_section�
interpolationcCs�||_|j�|_|j�|_|j�|_t||	�|j|	<|r�x3|j�D]"\}}||j|j|�<q_Wnt|�|_|dkr�|r�|j	n|j
|_nsdjdd�|D��}
|r
t
j|jjd|
�t
j�|_n't
j|jjd|
�t
j�|_t|p@f�|_t|pUf�|_||_||_||_|	|_|
|_|jtkr�|j|_n|jdkr�t�|_ndS)Nrzre�|css|]}tj|�VqdS)N)r`�escape)�.0�drrr�	<genexpr>Tsz+RawConfigParser.__init__.<locals>.<genexpr>rs)rzre)�_dict�	_sections�	_defaults�_proxies�SectionProxyrirS�tuple�_delimiters�	OPTCRE_NV�OPTCRE�_optcrer*r`ra�_OPT_NV_TMPLr'�VERBOSE�	_OPT_TMPL�_comment_prefixes�_inline_comment_prefixes�_strict�_allow_no_value�_empty_lines_in_valuesr��_interpolation�_UNSET�_DEFAULT_INTERPOLATIONr=)rr?Z	dict_typeZallow_no_valueryr{r~rr�r�r��keyr9r�rrrrAs8						zRawConfigParser.__init__cCs|jS)N)r�)rrrrr?gszRawConfigParser.defaultscCst|jj��S)z3Return a list of section names, excluding [DEFAULT])�listr��keys)rrrr�sectionsjszRawConfigParser.sectionscCsm||jkr"td|��n||jkr@t|��n|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�r1r�rr�r�r�)rr#rrr�add_sectionoszRawConfigParser.add_sectioncCs
||jkS)z~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        )r�)rr#rrr�has_section}szRawConfigParser.has_sectioncCsXy|j|j�}Wntk
r7t|��YnX|j|j�t|j��S)z9Return a list of option names for the given section name.)r��copyrVr�updater�r�r�)rr#Zoptsrrr�options�s
zRawConfigParser.optionscCs�t|t�r|g}ng}xb|D]Z}y/t|d|��}|j||�WdQXWntk
rtw(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_okr3�fprrr�read�s

zRawConfigParser.readcCsK|dkr7y
|j}Wq7tk
r3d}Yq7Xn|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�fr+rrr�	read_file�s

zRawConfigParser.read_filez<string>cCs#tj|�}|j||�dS)z'Read configuration from a given string.N)�io�StringIOr�)r�stringr+Zsfilerrr�read_string�szRawConfigParser.read_stringz<dict>cCs-t�}x|j�D]\}}t|�}y|j|�Wn3ttfk
rt|jrp||krp�nYnX|j|�x�|j�D]�\}}|jt|��}|dk	r�t|�}n|jr�||f|kr�t	|||��n|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)
�setrir�r�rr1r��addrSr)rZ
dictionaryr+�elements_addedr#r�r�r9rrr�	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.r4r5r+N)r6r7r8r�)rr�r3rrr�readfp�s
zRawConfigParser.readfprNrorOcCs�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�rSrVrr�r@)rr#r-rNrorOr�r9rrrrQ�s"
	
	zRawConfigParser.getcKs||j|||��S)N)rQ)rr#Zconvr-�kwargsrrr�_getszRawConfigParser._getcCsXy#|j|t|d|d|�SWn.ttfk
rS|tkrK�n|SYnXdS)NrNro)r��intrrr�)rr#r-rNrorOrrr�getint	s#zRawConfigParser.getintcCsXy#|j|t|d|d|�SWn.ttfk
rS|tkrK�n|SYnXdS)NrNro)r��floatrrr�)rr#r-rNrorOrrr�getfloats#zRawConfigParser.getfloatcCs[y&|j||j|d|d|�SWn.ttfk
rV|tkrN�n|SYnXdS)NrNro)r��_convert_to_booleanrrr�)rr#r-rNrorOrrr�
getbooleanszRawConfigParser.getbooleanc
s��tkrt�j�S�jj��y�j�j��Wn0tk
rr��jkrnt	���nYnX|r�x0|j�D]\}}|��j
|�<q�Wn���fdd��|r��fdd��n�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�r@)r-)r�r#rrr�<lambda>?sz'RawConfigParser.items.<locals>.<lambda>cs�|S)Nr)r-)r�rrr�Bscs"g|]}|�|�f�qSrr)r�r-)�value_getterrr�
<listcomp>Cs	z)RawConfigParser.items.<locals>.<listcomp>)r��superrir�r�r�r�rVr�rrSr�)rr#rNror�r9)�	__class__)r�r#rr�rri(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�rV)rr�r9rrr�popitemEs

zRawConfigParser.popitemcCs
|j�S)N)�lower)rZ	optionstrrrrrSRszRawConfigParser.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�rSr�r�)rr#r-rrr�
has_optionUs
zRawConfigParser.has_optioncCs�|r$|jj||||�}n|s:||jkrF|j}n2y|j|}Wntk
rwt|��YnX|||j|�<dS)zSet an option.N)r�rAr�r�r�rVrrS)rr#r-r9�sectdictrrrr�cs
zRawConfigParser.setcCs�|rdj|jd�}n
|jd}|jrZ|j||j|jj�|�nx4|jD])}|j|||j|j�|�qdWdS)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�rir�)rr�Zspace_around_delimitersr�r#rrr�writeqs
	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�rCr�r�rI)rr�Zsection_nameZ
section_itemsZ	delimiterr�r9rrrr��s	zRawConfigParser._write_sectioncCs�|s||jkr"|j}n2y|j|}Wntk
rSt|��YnX|j|�}||k}|r||=n|S)zRemove an option.)r�r�r�rVrrS)rr#r-r��existedrrr�
remove_option�s

zRawConfigParser.remove_optioncCs0||jk}|r,|j|=|j|=n|S)zRemove a file section.)r�r�)rr#r�rrr�remove_section�s


zRawConfigParser.remove_sectioncCs9||jkr.|j|�r.t|��n|j|S)N)r�r�rVr�)rr�rrr�__getitem__�szRawConfigParser.__getitem__cCsZ||jkr|jj�n#||jkrB|j|j�n|ji||6�dS)N)r�r��clearr�r�)rr�r9rrr�__setitem__�s
zRawConfigParser.__setitem__cCsM||jkrtd��n|j|�s<t|��n|j|�dS)Nz"Cannot remove the default section.)r�r1r�rVr�)rr�rrr�__delitem__�s
zRawConfigParser.__delitem__cCs||jkp|j|�S)N)r�r�)rr�rrr�__contains__�szRawConfigParser.__contains__cCst|j�dS)NrE)rgr�)rrrr�__len__�szRawConfigParser.__len__cCstj|jf|jj��S)N)�	itertools�chainr�r�r�)rrrr�__iter__�szRawConfigParser.__iter__cCsdt�}d}d}d}d}d}d}	xt|dd�D]\}}
tj}dd�|jD�}x�|tjkr|ri}
x�|j�D]|\}}|
j||d�}|dkr�q�n||
|<|dks|dkr�|
|dj�r�t||�}q�q�W|
}qnWx0|j	D]%}|
j
�j|�r*d}Pq*q*W|tjkrkd}n|
d|�j
�}|s�|jr�|dkr�|dk	r�|r�||dk	r�||j
d�q�q@tj}q@n|jj|
�}|r|j�nd}|dk	r@|r@||kr@||j
|�q@|}|jj|�}|r#|jd�}||jkr�|jr�||kr�t|||��n|j|}|j|�nW||jkr�|j}n<|j�}||j|<t||�|j|<|j|�d}q@|dkrDt|||
��q@|jj|�}|r+|jd	d
d�\}}}|s�|j|	|||
�}	n|j |j!��}|jr�||f|kr�t"||||��n|j||f�|dk	r|j
�}|g||<qCd||<q@|j|	|||
�}	q@W|	rV|	�n|j#�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�startrEcSsi|]}d|�qS)rE���r)r�r[rrr�
<dictcomp>�s	z)RawConfigParser._read.<locals>.<dictcomp>r�headerr-�vir9r�)$r��	enumerate�sys�maxsizer�rirL�isspace�minr��strip�
startswithr�r&�NONSPACECRE�searchr��SECTCRErRrTr�r�rr�r�r�r�r�r�r
r��
_handle_errorrS�rstripr�_join_multiline_values)rr��fpnamer�ZcursectZsectnameZoptnamer,Zindent_levelrpr:Z
comment_startZinline_prefixesZ
next_prefixes�prefix�indexr9Zfirst_nonspaceZcur_indent_levelZmor�Zoptvalrrrr��s�		
,
				


			
	zRawConfigParser._readcCs�|j|jf}tj|f|jj��}xw|D]o\}}x`|j�D]R\}}t|t�r�dj|�j	�}n|j
j||||�||<qPWq7WdS)Nr�)r�r�r�r�r�rir�r�r*r�r�rB)rr?Zall_sectionsr#r�r��valrrrr�Bsz&RawConfigParser._join_multiline_valuescCs/|st|�}n|j|t|��|S)N)rr&r%)r�excr�r,r:rrrr�NszRawConfigParser._handle_errorc
Cs�i}y|j|}Wn0tk
rI||jkrEt|��nYnXi}|r�xK|j�D]:\}}|dk	r�t|�}n|||j|�<qcWnt|||j�S)z�Create a sequence of lookups with 'vars' taking priority over
        the 'section' which takes priority over the DEFAULTSECT.

        N)	r�rVr�rrir�rS�	_ChainMapr�)rr#roZsectiondictZvardictr�r9rrrr�Ts
zRawConfigParser._unify_valuescCs9|j�|jkr(td|��n|j|j�S)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)r��BOOLEAN_STATESr1)rr9rrrr�hsz#RawConfigParser._convert_to_booleanr#rr-r9cCsqt|t�std��nt|t�s<td��n|jsL|rmt|t�smtd��qmndS)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�)rr#r-r9rrr�_validate_value_typesos
z%RawConfigParser._validate_value_types)rzre)r|r}):rrr r!Z
_SECT_TMPLr�r�r=r�r`rar�r�r'r�r�r�r��
_default_dictrr�rr?r�r�r�r�r�r�r�r�r�rQr�r�r�r�rir�rSr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr)r�rrsp		!!!		%		


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.r-r9N)r�r�r�)rr#r-r9)r�rrr��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�)rr#)r�rrr��szConfigParser.add_section)rrr r!rDr�r�r�rr)r�rr�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.r4r5)r�rr6r7r8)rr$r�)r�rrr�szSafeConfigParser.__init__)rrr r!rrr)r�rr�sc@seZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zddddddd�Z
ddddddd�Zddddddd�Zddddddd�Zed d!��Zed"d#��ZdS)$r�z+A proxy for a single section from a parser.cCs||_||_dS)z@Creates a view on a section of the specified `name` in `parser`.N)�_parser�_name)rr>r�rrrr�s	zSectionProxy.__init__cCsdj|j�S)Nz
<Section: {}>)r'r�)rrrrr�szSectionProxy.__repr__cCs=|jj|j|�s't|��n|jj|j|�S)N)r�r�r�rVrQ)rr�rrrr��szSectionProxy.__getitem__cCs2|jjd|d|�|jj|j||�S)Nr-r9)r�r�r�r�)rr�r9rrrr��szSectionProxy.__setitem__cCsC|jj|j|�o-|jj|j|�s?t|��ndS)N)r�r�r�r�rV)rr�rrrr��szSectionProxy.__delitem__cCs|jj|j|�S)N)r�r�r�)rr�rrrr��szSectionProxy.__contains__cCst|j��S)N)rg�_options)rrrrr��szSectionProxy.__len__cCs|j�j�S)N)r�r�)rrrrr��szSectionProxy.__iter__cCs9|j|jjkr(|jj|j�S|jj�SdS)N)r�r�r�r�r?)rrrrr��szSectionProxy._optionsNrNFroc	Cs(|jj|j|d|d|d|�S)NrNrorO)r�rQr�)rr-rOrNrorrrrQ�s!zSectionProxy.getc	Cs(|jj|j|d|d|d|�S)NrNrorO)r�r�r�)rr-rOrNrorrrr��s!zSectionProxy.getintc	Cs(|jj|j|d|d|d|�S)NrNrorO)r�r�r�)rr-rOrNrorrrr��s!zSectionProxy.getfloatc	Cs(|jj|j|d|d|d|�S)NrNrorO)r�r�r�)rr-rOrNrorrrr��s!zSectionProxy.getbooleancCs|jS)N)r�)rrrrr>�szSectionProxy.parsercCs|jS)N)r�)rrrrr��szSectionProxy.name)rrr r!rrr�r�r�r�r�r�r�rQr�r�r�r;r>r�rrrrr��s r�)'r!Zcollections.abcr�collectionsrr�rr�rlr�r�r`r�r6�__all__rrrrrrrrr	r.rr
rr
�objectr�r=rDrbrkrrrr�rrrr�<module>wsL			
	

+	HJ&��o

Zerion Mini Shell 1.0