本文整理汇总了Python中iniparse.ConfigParser.getint方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigParser.getint方法的具体用法?Python ConfigParser.getint怎么用?Python ConfigParser.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iniparse.ConfigParser
的用法示例。
在下文中一共展示了ConfigParser.getint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_enabling_yum_plugin_with_wrong_conf
# 需要导入模块: from iniparse import ConfigParser [as 别名]
# 或者: from iniparse.ConfigParser import getint [as 别名]
def test_enabling_yum_plugin_with_wrong_conf(self):
"""
Test automatic enabling of configuration files of already plugins with wrong values in conf file.
"""
self.init_yum_plugin_conf_files(conf_string=PKG_PLUGIN_CONF_FILE_WRONG_VALUE)
plugin_list = YumPluginManager.enable_pkg_plugins()
self.assertEqual(len(plugin_list), 2)
for plugin_conf_file_name in YumPluginManager.PLUGINS:
yum_plugin_config = ConfigParser()
result = yum_plugin_config.read(YumPluginManager.YUM_PLUGIN_DIR + '/' + plugin_conf_file_name + '.conf')
self.assertGreater(len(result), 0)
is_plugin_enabled = yum_plugin_config.getint('main', 'enabled')
self.assertEqual(is_plugin_enabled, 1)
self.restore_yum_plugin_conf_files()
示例2: test_enabling_enabled_yum_plugin_int
# 需要导入模块: from iniparse import ConfigParser [as 别名]
# 或者: from iniparse.ConfigParser import getint [as 别名]
def test_enabling_enabled_yum_plugin_int(self):
"""
Test automatic enabling of configuration files of already enabled plugins
"""
self.init_yum_plugin_conf_files(conf_string=PKG_PLUGIN_CONF_FILE_ENABLED_INT)
plugin_list = YumPluginManager.enable_pkg_plugins()
self.assertEqual(len(plugin_list), 0)
for plugin_conf_file_name in YumPluginManager.PLUGINS:
yum_plugin_config = ConfigParser()
result = yum_plugin_config.read(YumPluginManager.YUM_PLUGIN_DIR + '/' + plugin_conf_file_name + '.conf')
self.assertGreater(len(result), 0)
is_plugin_enabled = yum_plugin_config.getint('main', 'enabled')
self.assertEqual(is_plugin_enabled, 1)
self.restore_yum_plugin_conf_files()
示例3: startService
# 需要导入模块: from iniparse import ConfigParser [as 别名]
# 或者: from iniparse.ConfigParser import getint [as 别名]
def startService(self):
cfgpr = ConfigParser()
# TODO: config location from argparse or something
cfgpr.read('config/config.ini')
ip = cfgpr.get('main', 'ip')
port = cfgpr.getint('main', 'port')
tag = cfgpr.get('main', 'tag')
password = cfgpr.get('main', 'password')
server_data = {
'ip': ip,
'port': port,
'tag': tag, # TODO: what is this:
'secret': password, # TODO: refactor how this kind of data is passed and stored in factory
}
factory = getClientRconFactory(server_data)
client = TCPClient(server_data["ip"], server_data["port"], factory)
client.setServiceParent(self)
self.server["factory"] = factory
MultiService.startService(self)