当前位置: 首页>>代码示例>>Python>>正文


Python Configuration.read_config方法代码示例

本文整理汇总了Python中configuration.Configuration.read_config方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.read_config方法的具体用法?Python Configuration.read_config怎么用?Python Configuration.read_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configuration.Configuration的用法示例。


在下文中一共展示了Configuration.read_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_destroy

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
def do_destroy(args):
    """Destroy a droplet based on configuration"""
    config = Configuration()
    if not config.read_config(args.config_file):
        return False

    destroy(config)
    return True
开发者ID:dfego,项目名称:digitalocean-droplet-manager,代码行数:10,代码来源:domanager.py

示例2: do_create

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
def do_create(args):
    """Create a droplet based on configuration"""
    config = Configuration()
    if not config.read_config(args.config_file):
        return False

    create(config)
    return True
开发者ID:dfego,项目名称:digitalocean-droplet-manager,代码行数:10,代码来源:domanager.py

示例3: Configuration

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
    for action in actions:
        action.wait()
        print 'Action {} is {}'.format(action.type, action.status)

    # Now get and upate the DNS record -- assumes a single A record, which we
    # delete
    domains = manager.get_all_domains()
    for domain in domains:
        if domain.name == config.domain_name:
            records = domain.get_records()
            for record in records:
                if record.type == 'A':
                    record.destroy()

    print 'Destroy of {} complete!'.format(config.domain_name)
    return True


if __name__ == '__main__':
    # Use argparse, even though just getting on arg for now
    parser = argparse.ArgumentParser()
    parser.add_argument('config_file', help='configuration file to use')
    args = parser.parse_args()

    # Read config file
    config = Configuration()
    if not config.read_config(args.config_file):
        sys.exit(1)

    destroy(config)
开发者ID:dfego,项目名称:digitalocean-droplet-manager,代码行数:32,代码来源:destroy.py

示例4: cleanup

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
# Main loop

@atexit.register
def cleanup():
	debug_print("Closing devices and database...")
	
	device_handle.close()
	db_cursor.close()

if __name__ == "__main__":
	if len(sys.argv) < 2:
		sys.exit("Not enough arguments. Usage: %s <configuration file>")
		
	random.seed()
	
	instance_conf.read_config(sys.argv[1])
	
	# Open database
	db = MySQLdb.connect(host=instance_conf.db_host, port=instance_conf.db_port, db=instance_conf.db_database, user=instance_conf.db_username, passwd=instance_conf.db_password)
	db_cursor = db.cursor()
	
	# Open device
	for k, v in instance_conf.devices:
		device_arr[k] = (serial.Serial(k), ReadDeviceThread())
		
		device_arr[k][1].set_device_handle(device_handle)
		device_arr[k][1].set_data_buffer(data_buffer)
		device_arr[k][1].set_data_buffer_lock(data_buffer_lock)
		device_arr[k][1].start()

		debug_print("Device running in thread: %s" % device_arr[k][1].getName())
开发者ID:smiley325,项目名称:ncsapowermonitor,代码行数:33,代码来源:host.py


注:本文中的configuration.Configuration.read_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。