Home | Trees | Index | Help |
|
---|
Module ConfigParser :: Class ConfigParser |
|
ConfigParser
Method Summary | |
---|---|
__init__(self,
defaults)
| |
Create a new section in the configuration. | |
defaults(self)
| |
Get an option value for a given section. | |
getboolean(self,
section,
option)
| |
getfloat(self,
section,
option)
| |
getint(self,
section,
option)
| |
Check for the existence of a given option in a given section. | |
Indicate whether the named section is present in the configuration. | |
Return a list of option names for the given section name. | |
optionxform(self,
optionstr)
| |
Read and parse a filename or a list of filenames. | |
Like read() but the argument must be a file-like object. | |
Remove an option. | |
Remove a file section. | |
Return a list of section names, excluding [DEFAULT]... | |
Set an option. | |
Write an .ini-format representation of the configuration state. | |
__get(self,
section,
conv,
option)
| |
Parse a sectioned setup file. |
Class Variable Summary | |
---|---|
SRE_Pattern |
OPTCRE = ([\]-\[\w_\.\*,\(\)\{\}]+)[ \t]*([:=])[ \t]*(.*...
|
SRE_Pattern |
SECTCRE = \[([^\]]+)\]
|
Method Details |
---|
add_section(self, section)Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. |
get(self, section, option, raw=0, vars=None)Get an option value for a given 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. |
has_option(self, section, option)Check for the existence of a given option in a given section. |
has_section(self, section)Indicate whether the named section is present in the configuration. The DEFAULT section is not acknowledged. |
options(self, section)Return a list of option names for the given section name. |
read(self, filenames)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. |
readfp(self, fp, filename=None)Like 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. |
remove_option(self, section, option)Remove an option. |
remove_section(self, section)Remove a file section. |
sections(self)Return a list of section names, excluding [DEFAULT] |
set(self, section, option, value)Set an option. |
write(self, fp)Write an .ini-format representation of the configuration state. |
__read(self, fp, fpname)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. Continuation are represented by an embedded newline then leading whitespace. Blank lines, lines beginning with a '#', and just about everything else is ignored. |
Class Variable Details |
---|
OPTCRE
|
SECTCRE
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Tue Jul 22 05:31:18 2003 | http://epydoc.sf.net |