Package parpg :: Module settings :: Class Section
[hide private]
[frames] | no frames]

Class Section

source code

object --+
         |
        Section

An object that represents a section in a settings file.

Options can be added to a section by simply assigning a value to an 
attribute:
    section.foo = baz
would produce:
    [section]
    foo = baz
in the settings file. Options that do not exist on assignment
are created dynamcially.

Values are automatically converted to the appropriate python type. 
Options that begin and end with brackets([, ]) are converted to lists,
and options that are double-quoted (") are converted to strings. 
Section also recognizes booleans regardless of case, in addition to the
literals 'yes' and 'no' of any case. Except in the case of 
double-quoted strings, extra white-space is trimmed, so you need not 
worry. For example:
    foo = bar
is equivalent to :
    foo    =         baz

Instance Methods [hide private]
 
__init__(self, name)
Initialize a new section.
source code
 
__setattr__(self, option, value)
Assign a value to an option, converting types when appropriate.
source code
 
__getattribute__(self, option)
Returns the option's value
source code

Inherited from object: __delattr__, __format__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  options
Returns a dictionary of existing options

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 

Initialize a new section.

Parameters:
  • name (string) - name of the section. In the INI file, sections are surrounded by brackets ([name])
Overrides: object.__init__

__setattr__(self, option, value)

source code 

Assign a value to an option, converting types when appropriate.

Parameters:
  • option (string @param value: value to be assigned to the option.) - name of the option to assign a value to.
  • value (int, float, string, boolean, or list)
Overrides: object.__setattr__

__getattribute__(self, option)

source code 

Returns the option's value

Overrides: object.__getattribute__

Property Details [hide private]

options

Returns a dictionary of existing options

Get Method:
unreachable.options(self) - Returns a dictionary of existing options