python-ini
… powered by
Python APG
|
Public Member Functions | |
def | __init__ (self, values='s', debug=False) |
Ini file parser constructor. More... | |
def | parse (self, fname=None, fhandle=None, fstr=None) |
Parse the input INI file. More... | |
def | display_errors (self) |
Converts any errors found in the INI file syntax to a human-readable ASCII string. More... | |
def | get_keys (self) |
Get a list of the global key names. More... | |
def | get_values (self, key, default=None) |
Get the list of values for a global key name. More... | |
def | get_sections (self) |
Get a list of the section names. More... | |
def | get_section_keys (self, section) |
Get a list of key names in the named section. More... | |
def | get_section_values (self, section, key, default=None) |
Get a list of values for the named key in the named section. More... | |
Public Attributes | |
errors | |
Definition at line 27 of file ini_file.py.
def python_ini.ini_file.IniFile.__init__ | ( | self, | |
values = 's' , |
|||
debug = False |
|||
) |
Ini file parser constructor.
values | Determines whether the "getter" functions", get_values() and get_section_values(), return a single value or a list of one or more values.
|
debug | If True, a trace of the parse is printed to stdout. |
Definition at line 29 of file ini_file.py.
def python_ini.ini_file.IniFile.display_errors | ( | self | ) |
Converts any errors found in the INI file syntax to a human-readable ASCII string.
Definition at line 129 of file ini_file.py.
def python_ini.ini_file.IniFile.get_keys | ( | self | ) |
Get a list of the global key names.
Definition at line 139 of file ini_file.py.
def python_ini.ini_file.IniFile.get_section_keys | ( | self, | |
section | |||
) |
Get a list of key names in the named section.
section | The section name to find the key names in . |
Definition at line 182 of file ini_file.py.
def python_ini.ini_file.IniFile.get_section_values | ( | self, | |
section, | |||
key, | |||
default = None |
|||
) |
Get a list of values for the named key in the named section.
section | The section name to find the key in. |
key | The key name to find the list of values for. |
default | The value to return if the section or key name is not found. The default value ignores the single- or multi-valued mode and is returned exactly as given to the user. It is the user's responsibility to supply a default that makes sense to his application. |
Definition at line 193 of file ini_file.py.
def python_ini.ini_file.IniFile.get_sections | ( | self | ) |
Get a list of the section names.
Definition at line 173 of file ini_file.py.
def python_ini.ini_file.IniFile.get_values | ( | self, | |
key, | |||
default = None |
|||
) |
Get the list of values for a global key name.
key | The name of the key to get values for. |
default | The value to return if the key name is not found. The default value ignores the single- or multi-valued mode and is returned exactly as given to the user. It is the user's responsibility to supply a default that makes sense to his application. |
Definition at line 148 of file ini_file.py.
def python_ini.ini_file.IniFile.parse | ( | self, | |
fname = None , |
|||
fhandle = None , |
|||
fstr = None |
|||
) |
Parse the input INI file.
Parses the ini file, input as a file name, file handle or string. At least one of fname, fhandle or fstr must be supplied. If more than one, the first non-None value of fname, fhandle or fstr in that order is accepted. If none are supplied an Exception is raised.
fname | The name of the ini file to parse. |
fhandle | A handle to an open ini file. |
fstr | The ini file as a string. |
Definition at line 75 of file ini_file.py.
python_ini.ini_file.IniFile.errors |
Definition at line 44 of file ini_file.py.