class documentation

class configService(service.Service): (source)

View In Hierarchy

Undocumented

Method __init__ Initialize the config class and load a config
Method delConfig Undocumented
Method delete No summary
Method get get an option and set the default value, if the option is unset.
Method getBool No summary
Method getChannels Undocumented
Method getConfig Undocumented
Method getNetworks Undocumented
Method getPath Undocumented
Method has Test, in which networks/channels a option is set. Returns a tuple: (general_bool, network_list, (network, channel) list)
Method hasConfig Undocumented
Method set Undocumented
Method setConfig Undocumented
Method startService Undocumented
Method stopService Undocumented
Method writeConfig Undocumented
Instance Variable filename Undocumented
Instance Variable generic_options Undocumented
Instance Variable generic_options_default Undocumented
Instance Variable logger Undocumented
Instance Variable name Undocumented
Instance Variable network_options Undocumented
Method _create_preceding create preceding dictionary entries for network/channel options
def __init__(self, filename=None, is_subconfig=False): (source)

Initialize the config class and load a config

def delConfig(self, opt, module=None, network=None, channel=None): (source)

Undocumented

def delete(self, option, module=None, network=None, channel=None): (source)
>>> c=configService()
>>> c.set("key", "value")
>>> c.get("key", "unset")
'value'
>>> c.delete("key")
>>> c.get("key", "unset")
'unset'
def get(self, option, default, module=None, network=None, channel=None, set_default=True): (source)

get an option and set the default value, if the option is unset.

>>> c=configService()
>>> c.get("option", "default")
'default'
>>> c.get("option", "unset?")
'default'
Parameters
optionUndocumented
defaultUndocumented
moduleUndocumented
networkUndocumented
channelUndocumented
set_defaultif True, the default will be set in the config, if its used. If False, the default will be returned, but the config will not be changed.
def getBool(self, option, defaultvalue='', module=None, network=None, channel=None): (source)
>>> c=configService()
>>> c.set("key", "1")
>>> c.set("key2", "on")
>>> c.set("key3", "True")
>>> c.getBool("key") and c.getBool("key2") and c.getBool("key3")
True
>>> c.set("key", "False")
>>> c.set("key2", "any string which is not in [True, true, on, On, 1]")
>>> c.getBool("key") or c.getBool("key2")
False
def getChannels(self, network): (source)

Undocumented

def getConfig(self, option, defaultvalue='', module=None, network=None, channel=None, set_default=True): (source)

Undocumented

def getNetworks(self): (source)

Undocumented

def getPath(self, option, datadir, defaultvalue='', module=None, network=None, channel=None): (source)

Undocumented

def has(self, option, module=None): (source)

Test, in which networks/channels a option is set. Returns a tuple: (general_bool, network_list, (network, channel) list)

>>> c=configService()
>>> c.has("testkey")
(False, [], [])
>>> c.set("testkey", "testvalue")
>>> c.has("testkey")
(True, [], [])
>>> c.set("testkey", "othervalue", network="samplenetwork")
>>> c.has("testkey")
(True, ['samplenetwork'], [])
def hasConfig(self, option, module=None): (source)

Undocumented

def set(self, option, value, module=None, network=None, channel=None, still_default=False): (source)

Undocumented

def setConfig(self, opt, value, module=None, network=None, channel=None): (source)

Undocumented

def startService(self): (source)

Undocumented

def stopService(self): (source)

Undocumented

def writeConfig(self): (source)

Undocumented

filename = (source)

Undocumented

generic_options = (source)

Undocumented

generic_options_default: dict = (source)

Undocumented

Undocumented

name: str = (source)

Undocumented

network_options: dict = (source)

Undocumented

def _create_preceding(self, network, channel=None): (source)

create preceding dictionary entries for network/channel options

>>> c=configService()
>>> c.network_options
{}
>>> c._create_preceding("samplenetwork", "#samplechannel")
>>> c.network_options
{'samplenetwork': {'#samplechannel': {}}}
>>> c._create_preceding("othernetwork")
>>> c.network_options
{'othernetwork': {}, 'samplenetwork': {'#samplechannel': {}}}