ó zfc @s½dZyddlmZWnek r3eZnXddlZdddddd 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„ƒ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ÿÿÿÿ(t OrderedDictNtNoSectionErrortDuplicateSectionErrort NoOptionErrortInterpolationErrortInterpolationDepthErrortInterpolationSyntaxErrort ParsingErrortMissingSectionHeaderErrort ConfigParsertSafeConfigParsertRawConfigParsert DEFAULTSECTtMAX_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„Z d 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|ƒ' is used. sN(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|ƒ[^]]+)\]s9(?P