Package dics :: Module ConfigParserRT :: Class RawConfigParser
[hide private]
[frames] | no frames]

Class RawConfigParser
source code

Known Subclasses:
ConfigParser

Instance Methods [hide private]
  __init__(self, defaults=None)
  defaults(self)
  sections(self)
Return a list of section names, excluding [DEFAULT]
  add_section(self, section)
Create a new section in the configuration.
  has_section(self, section)
Indicate whether the named section is present in the configuration.
  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.
  readfp(self, fp, filename=None)
Like read() but the argument must be a file-like object.
  get(self, section, option)
  items(self, section)
  _get(self, section, conv, option)
  getint(self, section, option)
  getfloat(self, section, option)
  getboolean(self, section, option)
  optionxform(self, optionstr)
  has_option(self, section, option)
Check for the existence of a given option in a given section.
  set(self, section, option, value)
Set an option.
  write(self, fp)
Write an .ini-format representation of the configuration state.
  remove_option(self, section, option)
Remove an option.
  remove_section(self, section)
Remove a file section.
  _read(self, fp, fpname)
Parse a sectioned setup file.

Class Variables [hide private]
_boolean_states  
SECTCRE  
OPTCRE  

Method Details [hide private]

__init__(self, defaults=None)
(Constructor)

source code 

defaults(self)

source code 

sections(self)

source code 
Return a list of section names, excluding [DEFAULT]

add_section(self, section)

source code 

Create a new section in the configuration.

Raise DuplicateSectionError if a section by the specified name already exists.

has_section(self, section)

source code 

Indicate whether the named section is present in the configuration.

The DEFAULT section is not acknowledged.

options(self, section)

source code 
Return a list of option names for the given section name.

read(self, filenames)

source code 

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)

source code 

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.

get(self, section, option)

source code 

items(self, section)

source code 

_get(self, section, conv, option)

source code 

getint(self, section, option)

source code 

getfloat(self, section, option)

source code 

getboolean(self, section, option)

source code 

optionxform(self, optionstr)

source code 

has_option(self, section, option)

source code 
Check for the existence of a given option in a given section.

set(self, section, option, value)

source code 
Set an option.

write(self, fp)

source code 
Write an .ini-format representation of the configuration state.

remove_option(self, section, option)

source code 
Remove an option.

remove_section(self, section)

source code 
Remove a file section.

_read(self, fp, fpname)

source code 

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.

Class Variable Details [hide private]

_boolean_states

Value:
{'0': False,
 '1': True,
 'false': False,
 'no': False,
 'off': False,
 'on': True,
 'true': True,
 'yes': True}                                                          
      

SECTCRE

Value:
\[([^\]]+)\]                                                           
      

OPTCRE

Value:
([^:=\s][^:=]*)\s*([:=])\s*(.*)$