python-ini
… powered by
Python APG
|
Public Member Functions | |
def | __init__ (self) |
Ini file writer constructor. More... | |
def | clear (self) |
Initialize or reset the writer to its constructor defaults. More... | |
def | booleans (self, true=False, false=False, none=False) |
Sets the values to specify for boolean (and null) values. More... | |
def | comment_tab (self, tab=None) |
Sets the column value for the tab to inline comments. More... | |
def | delimiters (self, comment=False, key=False, value=False) |
Sets the delimeter values. More... | |
def | section (self, name, comment=None) |
Add a section line to the INI file. More... | |
def | key (self, name, varg, comment=None) |
Add a key/value line to the INI file. More... | |
def | comment (self, comment=None) |
Add a comment line to the INI file. More... | |
def | to_string (self) |
Convert all lines added with the section(), key() and comment() functions to a valid, formatted INI file. More... | |
def | write (self, fname) |
Write the formatted INI file to a file. More... | |
Public Attributes | |
errors | |
Definition at line 9 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.__init__ | ( | self | ) |
Ini file writer constructor.
Note that configurable values are set to defaults.
Definition at line 11 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.booleans | ( | self, | |
true = False , |
|||
false = False , |
|||
none = False |
|||
) |
Sets the values to specify for boolean (and null) values.
true | If specified must be one of 'true', 'yes' or 'on', all case insensitive. |
false | If specified must be one of 'false', 'no' or 'off', all case insensitive. |
none | If specified must be one of 'none', 'null' or 'void', all case insensitive. |
Definition at line 129 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.clear | ( | self | ) |
Initialize or reset the writer to its constructor defaults.
Definition at line 42 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.comment | ( | self, | |
comment = None |
|||
) |
Add a comment line to the INI file.
comment | A comment string. Valid comments are:
|
Definition at line 258 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.comment_tab | ( | self, | |
tab = None |
|||
) |
Sets the column value for the tab to inline comments.
tab | The column value to begin inline comments. Must be an integer tab >= 0. |
Definition at line 161 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.delimiters | ( | self, | |
comment = False , |
|||
key = False , |
|||
value = False |
|||
) |
Sets the delimeter values.
comment | The comment delimiter. Must be semicolon(";") or hash("#"). |
key | The key/value delimiter. Must be equals("="), colon(":") or space. |
value | The delimiter between multiple key values. Must be comma(",") or space. |
Definition at line 175 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.key | ( | self, | |
name, | |||
varg, | |||
comment = None |
|||
) |
Add a key/value line to the INI file.
name | The key name. Must be one or more characters from the set
|
varg | The value for the key. May be a single value or a list of values. Valid values are:
|
comment | An inline comment to add to the key/value line. |
Definition at line 220 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.section | ( | self, | |
name, | |||
comment = None |
|||
) |
Add a section line to the INI file.
name | The section name. Must be one or more characters from the set
|
comment | An inline comment to add to the section name line. |
Definition at line 209 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.to_string | ( | self | ) |
Convert all lines added with the section(), key() and comment() functions to a valid, formatted INI file.
Definition at line 269 of file ini_writer.py.
def python_ini.ini_writer.IniWriter.write | ( | self, | |
fname | |||
) |
Write the formatted INI file to a file.
Calls to_string().
fname | The file name to write the INI file to. |
Definition at line 324 of file ini_writer.py.
python_ini.ini_writer.IniWriter.errors |
Definition at line 44 of file ini_writer.py.