ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/lib64/python2.7/ConfigParser.pyo

�
zfc
@s�dZyddlmZWnek
r3eZnXddlZdddddd	d
ddd
dddg
ZdZdZ	de
fd��YZdefd��YZdefd��YZ
defd��YZdefd��YZdefd��YZd	efd��YZdefd��YZd
efd��YZdefd��YZdfd��YZddlZd ejfd!��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����(tOrderedDictNtNoSectionErrortDuplicateSectionErrort
NoOptionErrortInterpolationErrortInterpolationDepthErrortInterpolationSyntaxErrortParsingErrortMissingSectionHeaderErrortConfigParsertSafeConfigParsertRawConfigParsertDEFAULTSECTtMAX_INTERPOLATION_DEPTHtDEFAULTi
tErrorcBsJeZdZd�Zd�Zeee�Zdd�Zd�ZeZ	RS(s'Base class for ConfigParser exceptions.cCs|jS(sSGetter for 'message'; needed only to override deprecation in
        BaseException.(t_Error__message(tself((s$/usr/lib64/python2.7/ConfigParser.pyt_get_messagesscCs
||_dS(sSSetter for 'message'; needed only to override deprecation in
        BaseException.N(R(Rtvalue((s$/usr/lib64/python2.7/ConfigParser.pyt_set_messagexstcCs||_tj||�dS(N(tmessaget	Exceptiont__init__(Rtmsg((s$/usr/lib64/python2.7/ConfigParser.pyR�s	cCs|jS(N(R(R((s$/usr/lib64/python2.7/ConfigParser.pyt__repr__�s(
t__name__t
__module__t__doc__RRtpropertyRRRt__str__(((s$/usr/lib64/python2.7/ConfigParser.pyRps			cBseZdZd�ZRS(s2Raised when no section matches a requested option.cCs0tj|d|f�||_|f|_dS(NsNo section: %r(RRtsectiontargs(RR ((s$/usr/lib64/python2.7/ConfigParser.pyR�s	(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�scBseZdZd�ZRS(s*Raised when a section is multiply-created.cCs-tj|d|�||_|f|_dS(NsSection %r already exists(RRR R!(RR ((s$/usr/lib64/python2.7/ConfigParser.pyR�s	(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�scBseZdZd�ZRS(s!A requested option was not found.cCs?tj|d||f�||_||_||f|_dS(NsNo option %r in section: %r(RRtoptionR R!(RR"R ((s$/usr/lib64/python2.7/ConfigParser.pyR�s
		(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�scBseZdZd�ZRS(s0Base class for interpolation-related exceptions.cCs8tj||�||_||_|||f|_dS(N(RRR"R R!(RR"R R((s$/usr/lib64/python2.7/ConfigParser.pyR�s		(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�stInterpolationMissingOptionErrorcBseZdZd�ZRS(sAA string substitution required a setting which was not available.cCsNd||||f}tj||||�||_||||f|_dS(NsNBad value substitution:
	section: [%s]
	option : %s
	key    : %s
	rawval : %s
(RRt	referenceR!(RR"R trawvalR$R((s$/usr/lib64/python2.7/ConfigParser.pyR�s
	(RRRR(((s$/usr/lib64/python2.7/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.7/ConfigParser.pyR�scBseZdZd�ZRS(s0Raised when substitutions are nested too deeply.cCs?d|||f}tj||||�|||f|_dS(NsSValue interpolation too deeply recursive:
	section: [%s]
	option : %s
	rawval : %s
(RRR!(RR"R R%R((s$/usr/lib64/python2.7/ConfigParser.pyR�s(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�scBs eZdZd�Zd�ZRS(s>Raised when a configuration file does not follow legal syntax.cCs6tj|d|�||_g|_|f|_dS(Ns File contains parsing errors: %s(RRtfilenameterrorsR!(RR&((s$/usr/lib64/python2.7/ConfigParser.pyR�s		cCs3|jj||f�|jd||f7_dS(Ns
	[line %2d]: %s(R'tappendR(Rtlinenotline((s$/usr/lib64/python2.7/ConfigParser.pyR(�s(RRRRR((((s$/usr/lib64/python2.7/ConfigParser.pyR�s	cBseZdZd�ZRS(s@Raised when a key-value pair is found before any section header.cCsNtj|d|||f�||_||_||_|||f|_dS(Ns7File contains no section headers.
file: %s, line: %d
%r(RRR&R)R*R!(RR&R)R*((s$/usr/lib64/python2.7/ConfigParser.pyR�s			(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyR�scBs?eZd eed�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd d�Zd�Z
d	�Zd
�Zd�Zd�Zied
6ed6ed6ed6ed6ed6ed6ed6Zd�Zd�Zd�Zd d�Zd�Zd�Zd�Zejd�Zejd�Zejd�Zd�Z RS(!cCs�||_|j�|_|j�|_|r<|j|_n|j|_|r�x3|j�D]"\}}||j|j|�<q[WndS(N(t_dictt	_sectionst	_defaultst	OPTCRE_NVt_optcretOPTCREtitemstoptionxform(Rtdefaultst	dict_typetallow_no_valuetkeyR((s$/usr/lib64/python2.7/ConfigParser.pyR�s	cCs|jS(N(R-(R((s$/usr/lib64/python2.7/ConfigParser.pyR3�scCs
|jj�S(s3Return a list of section names, excluding [DEFAULT](R,tkeys(R((s$/usr/lib64/python2.7/ConfigParser.pytsections�scCsW|j�dkr"td|�n||jkr@t|��n|j�|j|<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.7/ConfigParser.pytadd_section�s
cCs
||jkS(s~Indicate whether the named section is present in the configuration.

        The DEFAULT section is not acknowledged.
        (R,(RR ((s$/usr/lib64/python2.7/ConfigParser.pythas_sectionscCsgy|j|j�}Wntk
r6t|��nX|j|j�d|kr]|d=n|j�S(s9Return a list of option names for the given section name.R(R,tcopytKeyErrorRtupdateR-R7(RR topts((s$/usr/lib64/python2.7/ConfigParser.pytoptionss

cCs�t|t�r|g}ng}x\|D]T}yt|�}Wntk
rTq(nX|j||�|j�|j|�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.7/ConfigParser.pytreads


cCsJ|dkr6y
|j}Wq6tk
r2d}q6Xn|j||�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(tNonetnametAttributeErrorRG(RRKR&((s$/usr/lib64/python2.7/ConfigParser.pytreadfp6s	


cCs�|j|�}||jkre|tkr9t|��n||jkrS|j|St||��nK||j|kr�|j||S||jkr�|j|St||��dS(N(R2R,RRR-R(RR R"topt((s$/usr/lib64/python2.7/ConfigParser.pytgetFscCs�y|j|}Wn8tk
rK|tkr<t|��n|j�}nX|jj�}|j|�d|kr~|d=n|j�S(NR(	R,R?RRR+R-R>R@R1(RR td2td((s$/usr/lib64/python2.7/ConfigParser.pyR1Vs


cCs||j||��S(N(RR(RR tconvR"((s$/usr/lib64/python2.7/ConfigParser.pyt_getcscCs|j|t|�S(N(RVtint(RR R"((s$/usr/lib64/python2.7/ConfigParser.pytgetintfscCs|j|t|�S(N(RVtfloat(RR R"((s$/usr/lib64/python2.7/ConfigParser.pytgetfloatist1tyesttruetont0tnotfalsetoffcCsH|j||�}|j�|jkr7td|�n|j|j�S(NsNot a boolean: %s(RRR:t_boolean_statesR;(RR R"tv((s$/usr/lib64/python2.7/ConfigParser.pyt
getbooleanoscCs
|j�S(N(R:(Rt	optionstr((s$/usr/lib64/python2.7/ConfigParser.pyR2uscCsu|s|tkr/|j|�}||jkS||jkrBtS|j|�}||j|kpp||jkSdS(s=Check for the existence of a given option in a given section.N(RR2R-R,tFalse(RR R"((s$/usr/lib64/python2.7/ConfigParser.pyt
has_optionxs
cCsg|s|tkr|j}n1y|j|}Wntk
rOt|��nX|||j|�<dS(sSet an option.N(RR-R,R?RR2(RR R"Rtsectdict((s$/usr/lib64/python2.7/ConfigParser.pytset�s
cCs8|jrs|jdt�xF|jj�D]5\}}|jd|t|�jdd�f�q*W|jd�nx�|jD]�}|jd|�x�|j|j�D]w\}}|dkr�q�n|dk	s�|j|j	krdj
|t|�jdd�f�}n|jd|�q�W|jd�q}WdS(	s?Write an .ini-format representation of the configuration state.s[%s]
s%s = %s
s
s
	Rs = s%s
N(R-twriteRR1tstrtreplaceR,RMR/R0tjoin(RRKR6RR ((s$/usr/lib64/python2.7/ConfigParser.pyRk�s	- *cCs|s|tkr|j}n1y|j|}Wntk
rOt|��nX|j|�}||k}|r{||=n|S(sRemove an option.(RR-R,R?RR2(RR R"Ritexisted((s$/usr/lib64/python2.7/ConfigParser.pyt
remove_option�s

cCs&||jk}|r"|j|=n|S(sRemove a file section.(R,(RR Ro((s$/usr/lib64/python2.7/ConfigParser.pytremove_section�s
s\[(?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�tr�|j�}|s7Pn|d}|j�dks|ddkriqn|jdd�dj�dkr�|ddkr�qn|dj�r�|dk	r�|r�|j�}|r�||j|�q�q|jj	|�}	|	rv|	j
d�}
|
|jkr2|j|
}n;|
tkrJ|j
}n#|j�}|
|d<||j|
<d}q|dkr�t|||��q|jj	|�}	|	r�|	j
d	d
d�\}}}|j|j��}|dk	rv|dkrEd|krE|jd�}
|
dkrE||
dj�rE||
 }qEn|j�}|dkrfd}n|g||<q�|||<q|s�t|�}n|j|t|��qW|r�|�n|j
g}|j|jj��xP|D]H}x?|j�D]1\}}t|t�r�dj|�||<q�q�Wq�WdS(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#;tremtrRtheaderRR"tviRt=t:t;i����s""s
N(RvRw(RMtTruetreadlinetstriptsplitR:tisspaceR(tSECTCREtmatchtgroupR,RR-R+RR/R2trstriptfindRtreprtextendtvaluesR1RCtlistRn(RRKtfpnametcursecttoptnameR)teR*RtmotsectnameRutoptvaltpostall_sectionsRBRNtval((s$/usr/lib64/python2.7/ConfigParser.pyRG�sn
	
"2"

	 	
	
N(!RRRMt
_default_dictRgRR3R8R<R=RBRLRPRRR1RVRXRZRyRcReR2RhRjRkRpRqtretcompileR~R0R.RG(((s$/usr/lib64/python2.7/ConfigParser.pyR�s<								
									
				t	_ChainmapcBs)eZdZd�Zd�Zd�ZRS(s�Combine multiple mappings for successive lookups.

    For example, to emulate Python's normal lookup sequence:

        import __builtin__
        pylookup = _Chainmap(locals(), globals(), vars(__builtin__))
    cGs
||_dS(N(t_maps(Rtmaps((s$/usr/lib64/python2.7/ConfigParser.pyR7scCsDx1|jD]&}y||SWq
tk
r/q
Xq
Wt|��dS(N(R�R?(RR6tmapping((s$/usr/lib64/python2.7/ConfigParser.pyt__getitem__:s
cCsag}t�}xK|jD]@}x7|D]/}||kr&|j|�|j|�q&q&WqW|S(N(RjR�R(tadd(RtresulttseenR�R6((s$/usr/lib64/python2.7/ConfigParser.pyR7Bs	

(RRRRR�R7(((s$/usr/lib64/python2.7/ConfigParser.pyR�.s		cBsGeZedd�Zedd�Zd�Zejd�Z	d�Z
RS(c
Cs
i}y|j|}Wn,tk
rE|tkrFt|��qFnXi}|r�x0|j�D]\}}|||j|�<q_Wnt|||j�}	|j|�}y|	|}Wn tk
r�t||��nX|s�|dkr�|S|j
||||	�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RR1R2R�R-RRMt_interpolate(
RR R"trawtvarstsectiondicttvardictR6RRT((s$/usr/lib64/python2.7/ConfigParser.pyRRNs&

c	Cs|jj�}y|j|j|�Wn,tk
rU|tkrVt|��qVnX|r�x0|j�D]\}}|||j|�<qiWn|j	�}d|kr�|j
d�n|r�g|D]}|||f^q�Sg|D](}||j|||||�f^q�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RR1R2R7tremoveR�(	RR R�R�RTR6RRBR"((s$/usr/lib64/python2.7/ConfigParser.pyR1qs"
cCs�|}t}x�|r�|d8}|r�d|kr�|jj|j|�}y||}Wq�tk
r�}t||||jd��q�XqPqW|r�d|kr�t|||��n|S(Nis%(i(R
t_KEYCREtsubt_interpolation_replaceR?R#R!R(RR R"R%R�RtdepthR�((s$/usr/lib64/python2.7/ConfigParser.pyR��s	
 s%\(([^)]*)\)s|.cCs:|jd�}|dkr%|j�Sd|j|�SdS(Nis%%(%s)s(R�RMR2(RRts((s$/usr/lib64/python2.7/ConfigParser.pyR��s
N(RRRgRMRRR1R�R�R�R�R�(((s$/usr/lib64/python2.7/ConfigParser.pyR	Ls
# 	cBs5eZd�Zejd�Zd�Zdd�ZRS(cCs/g}|j|||||d�dj|�S(NiR(t_interpolate_someRn(RR R"R%R�tL((s$/usr/lib64/python2.7/ConfigParser.pyR��ss
%\(([^)]+)\)scCs�|tkr!t|||��nx�|r�|jd�}|dkrV|j|�dS|dkr�|j|| �||}n|dd!}|dkr�|jd�|d}q$|dkr�|jj|�}	|	dkr�t||d|��n|j|	j	d��}
||	j
�}y||
}Wn&tk
rTt||||
��nXd|kr�|j
||||||d�q�|j|�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_reRRMRR2R�tendR?R#R�(RR"taccumtrestR tmapR�tptctmtvarRd((s$/usr/lib64/python2.7/ConfigParser.pyR��sB	




	
cCs�|j|jks|r9t|t�s9td��q9n|dk	r�|jdd�}|jjd|�}d|kr�t	d||j
d�f��q�ntj||||�dS(sASet an option.  Extend ConfigParser.set: check for string values.soption values must be stringss%%RR�s1invalid interpolation syntax in %r at position %dN(
R/R0RCRDt	TypeErrorRMRmR�R�R;R�R	Rj(RR R"Rt	tmp_value((s$/usr/lib64/python2.7/ConfigParser.pyRj�sN(	RRR�R�R�R�R�RMRj(((s$/usr/lib64/python2.7/ConfigParser.pyR
�s		&(RtcollectionsRR�tImportErrortdictR�t__all__RR
RRRRRRR#RRRRRtUserDictt	_UserDictt	DictMixinR�R	R
(((s$/usr/lib64/python2.7/ConfigParser.pyt<module>Xs:

		
	
�Fb

Zerion Mini Shell 1.0