userconfig¶
The guidata.userconfig
module provides user configuration file (.ini file)
management features based on ConfigParser
(standard Python library).
It is the exact copy of the open-source package userconfig (MIT license).
-
guidata.userconfig.
encode_to_utf8
(x)[source]¶ Encode unicode string in UTF-8 – but only with Python 2
-
class
guidata.userconfig.
UserConfig
(defaults)[source]¶ UserConfig class, based on ConfigParser name: name of the config options: dictionnary containing options or list of tuples (section_name, options)
Note that ‘get’ and ‘set’ arguments number and type differ from the overriden methods
-
get_default
(section, option)[source]¶ Get Default value for a given (section, option)
Useful for type checking in ‘get’ method
-
get
(section, option, default=<class 'guidata.userconfig.NoDefault'>, raw=None, **kwargs)[source]¶ Get an option section=None: attribute a default section name default: default value (if not specified, an exception will be raised if option doesn’t exist)
-
set_default
(section, option, default_value)[source]¶ Set Default value for a given (section, option) -> called when a new (section, option) is set and no default exists
-