Part of otfbot.services.config View Source View In Hierarchy
Method | __init__ | Initialize the config class and load a config |
Method | get | get an option and set the default value, if the option is unset. |
Method | has | Test, in which networks/channels a option is set. |
Method | set | Undocumented |
Method | delete |
>>> c=configService()
|
Method | getNetworks | Undocumented |
Method | getChannels | Undocumented |
Method | setConfig | Undocumented |
Method | delConfig | Undocumented |
Method | hasConfig | Undocumented |
Method | getConfig | Undocumented |
Method | getPath | Undocumented |
Method | getBool |
>>> c=configService()
|
Method | writeConfig | Undocumented |
Method | startService | Start the service. |
Method | stopService | Stop the service. |
Method | _create_preceding | create preceding dictionary entries for network/channel options |
Inherited from Service:
Method | __getstate__ | Undocumented |
Method | setName | Set the name of the service. |
Method | setServiceParent | Set the parent of the service. |
Method | disownServiceParent | Use this API to remove an IService
from an IServiceCollection . |
Method | privilegedStartService | Do preparation work for starting the service. |
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': {}}}
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 | set_default | if 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. |
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'], [])
>>> c=configService() >>> c.set("key", "value") >>> c.get("key", "unset") 'value' >>> c.delete("key") >>> c.get("key", "unset") 'unset'
>>> 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