b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/ConfigParser.pyc
Size23.31 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:24
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@s�dZyddklZWnej
o
eZnXddkZdddddd d
d d d
dddg
ZdZdZ de
fd��YZ de fd��YZ de fd��YZ
de fd��YZde fd��YZdefd��YZd efd��YZdefd��YZd
e fd��YZd efd��YZdfd��YZd efd ��YZd
efd!��YZdS("s Configuration file parser.

A setup 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.

The option values can contain format strings which refer to other values in
the same section, or values in a 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.

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)
create the parser and specify a dictionary of intrinsic defaults. The
keys must be strings, the values must be appropriate for %()s string
interpolation. Note that `__name__' is always an intrinsic default;
its value is the section's name.

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)
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.

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

get(section, option, raw=False, vars=None)
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.

getint(section, options)
like get(), but convert value to an integer

getfloat(section, options)
like get(), but convert value to a float

getboolean(section, options)
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, raw=False, vars=None)
return a list of tuples with (name, value) for each option
in the section.

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)
write the configuration state in .ini format
iÿÿÿÿ(t OrderedDictNtNoSectionErrortDuplicateSectionErrort
NoOptionErrortInterpolationErrortInterpolationDepthErrortInterpolationSyntaxErrort ParsingErrortMissingSectionHeaderErrort ConfigParsertSafeConfigParsertRawConfigParsert DEFAULTSECTtMAX_INTERPOLATION_DEPTHtDEFAULTi
tErrorcBsJeZdZd�Zd�Zeee�Zdd�Zd�ZeZ RS(s'Base class for ConfigParser exceptions.cCs|iS(sSGetter for 'message'; needed only to override deprecation in
BaseException.(t_Error__message(tself((s$/usr/lib64/python2.6/ConfigParser.pyt _get_messagerscCs
||_dS(sSSetter for 'message'; needed only to override deprecation in
BaseException.N(R(Rtvalue((s$/usr/lib64/python2.6/ConfigParser.pyt _set_messagewstcCs||_ti||�dS(N(tmessaget Exceptiont__init__(Rtmsg((s$/usr/lib64/python2.6/ConfigParser.pyR�s cCs|iS(N(R(R((s$/usr/lib64/python2.6/ConfigParser.pyt__repr__�s(
t__name__t
__module__t__doc__RRtpropertyRRRt__str__(((s$/usr/lib64/python2.6/ConfigParser.pyRos    cBseZdZd�ZRS(s2Raised when no section matches a requested option.cCs$ti|d|f�||_dS(NsNo section: %r(RRtsection(RR ((s$/usr/lib64/python2.6/ConfigParser.pyR�s(RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyR�scBseZdZd�ZRS(s*Raised when a section is multiply-created.cCs!ti|d|�||_dS(NsSection %r already exists(RRR (RR ((s$/usr/lib64/python2.6/ConfigParser.pyR�s(RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyR�scBseZdZd�ZRS(s!A requested option was not found.cCs0ti|d||f�||_||_dS(NsNo option %r in section: %r(RRtoptionR (RR!R ((s$/usr/lib64/python2.6/ConfigParser.pyR�s  (RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyR�scBseZdZd�ZRS(s0Base class for interpolation-related exceptions.cCs&ti||�||_||_dS(N(RRR!R (RR!R R((s$/usr/lib64/python2.6/ConfigParser.pyR¤s (RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyR¡stInterpolationMissingOptionErrorcBseZdZd�ZRS(sAA string substitution required a setting which was not available.cCs9d||||f}ti||||�||_dS(NsNBad value substitution:
section: [%s]
option : %s
key : %s
rawval : %s
(RRt reference(RR!R trawvalR#R((s$/usr/lib64/python2.6/ConfigParser.pyR¬s(RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyR"©scBseZdZRS(sjRaised when the source text into which substitutions are made
does not conform to the required syntax.(RRR(((s$/usr/lib64/python2.6/ConfigParser.pyR¶scBseZdZd�ZRS(s0Raised when substitutions are nested too deeply.cCs-d|||f}ti||||�dS(NsSValue interpolation too deeply recursive:
section: [%s]
option : %s
rawval : %s
(RR(RR!R R$R((s$/usr/lib64/python2.6/ConfigParser.pyR½s(RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyRºscBs eZdZd�Zd�ZRS(s>Raised when a configuration file does not follow legal syntax.cCs*ti|d|�||_g|_dS(Ns File contains parsing errors: %s(RRtfilenameterrors(RR%((s$/usr/lib64/python2.6/ConfigParser.pyRÈs cCs3|ii||f�|id||f7_dS(Ns
[line %2d]: %s(R&tappendR(Rtlinenotline((s$/usr/lib64/python2.6/ConfigParser.pyR'Ís(RRRRR'(((s$/usr/lib64/python2.6/ConfigParser.pyRÅs cBseZdZd�ZRS(s@Raised when a key-value pair is found before any section header.cCs<ti|d|||f�||_||_||_dS(Ns7File contains no section headers.
file: %s, line: %d
%r(RRR%R(R)(RR%R(R)((s$/usr/lib64/python2.6/ConfigParser.pyRÔs  (RRRR(((s$/usr/lib64/python2.6/ConfigParser.pyRÑscBs?eZd eed�Zd�Zd�Zd�Zd�Z d�Z
d�Z d d�Z d�Z
d �Zd
�Zd �Zd �Zhed
6ed6ed6ed6ed6ed6ed6ed6Zd�Zd�Zd�Zd d�Zd�Zd�Zd�Zeid�Zeid�Zeid�Zd�Z RS(!cCs�||_|i�|_|i�|_|o|i|_n
|i|_|o7x4|i�D]"\}}||i|i|�<q^WndS(N(t_dictt _sectionst _defaultst OPTCRE_NVt_optcretOPTCREtitemst optionxform(Rtdefaultst dict_typetallow_no_valuetkeyR((s$/usr/lib64/python2.6/ConfigParser.pyRßs  
cCs|iS(N(R,(R((s$/usr/lib64/python2.6/ConfigParser.pyR2ìscCs
|ii�S(s3Return a list of section names, excluding [DEFAULT](R+tkeys(R((s$/usr/lib64/python2.6/ConfigParser.pytsectionsïscCs[|i�djotd|�n||ijot|��n|i�|i|<dS(séCreate a new section in the configuration.

Raise DuplicateSectionError if a section by the specified name
already exists. Raise ValueError if name is DEFAULT or any of it's
case-insensitive variants.
tdefaultsInvalid section name: %sN(tlowert
ValueErrorR+RR*(RR ((s$/usr/lib64/python2.6/ConfigParser.pyt add_sectionôs
cCs
||ijS(s~Indicate whether the named section is present in the configuration.

The DEFAULT section is not acknowledged.
(R+(RR ((s$/usr/lib64/python2.6/ConfigParser.pyt has_sectionscCsky|i|i�}Wntj
ot|��nX|i|i�d|jo |d=n|i�S(s9Return a list of option names for the given section name.R(R+tcopytKeyErrorRtupdateR,R6(RR topts((s$/usr/lib64/python2.6/ConfigParser.pytoptions s
 cCs�t|t�o
|g}ng}x^|D]V}yt|�}Wntj
o
q*nX|i||�|i�|i|�q*W|S(sÔ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.
(t
isinstancet
basestringtopentIOErrort_readtcloseR'(Rt filenamestread_okR%tfp((s$/usr/lib64/python2.6/ConfigParser.pytreads 

cCsN|djo-y
|i}Wq:tj
o
d}q:Xn|i||�dS(sLike read() but the argument must be a file-like object.

The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
used.

s<???>N(tNonetnametAttributeErrorRF(RRJR%((s$/usr/lib64/python2.6/ConfigParser.pytreadfp-s

cCs¾|i|�}||ijoL|tjot|��n||ijo |i|St||��nP||i|jo|i||S||ijo |i|St||��dS(N(R1R+R RR,R(RR R!topt((s$/usr/lib64/python2.6/ConfigParser.pytget=s
  cCs�y|i|}Wn<tj
o0|tjot|��n|i�}nX|ii�}|i|�d|jo |d=n|i�S(NR( R+R>R RR*R,R=R?R0(RR td2td((s$/usr/lib64/python2.6/ConfigParser.pyR0Ms


 cCs||i||��S(N(RQ(RR tconvR!((s$/usr/lib64/python2.6/ConfigParser.pyt_getZscCs|i|t|�S(N(RUtint(RR R!((s$/usr/lib64/python2.6/ConfigParser.pytgetint]scCs|i|t|�S(N(RUtfloat(RR R!((s$/usr/lib64/python2.6/ConfigParser.pytgetfloat`st1tyesttruetont0tnotfalsetoffcCsJ|i||�}|i�|ijotd|�n|i|i�S(NsNot a boolean: %s(RQR9t_boolean_statesR:(RR R!tv((s$/usr/lib64/python2.6/ConfigParser.pyt
getbooleanfscCs
|i�S(N(R9(Rt optionstr((s$/usr/lib64/python2.6/ConfigParser.pyR1lscCs{| p
|tjo|i|�}||ijS||ijotS|i|�}||i|jp
||ijSdS(s=Check for the existence of a given option in a given section.N(R R1R,R+tFalse(RR R!((s$/usr/lib64/python2.6/ConfigParser.pyt
has_optionoscCsl| p
|tjo
|i}n4y|i|}Wntj
ot|��nX|||i|�<dS(sSet an option.N(R R,R+R>RR1(RR R!Rtsectdict((s$/usr/lib64/python2.6/ConfigParser.pytset{s
c Cs?|iok|idt�xF|ii�D]5\}}|id|t|�idd�f�q+W|id�nxÃ|iD]¸}|id|�x�|i|i�D]|\}}|djoqªn|dj p|i|i jo+di
|t|�idd�f�}n|id|�qªW|id�qWdS( s?Write an .ini-format representation of the configuration state.s[%s]
s%s = %s
s
s
Rs = s%s
N( R,twriteR R0tstrtreplaceR+RLR.R/tjoin(RRJR5RR ((s$/usr/lib64/python2.6/ConfigParser.pyRj�s"
 -
 
 +cCs�| p
|tjo
|i}n4y|i|}Wntj
ot|��nX|i|�}||j}|o ||=n|S(sRemove an option.(R R,R+R>RR1(RR R!Rhtexisted((s$/usr/lib64/python2.6/ConfigParser.pyt
remove_option�s
  cCs(||ij}|o|i|=n|S(sRemove a file section.(R+(RR Rn((s$/usr/lib64/python2.6/ConfigParser.pytremove_section¦ss\[(?P<header>[^]]+)\]s9(?P<option>[^:=\s][^:=]*)\s*(?P<vi>[:=])\s*(?P<value>.*)$s>(?P<option>[^:=\s][^:=]*)\s*(?:(?P<vi>[:=])\s*(?P<value>.*))?$cCsçd}d}d}d}x·to¯|i�}|pPn|d}|i�djp|ddjoqn|idd�di�djo|ddjoqn|di�oG|dj o:|o3|i�}|od|||f||<qÍq|ii|�} | ow| i d�}
|
|i
jo|i
|
}n>|
t jo
|i }n$|i
�}|
|d <||i
|
<d}q|djot|||��q|ii|�} | oÒ| i d
d d �\}} } | dj om| djoPd| joC| id�}
|
djo#| |
di�o| |
} qVn| i�} n| djo
d} n|i|i��}| ||<q|pt|�}n|i|t|��qW|o
|�ndS(s®Parse a sectioned setup file.

The sections in setup file contains a title line at the top,
indicated by a name in square brackets (`[]'), plus key/value
options lines, indicated by `name: value' format lines.
Continuations are represented by an embedded newline then
leading whitespace. Blank lines, lines beginning with a '#',
and just about everything else are ignored.
iiRs#;tremtrRs%s
%stheaderRR!tviRt=t:t;iÿÿÿÿs""N(RuRv(RLtTruetreadlinetstriptsplitR9tisspacetSECTCREtmatchtgroupR+R R,R*RR.tfindR1trstripRR'trepr(RRJtfpnametcursecttoptnameR(teR)RtmotsectnameRttoptvaltpos((s$/usr/lib64/python2.6/ConfigParser.pyRFÇsb
 
$4%  

 




"

N(!RRRLt
_default_dictRfRR2R7R;R<RARKRORQR0RURWRYRxRbRdR1RgRiRjRoRptretcompileR}R/R-RF(((s$/usr/lib64/python2.6/ConfigParser.pyR Þs<       
      
   cBsGeZedd�Zedd�Zd�Zeid�Z d�Z
RS(c
Cs
|ii�}y|i|i|�Wn0tj
o$|tjot|��qZnX|o4x1|i�D]\}}|||i|�<qnWn|i|�}y||}Wn"tj
ot ||��nX|p
|djo|S|i ||||�SdS(sÃ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 `defaults' in that order.

All % interpolations are expanded in the return values, unless the
optional argument `raw' is true. Values for interpolation keys are
looked up in the same manner as the option.

The section DEFAULT is special.
N( R,R=R?R+R>R RR0R1RRLt _interpolate(RR R!trawtvarsRSR5R((s$/usr/lib64/python2.6/ConfigParser.pyRQs$ 

c Cs/|ii�}y|i|i|�Wn0tj
o$|tjot|��qZnX|o4x1|i�D]\}}|||i|�<qnWn|i �}d|jo|i
d�n|o*g}|D]} || || fqÑ~Sg}
|D])} |
| |i || || |�fqû~
SdS(sØReturn a list of tuples with (name, value) for each option
in the 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.
RN( R,R=R?R+R>R RR0R1R6tremoveR�( RR R�R�RSR5RRAt_[1]R!t_[2]((s$/usr/lib64/python2.6/ConfigParser.pyR0<s$ 

 
#cCsÆ|}t}x�|o�|d8}|okd|jo^|ii|i|�}y||}Wq�tj
o%}t||||id��q�XqPqW|o#d|jot|||��n|S(Nis%(i(R
t_KEYCREtsubt_interpolation_replaceR>R"targsR(RR R!R$R�RtdepthR�((s$/usr/lib64/python2.6/ConfigParser.pyR�\s 
"s%\(([^)]*)\)s|.cCs<|id�}|djo |i�Sd|i|�SdS(Nis%%(%s)s(RRLR1(RR~ts((s$/usr/lib64/python2.6/ConfigParser.pyR�qs
 N( RRRfRLRQR0R�R�R�R�R�(((s$/usr/lib64/python2.6/ConfigParser.pyR s
! cBs5eZd�Zeid�Zd�Zdd�ZRS(cCs/g}|i|||||d�di|�S(NiR(t_interpolate_someRm(RR R!R$R�tL((s$/usr/lib64/python2.6/ConfigParser.pyR�{ss
%\(([^)]+)\)sc CsÇ|tjot|||��nx�|o�|id�}|djo|i|�dS|djo|i|| �||}n|dd!}|djo|id�|d}q&|djoÜ|ii|�} | djot||d|��n|i| i d��}
|| i
�}y||
} Wn(t j
ot ||||
��nXd| jo$|i
||| |||d�q¾|i| �q&t||d|f��q&WdS(Nt%iiit(s'bad interpolation variable reference %rs/'%%' must be followed by '%%' or '(', found: %r(R
RR�R't
_interpvar_reR~RLRR1RtendR>R"R�( RR!taccumtrestR tmapR�tptctmtvarRc((s$/usr/lib64/python2.6/ConfigParser.pyR��sD








 
cCsµ|i|ijp|o$t|t�ptd��q>n|idd�}|iid|�}|id�}|djot d||f��nt
i ||||�dS(sASet an option. Extend ConfigParser.set: check for string values.soption values must be stringss%%RR�iÿÿÿÿs1invalid interpolation syntax in %r at position %dN( R.R/RBRCt TypeErrorRlR�R�R�R:R Ri(RR R!Rt tmp_valuet
percent_index((s$/usr/lib64/python2.6/ConfigParser.pyRi©s
N( RRR�R�R�R�R�RLRi(((s$/usr/lib64/python2.6/ConfigParser.pyR
ys  &(Rt collectionsRR�t ImportErrortdictR�t__all__R R
RRRRRRR"RRRRR R R
(((s$/usr/lib64/python2.6/ConfigParser.pyt<module>Xs6      
  
ÿ<`