Bases: object
A setting and associated value stored in a configuration file.
These objects should be created as members of ConfigNamespace subclasses, for example:
class _Conf(config.ConfigNamespace):
unicode_output = config.ConfigItem(
False,
'Use Unicode characters when outputting values, and writing widgets '
'to the console.')
conf = _Conf()
| Parameters: | defaultvalue : object, optional
description : str or None, optional
cfgtype : str or None, optional
module : str or None, optional
aliases : str, or list of str, optional
|
|---|---|
| Raises: | RuntimeError
|
Attributes Summary
| cfgtype | A type specifier like those used as the values of a particular key in a configspec file of configobj. |
Methods Summary
| __call__() | Returns the value of this ConfigItem |
| reload() | Reloads the value of this ConfigItem from the relevant configuration file. |
| set(value) | Sets the current value of this ConfigItem. |
| set_temp(*args, **kwds) | Sets this item to a specified value only inside a with block. |
Attributes Documentation
A type specifier like those used as the values of a particular key in a configspec file of configobj.
Methods Documentation
Returns the value of this ConfigItem
| Returns: | val
|
|---|---|
| Raises: | TypeError
|
Reloads the value of this ConfigItem from the relevant configuration file.
| Returns: | val
|
|---|
Sets the current value of this ConfigItem.
This also updates the comments that give the description and type information.
| Parameters: | value
|
|---|---|
| Raises: | TypeError
|
Sets this item to a specified value only inside a with block.
Use as:
ITEM = ConfigItem('ITEM', 'default', 'description')
with ITEM.set_temp('newval'):
#... do something that wants ITEM's value to be 'newval' ...
print(ITEM)
# ITEM is now 'default' after the with block
| Parameters: | value
|
|---|