usr/lib64/python2.7/ConfigParser.pyo000064400000061175147204474450013205 0ustar00 zfc @sdZyddlmZWnek r3eZnXddlZdddddd d d d d dddg ZdZdZ de fdYZ de fdYZ de fdYZ de fdYZde fdYZdefdYZd efdYZdefdYZd e fdYZd efdYZdfdYZddlZd 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 tErrorcBsJeZdZdZdZeeeZddZdZeZ 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.pyRs 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    cBseZdZdZRS(s2Raised when no section matches a requested option.cCs0tj|d|f||_|f|_dS(NsNo section: %r(RRtsectiontargs(RR ((s$/usr/lib64/python2.7/ConfigParser.pyRs (RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRscBseZdZdZRS(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.pyRs (RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRscBseZdZdZRS(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.pyRs    (RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRscBseZdZdZRS(s0Base class for interpolation-related exceptions.cCs8tj||||_||_|||f|_dS(N(RRR"R R!(RR"R R((s$/usr/lib64/python2.7/ConfigParser.pyRs  (RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRstInterpolationMissingOptionErrorcBseZdZdZRS(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.pyRs  (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.pyRscBseZdZdZRS(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.pyRs(RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRscBs eZdZdZdZRS(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.pyRs  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.pyRs cBseZdZdZRS(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.pyRs   (RRRR(((s$/usr/lib64/python2.7/ConfigParser.pyRscBs?eZd eedZdZdZdZdZ dZ dZ d dZ dZ d Zd Zd Zd Zied 6ed6ed6ed6ed6ed6ed6ed6ZdZdZdZd dZdZdZdZejdZejdZejdZdZ RS(!cCs||_|j|_|j|_|r<|j|_n |j|_|rx3|jD]"\}}||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   cCsy|j|}Wn8tk rK|tkr<t|n|j}nX|jj}|j|d|kr~|d=n|jS(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|jS(NsNot a boolean: %s(RRR:t_boolean_statesR;(RR R"tv((s$/usr/lib64/python2.7/ConfigParser.pyt getbooleanoscCs |jS(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