Uname: Linux server.digisquadtech.com 4.18.0-553.100.1.el8_10.x86_64 #1 SMP Mon Feb 2 04:13:33 EST 2026 x86_64
User: 1091 (madhavfluid)
Group: 1090 (madhavfluid)
Disabled functions: NONE
Safe mode: On[ PHPinfo ]
//usr/lib64/python3.6///__pycache__      ( Reset | Go to )
File Name: configparser.cpython-36.opt-1.pyc
3

 \X@sdZddlmZddlmZmZddlZddl    Z    ddl
Z
ddl Z ddl Z ddl Z ddlZddddd    d
d d d ddddddddddddgZdZdZGdddeZGdddeZGdddeZGd ddeZGd!ddeZGd"d    d    eZGd#d d eZGd$d d eZGd%d
d
eZGd&d d eZGd'ddeZeZGd(ddZ Gd)dde Z!Gd*dde Z"Gd+dde Z#Gd,ddeZ$Gd-dde$Z%Gd.dde%Z&Gd/ddeZ'Gd0ddeZ(dS)1aConfiguration 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 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' 
argumentwhich 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(sectionoptionsraw=Falsevars=Nonefallback=_UNSET)
        
Like get(), but convert value to an integer.

    
getfloat(sectionoptionsraw=Falsevars=Nonefallback=_UNSET)
        
Like get(), but convert value to a float.

    
getboolean(sectionoptionsraw=Falsevars=Nonefallback=_UNSET)
        
Like get(), but convert value to a boolean (currently case
        
insensitively defined as 0falsenooff for False, and 1true,
        
yeson for True).  Returns False or True.

    
items(section=_UNSETraw=Falsevars=None)
        If 
section is given, return list of tuples with (namevalue) for
        
each option in the sectionOtherwise, return list of tuples with
        
(section_namesection_proxy) for each sectionincluding DEFAULTSECT.

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

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

    
set(sectionoptionvalue)
        
Set the given option.

    
write(fpspace_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) OrderedDictChainMapNNoSectionErrorDuplicateOptionErrorDuplicateSectionError NoOptionErrorInterpolationErrorInterpolationDepthErrorInterpolationMissingOptionErrorInterpolationSyntaxError ParsingErrorMissingSectionHeaderError ConfigParserSafeConfigParserRawConfigParser InterpolationBasicInterpolationExtendedInterpolationLegacyInterpolation SectionProxyConverterMapping DEFAULTSECTMAX_INTERPOLATION_DEPTHZDEFAULT
c@s&eZdZdZdddZddZeZdS)    Errorz'Base class for ConfigParser exceptions.cCs||_tj||dS)N)message    Exception__init__)selfmsgr"$/usr/lib64/python3.6/configparser.pyrszError.__init__cCs|jS)N)r)r r"r"r#__repr__szError.__repr__N)r)__name__
__module__ __qualname____doc__rr$__str__r"r"r"r#rs
rc@seZdZdZddZdS)rz2Raised when no section matches a requested option.cCs$tj|d|f||_|f|_dS)NzNo section: %r)rrsectionargs)r r*r"r"r#rszNoSectionError.__init__N)r%r&r'r(rr"r"r"r#rsc@seZdZdZdddZdS)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.
    NcCst|dg}|dk    rRdt|g}|dk    r8|jdj||jd|j||}n |jddtj|dj|||_||_    ||_
|||f|_ dS)Nz already existszWhile reading from z [line {0:2d}]z
: section rzSection r) reprappendformatextendinsertrrjoinr*sourcelinenor+)r r*r2r3r!rr"r"r#rs  

 zDuplicateSectionError.__init__)NN)r%r&r'r(rr"r"r"r#rsc@seZdZdZdddZdS)rzRaised 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.
    NcCst|dt|dg}|dk    rZdt|g}|dk    r@|jdj||jd|j||}n |jddtj|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#rs  

 zDuplicateOptionError.__init__)NN)r%r&r'r(rr"r"r"r#rsc@seZdZdZddZdS)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#rs
 zNoOptionError.__init__N)r%r&r'r(rr"r"r"r#rsc@seZdZdZddZdS)r    z0Base class for interpolation-related exceptions.cCs(tj||||_||_|||f|_dS)N)rrr4r*r+)r r4r*r!r"r"r#rs zInterpolationError.__init__N)r%r&r'r(rr"r"r"r#r    sc@seZdZdZddZdS)r zAA string substitution required a setting which was not available.cCs8dj||||}tj||||||_||||f|_dS)NzBad 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#r sc@seZdZdZdS)r zRaised 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 sc@seZdZdZddZdS)r
z0Raised when substitutions are nested too deeply.cCs0dj||t|}tj|||||||f|_dS)NzRecursion 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
sc@s<eZdZdZd
ddZeddZejddZdd    ZdS) r z>Raised when a configuration file does not follow legal syntax.NcCsX|r|rtdn| r(| r(tdn|r0|}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)
ValueErrorrrr2errorsr+)r r2filenamer"r"r#r+s
 
zParsingError.__init__cCstjdtdd|jS)zDeprecated, use `source'
.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.)
stacklevel
)warningswarnDeprecationWarningr2)r"r"r#r9:s
zParsingError.filenamecCstjdtdd||_dS)zDeprecateduser `source'.zSThe 'filename' attribute will be removed in future versions.  Use 'source' instead.r:)r;N)r<r=r>r2)r valuer"r"r#r9Ds
cCs*|jj||f|jd||f7_dS)Nz
    [line %2d]: %s)r8r-r)r r3liner"r"r#r-NszParsingError.append)NN)    r%r&r'r(rpropertyr9setterr-r"r"r"r#r (s



c@seZdZdZddZdS)rz@Raised when a key-value pair is found before any section header.cCs8tj|d|||f||_||_||_|||f|_dS)Nz7File contains no section headers.
file: %r, line: %d
%r)rrr2r3r@r+)r r9r3r@r"r"r#rVsz"MissingSectionHeaderError.__init__N)r%r&r'r(rr"r"r"r#rSsc@s0eZdZdZddZddZddZdd    Zd
S) rzBDummy interpolation that passes the value through with no changes.cCs|S)Nr")r parserr*r4r?defaultsr"r"r#
before_getjszInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#
before_setmszInterpolation.before_setcCs|S)Nr")r rCr*r4r?r"r"r# before_readpszInterpolation.before_readcCs|S)Nr")r rCr*r4r?r"r"r# before_writesszInterpolation.before_writeN)r%r&r'r(rErFrGrHr"r"r"r#rgs
c@s2eZdZdZejdZddZddZddZ    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 %\(([^)]+)\)scCs$g}|j||||||ddj|S)Nr)_interpolate_somer1)r rCr*r4r?rDLr"r"r#rEszBasicInterpolation.before_getcCs<|jdd}|jjd|}d|kr8td||jdf|S)Nz%%r%z1invalid interpolation syntax in %r at position %d)replace_KEYCREsubr7find)r rCr*r4r?    tmp_valuer"r"r#rFs  zBasicInterpolation.before_setcCsp|j||d|d}|tkr&t|||xB|rj|jd}    |    dkrP|j|dS|    dkrv|j|d|    ||    d}|dd}
|
dkr|jd|dd}q*|
dkrV|jj|} | dkrt||d||j| j    d} || j
d}y || } Wn&t k
r"t |||| dYnXd| krJ|j |||| |||dn
|j| q*t||d    |fq*WdS)
NT)rawfallbackrLrrIr:(z'
bad interpolation variable reference %rz/'%%' must be followed by '%%' or '('found: %r)getrr
rPr-rNmatchr optionxformgroupendKeyErrorr rJ)rCr4accumrestr*mapdepthr6pcmvarvr"r"r#rJsF 


  

 
 
  
z$BasicInterpolation._interpolate_someN)
r%r&r'r(recompilerNrErFrJr"r"r"r#rws
 
c@s2eZdZdZejdZddZddZddZ    d    S)
rzyAdvanced variant of interpolation, supports the syntax used by
    `zc.buildout'
Enables interpolation between sections.z \$\{([^}]+)\}cCs$g}|j||||||ddj|S)NrIr)rJr1)rCr*r4r?rDrKr"r"r#rEsz ExtendedInterpolation.before_getcCs<|jdd}|jjd|}d|kr8td||jdf|S)Nz$$r$z1invalid interpolation syntax in %r at position %d)rMrNrOr7rP)r rCr*r4r?rQr"r"r#rFs  z ExtendedInterpolation.before_setcCs|j||d|d}|tkr&t|||x|r|jd}    |    dkrP|j|dS|    dkrv|j|d|    ||    d}|dd}
|
dkr|jd|dd}q*|
dkr|jj|} | dkrt||d|| jdj    d    } || j
d}|} |}yrt | dk|j | d}||}nHt | dkrV| d} |j | d}|j| |dd
}nt||d |fWn2t ttfk
rt|||d    j| dYnXd|kr|j||||| t|j| dd
|dn
|j|q*t||d |fq*WdS) NT)rRrSrfrrIr:{z'bad interpolation variable reference %r:)rRzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rUrr
rPr-rNrVr rXsplitrYlenrWrZrrr r1rJdictitems)r rCr4r[r\r*r]r^r6r_r`rapathZsectoptrcr"r"r#rJs^ 


  

 


  z'
ExtendedInterpolation._interpolate_someN)
r%r&r'r(rdrerNrErFrJr"r"r"r#rs

c@s6eZdZdZejdZddZddZe    ddZ
d    S)
rz{Deprecated interpolation used in old versions of ConfigParser.
    Use BasicInterpolation or ExtendedInterpolation instead.z%\(([^)]*)\)s|.c
Cs|}t}x|r|d8}|rd|krtj|j|d}|jj||}y ||}Wqtk
r}    zt||||    jddWYdd}    ~    XqXq
Pq
W|rd|krt    ||||S)NrIz%()rCr)
r    functoolspartial_interpolation_replacerNrOrZr r+r
)
r rCr*r4r?varsr6r^rMer"r"r#rEs"  (  zLegacyInterpolation.before_getcCs|S)Nr")r rCr*r4r?r"r"r#rF#szLegacyInterpolation.before_setcCs,|jd}|dkr|jSd|j|SdS)NrIz%%(%s)s)rXrW)rVrCsr"r"r#rq&s
z*LegacyInterpolation._interpolation_replaceN) r%r&r'
r(rdrerNrErF staticmethodrqr"r"r"r#r    s

c
s.eZdZdZdZdZdZeZe    j
ee    j Z e    j
ej dde    j Ze    j
ej dde    j Ze    j
dZddddd    d    d    d    d
Zd ed    fddded ddeeedddZddZddZddZddZddZdfddZdgdd Zdhd"
d#Zdid%d&Zdjd'd(Zd    d ed)d*d+Z d,d-Z!d    d ed)d.d/Z"d    d ed)d0d1Z#d    d ed)d2d3Z$d    d ed)d4d5Z%ed    d ffd6d7    Z&d8d9Z'd:d;Z(d<d=Z)dkd>d?Z*dld@dAZ+dBdCZ,dDdEZ-dFdGZ.dHdIZ/dJdKZ0dLdMZ1dNdOZ2dPdQZ3dRdSZ4dTdUZ5dVdWZ6dXdYZ7dZd[Z8d\d]Z9d^d^d^d_d`daZ:e;dbdcZ<Z=S)mrz,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=|:)delimz\STF)1yestrueZon0noZfalseZoffN=rh#;)
delimiterscomment_prefixesinline_comment_prefixesstrictempty_lines_in_valuesdefault_section interpolation
convertersc
CsX||_|j|_|j|_t||_|j|_t||    |j|    <|rhx$|jD]\} } | |j|j| <qLWt    ||_
|dkr|r|j n|j |_ nNdjdd|D}|rtj|jj|dtj|_ ntj|jj|dtj|_ t    |pf|_t    |pf|_||_||_||_|    |_|
|
_|jtkr*|j|_|jdkr>t|_| tk    rT|jj| dS)Nr|rh|css|]}tj|VqdS)N)rdescape).0dr"r"r#    <genexpr>lsz+RawConfigParser.__init__.<locals>.<genexpr>)rv)r|rh) _dict    _sections    _defaultsr _converters_proxiesrrlrWtuple _delimiters    OPTCRE_NVOPTCRE_optcrer1rdre _OPT_NV_TMPLr.VERBOSE    _OPT_TMPL_comment_prefixes_inline_comment_prefixes_strict_allow_no_value_empty_lines_in_valuesr_interpolation_UNSET_DEFAULT_INTERPOLATIONrupdate)r rDZ    dict_typeZallow_no_valuerrrrrrrrkeyr?rr"r"r#rXs>




 
  

zRawConfigParser.__init__cCs|jS)N)r)r"r"r#rDszRawConfigParser.defaultscCst|jjS)z3Return a list of section names, excluding [DEFAULT])listrkeys)r r"r"r#sectionsszRawConfigParser.sectionscCsJ||jkrtd|||jkr(t||j|j|<t|||j|<dS)zCreate 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)rr7rrrrr)r*r"r"r# add_sections 
 

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_sectionszRawConfigParser.has_sectionc CsJy|j|j}Wntk
r0t|dYnX|j|jt|jS)z9Return a list of option names for the given section name.N)rcopyrZrrrrr)r*Zoptsr"r"r#optionss  zRawConfigParser.optionscCst|ttjfr|g}g}xl|D]d}y(t||d}|j||WdQRXWntk
rbw YnXt|tjrztj|}|j|q W|S)aRead and parse a filename or an iterable of filenames.

        
Files that cannot be opened are silently ignoredthis is
        designed so that you can specify an iterable of potential
        configuration file locations 
(e.gcurrent directoryuser'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.
        )encodingN)    
isinstancestrosPathLikeopen_readOSErrorfspathr-)r     filenamesrZread_okr9fpr"r"r#reads 
 
zRawConfigParser.readc Cs<|dkr,y
|j}Wntk
r*d}YnX|j||dS)aPLike read() but the argument must be a file-like object.

        The `f' 
argument must be iterablereturning 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<???>)nameAttributeErrorr)r fr2r"r"r#    read_files 

zRawConfigParser.read_file<string>cCstj|}|j||dS)z'Read configuration from a given string.N)ioStringIOr)r stringr2Zsfiler"r"r# read_strings
zRawConfigParser.read_string<dict>cCst}x|jD]\}}t|}y|j|Wn(ttfk
rV|jrR||krRYnX|j|xl|jD]
`\}}|jt|}|dk    rt|}|jr||f|krt    ||||j||f|j|||qlWqWdS)aRead configuration from a dictionary.

        
Keys are section namesvalues 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 namesoption names and keys.

        
Optional second argument is the `source' specifying the name of the
        dictionary being read.
        N)
setrlrrrr7raddrWr)r Z
dictionaryr2elements_addedr*rrr?r"r"r#    read_dicts" 
 zRawConfigParser.read_dictcCs"tjdtdd|j||ddS)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 rr9r"r"r#readfps
zRawConfigParser.readfp)rRrrrScCsy|j||}Wn$tk
r4|tkr,n|SYnX|j|}y ||}Wn,tk
rx|tkrpt||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 providedit 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_valuesrrrWrZrrrE)r*r4rRrrrSrr?r"r"r#rUs"

  
 
zRawConfigParser.getcKs||j||f|S)N)rU)r*convr4kwargsr"r"r#_get"szRawConfigParser._getc KsDy|j|||f||d|Sttfk
r>|tkr:|SXdS)N)rRrr)rrrr)r*r4rrRrrrSrr"r"r#    _get_conv%szRawConfigParser._get_convcKs|j||tf|||d|S)N)rRrrrS)rint)r r*r4rRrrrSrr"r"r#getint0szRawConfigParser.getintcKs|j||tf|||d|S)N)rRrrrS)rfloat)r r*r4rRrrrSrr"r"r#getfloat5szRawConfigParser.getfloatcKs |j|||jf|||d|S)N)rRrrrS)r_convert_to_boolean)r r*r4rRrrrSrr"r"r#
getboolean:szRawConfigParser.getbooleanc stkrtjSjjyjjWn&tk
rV
jkrRt    YnX|rx"|jD]\}}|j
|<qfWfdd|rfddfddj DS)aReturn 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.
        csjj||S)N)rrE)r4)rr*r r"
r#<lambda>Vsz'RawConfigParser.items.<locals>.<lambda>cs|S)Nr")r4)rr"r#rYscsg|]}||fqSr"r")rr4) value_getterr"r#
<listcomp>Zsz)RawConfigParser.items.<locals>.<listcomp>) rsuperrlrrrrrZrrrWr)r*rRrrrr?)    __class__)rr*rr#rl?s 


 
zRawConfigParser.itemscCs.x$|jD]}||}||=||fSWtdS)zRemove a section from the parser and return it as
        
(section_namesection_proxytuple. If no section is presentraise
        KeyError
.

        
The section DEFAULT is never returned because it cannot be removed.
        
N)rrZ)rr?r"r"r#popitem\s


zRawConfigParser.popitemcCs|jS)N)lower)Z    optionstrr"r"r#rWiszRawConfigParser.optionxformcCsX| s||jkr$|j|}||jkS||jkr2dS|j|}||j|kpR||jkSdS)zCheck 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)rrWrr)r r*r4r"r"r#
has_optionls



zRawConfigParser.has_optionc Csn|r|jj||||}| s&||jkr.|j}n.y|j|}Wntk
rZt|dYnX|||j|<dS)zSet an option.N)rrFrrrrZrrW)r r*r4r?sectdictr"r"r#rzs zRawConfigParser.setcCsl|rdj|jd}n
|jd}|jr>|j||j|jj|x(|jD]}|j|||j|j|qFWdS)zWrite 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.rr_write_sectionrrlr)rZspace_around_delimitersrr*r"r"r#writes

 
zRawConfigParser.writecCs~|jdj|x^|D]V\}}|jj||||}|dk    s@|j rV|t|jdd}nd}|jdj||qW|jddS)z-Write a single section to the specified `fp'.z[{}]
N
z
    rz{}{}
)rr.rrHrrrM)r rZ section_nameZ section_itemsZ    delimiterrr?r"r"r#rs zRawConfigParser._write_sectionc Csf| s||jkr|j}n.y|j|}Wntk
rDt|dYnX|j|}||k}|rb||=|S)zRemove an option.N)rrrrZrrW)r r*r4rexistedr"r"r# remove_options
zRawConfigParser.remove_optioncCs"||jk}|r|j|=|j|=|S)zRemove a file section.)rr)r r*rr"r"r#remove_sections

zRawConfigParser.remove_sectioncCs(||jkr|j| rt||j|S)N)rrrZr)r rr"r"r# __getitem__szRawConfigParser.__getitem__cCs@||jkr|jjn||jkr.|j|j|j||idS)N)rrclearrr)r rr?r"r"r# __setitem__s

 
zRawConfigParser.__setitem__cCs2||jkrtd|j|s
$t||j|dS)Nz"Cannot remove the default section.)rr7rrZr)r rr"r"r# __delitem__s


zRawConfigParser.__delitem__cCs||jkp|j|S)N)rr)r rr"r"r# __contains__szRawConfigParser.__contains__cCst|jdS)NrI)rjr)r r"r"r#__len__szRawConfigParser.__len__cCstj|jf|jjS)N)    itertoolschainrrr)r r"r"r#__iter__szRawConfigParser.__iter__cCs2t}d}d}d}d}d}d}    xt|ddD]\}}
tj} dd|jD} x|| tjkr| ri} x
`| jD]T\}}|
j||d}|d krql|| |<|dks|dkrl|
|
djrlt| |} qlW| } qPWx"|j    D]}|
j
j |rd} PqW| tjkrd} |
d| j
}|s^|j rV| dkr\|dk    r\|r\||dk    r\||j dq.tj}q.|jj|
}|rx|jnd}|dk    r|r||kr||j |q.|}|jj|}|rL|jd}||jkr|jr||krt||||j|}|j|n@||jkr|j}n,|j}||j|<t|||j|<|j|d}q.|dkrdt|||
q.|jj|}|r|jd    d
d \}}}|s|j|    |||
}    |j |j!}|jr||f|krt"
|||||j||f|dk    r|j
}|g||<nd||<q.|j|    |||
}    q.W|j#|    r.|    dS) a Parse a sectioned configuration file.

        
Each section in a configuration file contains a headerindicated 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 modeblank
        lines may be treated 
as parts of multiline values or ignored.

        
Configuration files may include commentsprefixed 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.
        NrrI)startcSsi|]
}d|qS)rIr")rr_r"r"r#
<dictcomp>sz)RawConfigParser._read.<locals>.<dictcomp>rheaderr4vir?r)$r    enumeratesysmaxsizerrlrPisspaceminrstrip
startswithrr- NONSPACECREsearchrSECTCRErVrXrrrrrrrrrrr _handle_errorrWrstripr_join_multiline_values)r rfpnamerZcursectZsectnameZoptnamer3Z indent_levelrsr@Z comment_startZinline_prefixesZ next_prefixesprefixindexr?Zfirst_nonspaceZcur_indent_levelZmorZoptvalr"r"r#rs   

 
 
 
  


 
 
zRawConfigParser._readcCsz|j|jf}tj|f|jj}xT|D]L\}}xB|jD]6\}}t|trXdj|j    }|j
j ||||||<q8Wq&WdS)Nr) rrrrrrlrrr1rrrG)r rDZ all_sectionsr*rrvalr"r"r#rYs  
z&RawConfigParser._join_multiline_valuescCs |s t|}|j|t||S)N)r r-r,)r excrr3r@r"r"r#reszRawConfigParser._handle_errorc Csi}y|j|}Wn&tk
r8||jkr4t|YnXi}|rvx2|jD]&\}}|dk    rdt|}|||j|<qLWt|||jS)zCreate a sequence of lookups with '
vars' taking priority over
        the '
section' which takes priority over the DEFAULTSECT.

        N)    rrZrrrlrrW    _ChainMapr)r r*rrZ sectiondictZvardictrr?r"r"r#rks
zRawConfigParser._unify_valuescCs(|j|jkrtd||j|jS)zJReturn a boolean value translating from other types if necessary.
        zNot a boolean: %s)rBOOLEAN_STATESr7)r r?r"r"r#rs z#RawConfigParser._convert_to_booleanr)r*r4r?cCsFt|tstdt|ts$td|j s0|rBt|tsBtddS)aRaises 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)rr    TypeErrorr)r r*r4r?r"r"r#_validate_value_typess

 
z%RawConfigParser._validate_value_typescCs|jS)N)r)r r"r"r#rszRawConfigParser.converters)r|rh)r}r~)N)N)r)r)N)N)T)>r%r&r'
r(Z
_SECT_TMPLr
rrrrdrerrr.rrrr _default_dictrrrrDrrrrrrrrrrUrrrrrrlrrWrrrrrrrrrrrrrrrrrrrAr __classcell__r"r")rr#r/sv    
$    




    %
 

  
z cs4eZdZdZeZdfdd    ZfddZZS)rz(ConfigParser implementing interpolation.Ncs"|j||dtj|||dS)zmSet an option.  Extends RawConfigParser.set by validating type and
        interpolation syntax on the value.)r4r?N)rrr)r r*r4r?)rr"
r#rszConfigParser.setcs|j|dtj|dS)zCreate a new section in the configuration.  Extends
        
RawConfigParser.add_section by validating if the section name is
        a string
.)r*N)rrr)r*)rr"r#rs zConfigParser.add_section)N)    r%r&r'r(rrrrrr"r")rr#rscs eZdZdZfddZZS)rz8ConfigParser alias for backwards compatibility purposes.cs"tj||tjdtdddS)NzThe SafeConfigParser class has been renamed to ConfigParser in Python 3.2This alias will be removed in future versions. Use ConfigParser directly instead.r:)r;)rrr<r=r>)r+r)rr"r#rszSafeConfigParser.__init__)r%r&r'r(rrr"r")rr#rsc@seZdZdZddZddZddZdd    Zd
d Zd d Z    ddZ
ddZ ddZ e ddZe ddZdddddddZdS)rz+A proxy for a single section from a parser.cCsJ||_||_x8|jD].}d|}tj|jt||d}t|||qWdS)z@Creates a view on a section of the specified `name` in `parser`.rU)_implN)_parser_namerrorprUgetattrsetattr)r rCrrrgetterr"
r"r#rs  zSectionProxy.__init__cCs dj|jS)Nz <Section: {}>)r.r)r r"r"r#r$szSectionProxy.__repr__cCs(|jj|j|st||jj|j|S)N)rrrrZrU)r rr"r"r#rszSectionProxy.__getitem__cCs"|jj||d|jj|j||S)N)r4r?)rrrr)rr?r"r"r#rszSectionProxy.__setitem__cCs,|jj|j|o|jj|j|s(t|dS)N)rrrrrZ)r rr"r"r#rszSectionProxy.__delitem__cCs|jj|j|S)N)rrr)r rr"r"r#rszSectionProxy.__contains__cCs t|jS)N)rj_options)r r"r"r#rszSectionProxy.__len__cCs |jjS)N)r r)r r"r"r#rszSectionProxy.__iter__cCs*|j|jjkr|jj|jS|jjSdS)N)rrrrrD)r r"r"r#r szSectionProxy._optionscCs|jS)N)r)r r"r"r#rCszSectionProxy.parsercCs|jS)N)r)r r"r"r#rszSectionProxy.nameNF)rRrrrcKs(|s |jj}||j|f|||d|S)zGet an option value.

        
Unless `fallbackis provided, `Nonewill be returned if the option
        is not found
.

        )
rRrrrS)rrUr)r4rSrRrrrrr"r"r#rUs
zSectionProxy.get)N)r%r&r'r(rr$rrrrrrr rArCrrUr"r"r"r#rs      c@sJeZdZdZejdZddZddZddZ    d    d
Z
d d Z d dZ 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>.+)$cCsZ||_i|_xHt|jD]:}|jj|}| stt|j| rBqd|j|jd<qWdS)Nr)r_datadir    GETTERCRErVcallablerrX)r rCr
rar"r"r#rs zConverterMapping.__init__cCs
|j|S)N)r )r rr"r"r#rszConverterMapping.__getitem__c Csy d|}Wn(tk
r4tdj|t|YnX|dkrFtd||j|<tj|jj|d}||_    t
|j||x.|jj D] }tj|j |d}t
|||qWdS)NrUzIncompatible key: {} (type: {})z)Incompatible key: cannot use "" as a name)r)r) rr7r.typer rorprrZ    converterr    valuesrU)r rr?kfuncproxyr
r"r"r#rs 
zConverterMapping.__setitem__cCsyd|p
d}Wntk
r,t|YnX|j|=xDtj|jf|jjD]*}yt||WqNtk
rvwNYqNXqNWdS)NrU)    rrZr rrrrdelattrr)r rrZinstr"r"r#r,szConverterMapping.__delitem__cCs
t|jS)N)iterr )r r"r"r#r:szConverterMapping.__iter__cCs
t|jS)N)rjr )r r"r"r#r=szConverterMapping.__len__N) r%r&r'
r(rdrerrrrrrrr"r"r"r#rs
    ))r(collections.abcr collectionsrrrrrorrrrdrr<__all__rrrrrrrrr    r r r
r robjectrrrrrrrrrrr"
r"r"r#<module>sX       
  +
HJ&u F

All system for education purposes only. For more tools: Telegram @jackleet

Mr.X Private Shell

Logo
-
New File | New Folder
Command
SQL