ihih - simple configuration parsers with dictionary-like interface
License: BSD 3-Clause
Bases: dict
IHIH - simple configuration parser
One key/value pair per line.
define the encoding
attempt to parse a list of filenames
Parameters:
parse a configuration file
Note
filename should be an absolute path.
remove escape prefix on “known escape”
See _escaped_chars.
This method attempt to utf8 encode unicode() objects.
handle a fragment of a value
Provided to help on subclassing.
remove the comment on value
parse the “value” part of a “key / value”
This function handle the quoted parts.
Parameters:
return a string representation of value
True if self contains key
Note
The key will be casted as str() (see: _cast_str()).
set item key to value
Note
Both variables will be casted as str() (see: _cast_str()).
return key value as internal type
You probably want to use one of the following: get_str(), get_unicode(), get_float().
Note
The key will be casted as str() (see: _cast_str()).
delete key from dict
Note
The key will be casted as str() (see: _cast_str()).
return key value as str() or default if not found
Note
The key will be casted as str() (see: _cast_str()).
list of weak references to the object (if defined)
return key value as unicode() or default if not found
The errors parameter is passed to str.decode().
Note
The key will be casted as str() (see: _cast_str()).
return key value as float() or default if not found
If errors is “ignore”, return default value instead of raising TypeError on failure.
Note
The key will be casted as str() (see: _cast_str()).
Bases: ihih.IHIH
IHIH Interpolate - IHIH with variable interpolation
search for variables in fragment
return key value as internal type with interpolated variables
For more informations, see: __getitem__().
recursive variable handler
Default: empty string
You can overwrite this function when subclassing and chose to return a unexpended version of the variable, raise an error or make a single, non recursive, lookup.