| Method Summary |
| |
__init__(self,
file)
|
| Boolean
|
GetBool(self,
element,
section)
Returns the value (Boolean) of a given field. |
| datetime
|
GetDateTime(self,
element,
section)
Returns the value (datetime) of a given field. |
| given by 'type'
|
GetElement(self,
element,
section,
type)
Returns the value of a given field. |
| float
|
GetFloat(self,
element,
section)
Returns specified element value in given section, as float. |
| int
|
GetInt(self,
element,
section)
Returns specified element value in given section, as integer |
| int (preferred) or float
|
GetNum(self,
element,
section)
Returns the value (number: int or float) of a given field. |
| string
|
GetOutput(self,
command)
Calls external program extract_configuration (which must be in the
PATH), and returns output of execution on success. |
| string
|
GetString(self,
element,
section)
Returns the value (string) of a given field. |
| string
|
ListAll(self)
Lists everything in config file. |
| string
|
ListSectionLines(self,
section)
Lists everything in specified section of config file. |
| string
|
ListSections(self)
Lists all sections of config file. |
| datetime
|
StringToDateTime(self,
str)
Converts a string into a datetime object. |
GetElement(self,
element,
section='',
type='String')
Returns the value of a given field.
-
- Parameters:
element -
The element (field) to be found in the configuration file.
(type=string)
section -
The section in which the element should be found, if any.
(type=string)
type -
The type of the element to be returned. It could be: 'Int',
'IntList', 'IntSection', 'Bool', 'Float', 'FloatList',
'FloatSection', 'String', 'StringList', 'StringSection', 'Num',
'NumList' or 'NumSection'. 'Num' means 'Int' or 'Float'.
(type=string)
- Returns:
-
The value of the field in the configuration file.
(type=given by 'type')
Warning: In case the output is a list, the section is not taken into account,
which means that two lists against the same field name should not be
introduced in the configuration file, even in two different sections.
|